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

Oliver Kellogg okellogg at users.sourceforge.net
Mon Nov 10 13:48:03 UTC 2003


CVS commit by okellogg: 

qualifiedName(): Use new method UMLObect::getFullyQualifiedName().
writeClass(): Generate code for UMLEnum.


  M +28 -3     idlwriter.cpp   1.7


--- kdesdk/umbrello/umbrello/codegenerators/idlwriter.cpp  #1.6:1.7
@@ -27,4 +27,8 @@
 #include "../umldoc.h"
 #include "../class.h"
+#include "../enum.h"
+#include "../enumliteral.h"
+#include "../umlenumliterallist.h"
+#include "../package.h"
 #include "../association.h"
 #include "../attribute.h"
@@ -61,10 +65,10 @@ bool IDLWriter::isOOClass(UMLClassifier 
 
 QString IDLWriter::qualifiedName(UMLClassifier *c) {
-        QString umlPkg = c->getPackage();
+        UMLPackage *umlPkg = c->getUMLPackage();
         QString className = cleanName(c->getName());
         QString retval;
 
-        if (! umlPkg.isEmpty()) {
-                retval = umlPkg;
+        if (umlPkg) {
+                retval = umlPkg->getFullyQualifiedName();
                 retval.append("::");
         }
@@ -165,4 +169,25 @@ void IDLWriter::writeClass(UMLClassifier
         }
 
+        if (c->getBaseType() == Uml::ot_Enum) {
+                UMLEnum *ue = static_cast<UMLEnum*>(c);
+                UMLEnumLiteralList litList = ue->getFilteredEnumLiteralList();
+                uint i = 0;
+                idl << spc() << "enum " << classname << " {\n";
+                indentlevel++;
+                for (UMLEnumLiteral *lit = litList.first(); lit; lit = litList.next()) {
+                        QString enumLiteral = cleanName(lit->getName());
+                        idl << spc() << enumLiteral;
+                        if (++i < litList.count())
+                                idl << ",";
+                        idl << endl;
+                }
+                indentlevel--;
+                idl << spc() << "};\n\n";
+                if (! pkg.isEmpty()) {
+                        indentlevel--;
+                        idl << spc() << "};\n\n";
+                }
+                return;
+        }
         if (! isOOClass(c)) {
                 QString stype = c->getStereotype();






More information about the umbrello-devel mailing list