[Uml-devel] kdesdk/umbrello/umbrello/classparser

Oliver Kellogg okellogg at users.sourceforge.net
Thu Aug 26 13:26:02 UTC 2004


CVS commit by okellogg: 

Skip anon enums. Create fake name for anon structs.


  M +7 -2      cpptree2uml.cpp   1.11
  M +1 -0      cpptree2uml.h   1.5


--- kdesdk/umbrello/umbrello/classparser/cpptree2uml.cpp  #1.10:1.11
@@ -25,5 +25,5 @@
 
 CppTree2Uml::CppTree2Uml( const QString& fileName, ClassImport* store )
-    : m_importer( store ), m_anon( 0 ), m_nsCnt( 0 ), m_clsCnt( 0 )
+    : m_importer( store ), m_anon( 0 ), m_nsCnt( 0 ), m_clsCnt( 0 ), m_anonTypeCnt( 0 )
 {
     m_fileName = URLUtil::canonicalPath(fileName);
@@ -289,4 +289,7 @@ void CppTree2Uml::parseClassSpecifier( C
     }
 
+    if (className.isEmpty()) {
+        className = "anon_" + QString::number(++m_anonTypeCnt);
+    }
     UMLObject * o = m_importer->createUMLObject( Uml::ot_Class, className, "" /*stereotype*/,
                                                  ast->comment(),
@@ -317,6 +320,8 @@ void CppTree2Uml::parseEnumSpecifier( En
     NameAST *nameNode = ast->name();
     if (nameNode == NULL)
-        return;
+        return;  // skip constants
     QString typeName = nameNode->unqualifiedName()->text().stripWhiteSpace();
+    if (typeName.isEmpty())
+        return;  // skip constants
     UMLObject *o = m_importer->createUMLObject( Uml::ot_Enum, typeName,
                                                 "" /* stereotype */,

--- kdesdk/umbrello/umbrello/classparser/cpptree2uml.h  #1.4:1.5
@@ -86,4 +86,5 @@ private:
     int m_nsCnt;  ///< stack top for m_currentNamespace
     int m_clsCnt;  ///< stack top for m_currentClass
+    int m_anonTypeCnt;
 private:
     CppTree2Uml( const CppTree2Uml& source );






More information about the umbrello-devel mailing list