[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Thu Apr 15 04:45:00 UTC 2004


CVS commit by okellogg: 

createGeneralization(), addEnumLiteral(): New.


  M +22 -0     classimport.cpp   1.27
  M +11 -0     classimport.h   1.12


--- kdesdk/umbrello/umbrello/classimport.cpp  #1.26:1.27
@@ -168,4 +168,26 @@ UMLOperation * ClassImport::insertMethod
 }
 
+void ClassImport::addEnumLiteral(UMLObject *enumType, QString literal) {
+        if (enumType->getBaseType() != Uml::ot_Enum) {
+                kdDebug() << "ClassImport::addEnumLiteral: given object is not an ot_Enum"
+                          << endl;
+                return;
+        }
+        UMLEnum *e = static_cast<UMLEnum*>( enumType );
+        e->addEnumLiteral( literal, m_umldoc->getUniqueID() );
+}
+
+void ClassImport::createGeneralization(UMLObject *child, QString parentName) {
+        UMLObject *parent = m_umldoc->findUMLObject( parentName, Uml::ot_Class );
+        if (parent == NULL) {
+            kdDebug() << "ClassImport::createGeneralization: Could not find UML object for "
+                      << parentName << endl;
+            return;
+        }
+        UMLAssociation *assoc = new UMLAssociation( m_umldoc, Uml::at_Generalization,
+                                                    child, parent );
+        m_umldoc->addAssociation(assoc);
+}
+
 void ClassImport::importCPP(QStringList headerFileList) {
         for (QStringList::Iterator fileIT = headerFileList.begin();

--- kdesdk/umbrello/umbrello/classimport.h  #1.11:1.12
@@ -61,4 +61,15 @@ public:
 
         /**
+         * Add an enum literal to an UMLEnum.
+         */
+        void addEnumLiteral(UMLObject *enumType, QString literal);
+
+        /**
+         * Create a generalization from the existing child UMLObject to the given
+         * parent class name.
+         */
+        void createGeneralization(UMLObject *child, QString parentName);
+
+        /**
          * Check that a given comment conforms to the Doxygen convention, i.e.
          * check that it begins with slash-star-star.






More information about the umbrello-devel mailing list