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

Oliver Kellogg okellogg at users.sourceforge.net
Mon Mar 26 05:02:38 UTC 2007


SVN commit 646557 by okellogg:

CodeClassField::finishInitialization(): New method for finishing off
initializations of the object.
This is necessary as a separate method because we cannot call virtual
methods that are reimplemented in a language specific class during our
own construction (the own object is not finished being constructed and
therefore the C++ dispatch mechanism does not yet work as expected.)
CCBUG:126262


 M  +8 -3      codeclassfield.cpp  
 M  +11 -1     codeclassfield.h  
 M  +1 -0      codegenerators/codegenfactory.cpp  


--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeclassfield.cpp #646556:646557
@@ -37,7 +37,7 @@
 {
 
     setParentUMLObject(role);
-    initFields( );
+    initFields(true);
 
 }
 
@@ -46,7 +46,7 @@
 {
 
     setParentUMLObject(attrib);
-    initFields( );
+    initFields(true);
 
 }
 
@@ -591,7 +591,7 @@
     return false;
 }
 
-void CodeClassField::initFields ( ) {
+void CodeClassField::initFields(bool inConstructor) {
 
     m_writeOutMethods = false;
     m_listClassName = QString ("");
@@ -600,6 +600,11 @@
     m_methodVector.setAutoDelete(false);
     // m_methodMap = new QMap<CodeAccessorMethod::AccessorType, CodeAccessorMethod *>;
 
+    if (!inConstructor)
+        finishInitialization();
+}
+
+void CodeClassField::finishInitialization() {
     initAccessorMethods();
     updateContent();
 
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codeclassfield.h #646556:646557
@@ -53,6 +53,16 @@
     CodeClassField ( ClassifierCodeDocument * parentDoc , UMLAttribute * attrib );
     CodeClassField ( ClassifierCodeDocument * parentDoc , UMLRole * role);
 
+    /**
+     * Finish off initializations of the object.
+     * This is necessary as a separate method because we cannot call
+     * virtual methods that are reimplemented in a language specific class
+     * during our own construction (the own object is not finished being
+     * constructed and therefore the C++ dispatch mechanism does not yet
+     * work as expected.)
+     */
+    void finishInitialization();
+
     // CodeClassField ( ClassifierCodeDocument * doc , UMLRole role);
 
     /**
@@ -213,7 +223,7 @@
     virtual void setAttributesFromNode ( QDomElement & element);
 
     /** init class fields */
-    void initFields (  );
+    void initFields(bool inConstructor = false);
 
     // initialize the accessor methods for this field
     void initAccessorMethods();
--- branches/KDE/3.5/kdesdk/umbrello/umbrello/codegenerators/codegenfactory.cpp #646556:646557
@@ -242,6 +242,7 @@
         default:
             break;
     }
+    retval->finishInitialization();
     return retval;
 }
 




More information about the umbrello-devel mailing list