[Uml-devel] branches/KDE/3.5/kdesdk/umbrello/umbrello

Oliver Kellogg okellogg at users.sourceforge.net
Sat Aug 6 18:20:57 UTC 2005


SVN commit 443716 by okellogg:

Ouch! Another forgotten commit. Thanks to Paulo Sehn for noticing.

 M  +7 -0      classimport.cpp  
 M  +14 -0     classimport.h  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classimport.cpp #443715:443716
@@ -38,6 +38,7 @@
 CppDriver * ClassImport::ms_driver;
 QStringList ClassImport::ms_seenFiles;
 bool ClassImport::ms_putAtGlobalScope;
+bool ClassImport::ms_newUMLObjectWasCreated;
 
 class CppDriver : public Driver {
 public:
@@ -54,6 +55,10 @@
 
 ClassImport::~ClassImport() {}
 
+bool ClassImport::newUMLObjectWasCreated() {
+    return ms_newUMLObjectWasCreated;
+}
+
 QString ClassImport::formatComment(const QString &comment) {
     QStringList lines = QStringList::split("\n", comment);
     QString& first = lines.first();
@@ -100,6 +105,7 @@
                                         QString stereotype) {
     UMLDoc *umldoc = UMLApp::app()->getDocument();
     UMLObject * o = umldoc->findUMLObject(name, type, parentPkg);
+    ms_newUMLObjectWasCreated = false;
     if (o == NULL) {
         // Strip possible adornments and look again.
         int isConst = name.contains(QRegExp("^const "));
@@ -141,6 +147,7 @@
             if (type == Uml::ot_UMLObject || isConst || isRef || isPointer)
                 t = Uml::ot_Class;
             origType = umldoc->createUMLObject(t, typeName, parentPkg);
+            ms_newUMLObjectWasCreated = true;
         }
         if (isConst || isPointer || isRef) {
             // Create the full given type (including adornments.)
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/classimport.h #443715:443716
@@ -112,6 +112,12 @@
      */
     static QStringList includePathList();
 
+    /**
+     * Returns whether the last createUMLObject() actually created
+     * a new object or just returned an existing one.
+     */
+    static bool newUMLObjectWasCreated();
+
 private:
     /**
     * Auxiliary method for recursively traversing the #include dependencies
@@ -133,6 +139,14 @@
      * I.e. before calling createUMLObject() we set this flag to true.
      */
     static bool ms_putAtGlobalScope;
+
+    /**
+     * Flag manipulated by createUMLObject().
+     * Global state is generally bad, I know.
+     * It would be cleaner to make this into a return value from
+     * createUMLObject().
+     */
+    static bool ms_newUMLObjectWasCreated;
 };
 
 #endif




More information about the umbrello-devel mailing list