[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Thu Apr 15 01:46:09 UTC 2004


CVS commit by okellogg: 

uniqObjectName(): Add an optional "prefix" arg. Publicize.


  M +28 -27    umldoc.cpp   1.137
  M +11 -7     umldoc.h   1.61


--- kdesdk/umbrello/umbrello/umldoc.cpp  #1.136:1.137
@@ -571,6 +571,7 @@ UMLClassifier* UMLDoc::findUMLClassifier
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-QString UMLDoc::uniqObjectName(const UMLObject_Type type) {
-        QString currentName;
+QString UMLDoc::uniqObjectName(const UMLObject_Type type, QString prefix) {
+        QString currentName = prefix;
+        if (currentName.isEmpty()) {
         if(type == ot_Class)
                 currentName = i18n("new_class");
@@ -597,5 +598,5 @@ QString	UMLDoc::uniqObjectName(const UML
         else
                 currentName = i18n("new_object");
-
+        }
         QString name = currentName;
         for (int number = 1; !isUnique(name); number++)  {

--- kdesdk/umbrello/umbrello/umldoc.h  #1.60:1.61
@@ -927,4 +927,15 @@ public:
         void addObject(UMLObject *o);
 
+        /**
+         * Returns a name for the new object, appended with a number
+         * if the default name is taken e.g. new_actor, new_actor_1
+         * etc.
+         * @param type          The object type.
+         * @param prefix        The prefix to use (optional.)
+         *                      If no prefix is given then a type related
+         *                      prefix will be chosen internally.
+         */
+        QString uniqObjectName(const UMLObject_Type type, QString prefix = "");
+
 private:
 
@@ -936,11 +947,4 @@ private:
 
         /**
-         * Returns a name for the new object, appended with a number
-         * if the default name is taken e.g. new actor, new actor_1
-         * etc.
-         */
-        QString uniqObjectName(const UMLObject_Type type);
-
-        /**
          * Utility method for the public findUMLObject() method: Find the
          * UML object of the given type and name in the passed-in list.






More information about the umbrello-devel mailing list