[Uml-devel] kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Wed Jun 2 22:20:03 UTC 2004


CVS commit by okellogg: 

get{Concepts,ClassesAndInterfaces,Interfaces}: Add an arg, includeNested.
 It is necessary to query the corresponding append method at packages
 since the objectList no longer directly contains the classifiers nested within
 packages.


  M +15 -5     umldoc.cpp   1.153
  M +9 -3      umldoc.h   1.67


--- kdesdk/umbrello/umbrello/umldoc.cpp  #1.152:1.153
@@ -2134,5 +2134,5 @@ QStringList UMLDoc::getModelTypes()
 }
 
-UMLClassifierList UMLDoc::getConcepts() {
+UMLClassifierList UMLDoc::getConcepts(bool includeNested /* =true */) {
         UMLClassifierList conceptList;
         for(UMLObject *obj = objectList.first(); obj ; obj = objectList.next()) {
@@ -2140,4 +2140,7 @@ UMLClassifierList UMLDoc::getConcepts() 
                 if(ot == ot_Class || ot == ot_Interface || ot == ot_Datatype || ot == ot_Enum)  {
                         conceptList.append((UMLClassifier *)obj);
+                } else if (includeNested && ot == ot_Package) {
+                        UMLPackage *pkg = static_cast<UMLPackage *>(obj);
+                        pkg->appendClassifiers(conceptList);
                 }
         }
@@ -2145,5 +2148,5 @@ UMLClassifierList UMLDoc::getConcepts() 
 }
 
-UMLClassifierList UMLDoc::getClassesAndInterfaces() {
+UMLClassifierList UMLDoc::getClassesAndInterfaces(bool includeNested /* =true */) {
         UMLClassifierList conceptList;
         for(UMLObject* obj = objectList.first(); obj ; obj = objectList.next()) {
@@ -2151,4 +2154,7 @@ UMLClassifierList UMLDoc::getClassesAndI
                 if(ot == ot_Class || ot == ot_Interface || ot == ot_Enum)  {
                         conceptList.append((UMLClassifier *)obj);
+                } else if (includeNested && ot == ot_Package) {
+                        UMLPackage *pkg = static_cast<UMLPackage *>(obj);
+                        pkg->appendClassesAndInterfaces(conceptList);
                 }
         }
@@ -2156,9 +2162,13 @@ UMLClassifierList UMLDoc::getClassesAndI
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
-QPtrList<UMLInterface> UMLDoc::getInterfaces() {
-        QPtrList<UMLInterface> interfaceList;
+UMLInterfaceList UMLDoc::getInterfaces(bool includeNested /* =true */) {
+        UMLInterfaceList interfaceList;
         for(UMLObject* obj = objectList.first(); obj ; obj = objectList.next()) {
-                if(obj->getBaseType() == ot_Interface) {
+                Uml::UMLObject_Type ot = obj->getBaseType();
+                if (ot == ot_Interface) {
                         interfaceList.append((UMLInterface*)obj);
+                } else if (includeNested && ot == ot_Package) {
+                        UMLPackage *pkg = static_cast<UMLPackage *>(obj);
+                        pkg->appendInterfaces(interfaceList);
                 }
         }

--- kdesdk/umbrello/umbrello/umldoc.h  #1.66:1.67
@@ -644,21 +644,27 @@ public:
          * Returns a list of the concepts in this UMLDoc.
          *
+         * @param includeNested         Whether to include the concepts from
+         *                              nested packages (default: true.)
          * @return      List of UML concepts.
          */
-        UMLClassifierList getConcepts();
+        UMLClassifierList getConcepts(bool includeNested = true);
 
         /**
          * Returns a list of the classes and interfaces in this UMLDoc.
          *
+         * @param includeNested         Whether to include the concepts from
+         *                              nested packages (default: true.)
          * @return      List of UML concepts.
          */
-        UMLClassifierList getClassesAndInterfaces();
+        UMLClassifierList getClassesAndInterfaces(bool includeNested = true);
 
         /**
          * Returns a list of the interfaces in this UMLDoc.
          *
+         * @param includeNested         Whether to include the concepts from
+         *                              nested packages (default: true.)
          * @return      List of UML interfaces.
          */
-        UMLInterfaceList getInterfaces();
+        UMLInterfaceList getInterfaces(bool includeNested = true);
 
         /**






More information about the umbrello-devel mailing list