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

Andi Fischer andi.fischer at hispeed.ch
Sat Feb 4 17:21:49 UTC 2012


SVN commit 1278121 by fischer:

Unused methods and attributes removed.

 M  +11 -31    codegenerator.cpp  
 M  +2 -9      codegenerator.h  
 M  +7 -15     cpp/cppcodegenerator.cpp  
 M  +1 -3      cpp/cppcodegenerator.h  
 M  +4 -21     d/dcodegenerator.cpp  
 M  +1 -4      d/dcodegenerator.h  
 M  +11 -28    java/javacodegenerator.cpp  
 M  +2 -5      java/javacodegenerator.h  
 M  +6 -19     ruby/rubycodegenerator.cpp  
 M  +1 -3      ruby/rubycodegenerator.h  


--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codegenerator.cpp #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2003      Brian Thomas <thomas at mail630.gsfc.nasa.gov>   *
- *   copyright (C) 2004-2011                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -52,24 +52,18 @@
  * Constructor for a code generator.
  */
 CodeGenerator::CodeGenerator()
-  : QObject(UMLApp::app()->document())
+  : m_applyToAllRemaining(true),
+    m_document(UMLApp::app()->document()),
+    m_lastIDIndex(0)
 {
-    initFields();
+    // initial population of our project generator
+    // CANT Be done here because we would call pure virtual method
+    // of newClassifierDocument (bad!).
+    // We should only call from the child
+    // initFromParentDocument();
 }
 
 /**
- * Constructor for a code generator and then initialize it from an XMI element.
- * FIX: hmm. this should be pure virtual so that implemented in sub-class.
- * @param element   an element from an XMI document
- */
-CodeGenerator::CodeGenerator(QDomElement & element)
-  : QObject(UMLApp::app()->document())
-{
-    initFields();
-    loadFromXMI(element);  // hmm. cannot call this here.. it is 'pure' virtual
-}
-
-/**
  * Destructor.
  */
 CodeGenerator::~CodeGenerator()
@@ -101,11 +95,11 @@
     else {
         QString prefix = "doc";
         QString id = prefix + "_0";
-        int number = lastIDIndex;
+        int number = m_lastIDIndex;
         for ( ; findCodeDocumentByID(id); ++number) {
             id = prefix + '_' + QString::number(number);
         }
-        lastIDIndex = number;
+        m_lastIDIndex = number;
     }
 
     return id;
@@ -553,7 +547,6 @@
             return QString();
             break;
         }
-
         break;
     case CodeGenerationPolicy::Never: //generate similar name
         suffix = 1;
@@ -813,19 +806,6 @@
     return output;
 }
 
-void CodeGenerator::initFields()
-{
-    m_document = UMLApp::app()->document();
-    m_applyToAllRemaining = true;
-    lastIDIndex = 0;
-
-    // initial population of our project generator
-    // CANT Be done here because we would call pure virtual method
-    // of newClassifierDocument (bad!).
-    // We should only call from the child
-    // initFromParentDocument();
-}
-
 /**
  * Connect additional slots.
  * Only required for Advanced Code Generators.
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/codegenerator.h #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2003      Brian Thomas <thomas at mail630.gsfc.nasa.gov>   *
- *   copyright (C) 2004-2010                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -70,8 +70,6 @@
     Q_OBJECT
 public:
     CodeGenerator();
-    CodeGenerator(QDomElement & element);
-
     virtual ~CodeGenerator();
 
     bool addCodeDocument(CodeDocument * add_object);
@@ -176,8 +174,6 @@
 
     void writeListedCodeDocsToFile(CodeDocumentList * docs);
 
-    static const char * hierarchicalCodeBlockNodeName;
-
     // map of what code documents we currently have in this generator.
     QHash<QString, CodeDocument*> m_codeDocumentDictionary;
 
@@ -202,10 +198,8 @@
     // QMap<CodeDocument*,QString> *m_fileMap;
 
     CodeDocumentList m_codedocumentVector;
-    int lastIDIndex;
+    int m_lastIDIndex;
 
-    void initFields() ;
-
     void loadCodeForOperation(const QString& id, const QDomElement& codeDocElement);
 
 public slots:
@@ -222,4 +216,3 @@
 };
 
 #endif // CODEGENERATOR_H
-
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cpp/cppcodegenerator.cpp #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2003      Brian Thomas <thomas at mail630.gsfc.nasa.gov>   *
- *   copyright (C) 2004-2011                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -34,8 +34,13 @@
  * Basic Constructor.
  */
 CPPCodeGenerator::CPPCodeGenerator()
+  : CodeGenerator(),
+    m_createMakefile(false)
 {
-    initAttributes();
+    UMLApp::app()->setPolicyExt( new CPPCodeGenerationPolicy() );
+
+    // load Classifier documents from parent document
+    //initFromParentDocument();
 }
 
 /**
@@ -380,19 +385,6 @@
 }
 
 /**
- * Init all attributes.
- */
-void CPPCodeGenerator::initAttributes()
-{
-    m_createMakefile = false;
-
-    UMLApp::app()->setPolicyExt ( new CPPCodeGenerationPolicy() );
-
-    // load Classifier documents from parent document
-    //initFromParentDocument();
-}
-
-/**
  * Add C++ primitives as datatypes.
  * @return a string list of C++ datatypes
  */
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/cpp/cppcodegenerator.h #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2003      Brian Thomas <thomas at mail630.gsfc.nasa.gov>   *
- *   copyright (C) 2004-2011                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -73,8 +73,6 @@
     bool             m_createMakefile;
     CodeDocumentList m_headercodedocumentVector;  //< a separate list for recording the header documents
 
-    void initAttributes ( ) ;
-
 public slots:
 
     virtual void checkAddUMLObject (UMLObject * obj);
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/d/dcodegenerator.cpp #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2007 Jari-Matti Mäkelä <jmjm at iki.fi>                    *
- *   copyright (C) 2008-2011                                               *
+ *   copyright (C) 2008-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -26,20 +26,12 @@
 
 /**
  * Constructor.
- * @param elem   DOM element
  */
-DCodeGenerator::DCodeGenerator(QDomElement & elem)
-  : CodeGenerator(elem)
-{
-    init();
-}
-
-/**
- * Constructor.
- */
 DCodeGenerator::DCodeGenerator()
+  : CodeGenerator()
 {
-    init();
+    // load Classifier documents from parent document
+    //initFromParentDocument();
 }
 
 /**
@@ -147,15 +139,6 @@
 }
 
 /**
- * Initialization of class.
- */
-void DCodeGenerator::init()
-{
-    // load Classifier documents from parent document
-    //initFromParentDocument();
-}
-
-/**
  * Adds D's primitives as datatypes.
  * @return the list of primitive datatypes
  */
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/d/dcodegenerator.h #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2007 Jari-Matti Mäkelä <jmjm at iki.fi>                    *
- *   copyright (C) 2008-2011                                               *
+ *   copyright (C) 2008-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -29,8 +29,6 @@
 public:
 
     DCodeGenerator();
-    DCodeGenerator(QDomElement & element);
-
     virtual ~DCodeGenerator();
 
     bool getAutoGenerateAttribAccessors( );
@@ -65,7 +63,6 @@
 
 private:
 
-    void init();
 };
 
 #endif // DCODEGENERATOR_H
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/java/javacodegenerator.cpp #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2003      Brian Thomas <thomas at mail630.gsfc.nasa.gov>   *
- *   copyright (C) 2004-2011                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -186,20 +186,19 @@
 
 /**
  * Constructor.
- * @param elem   the element of the DOM tree
  */
-JavaCodeGenerator::JavaCodeGenerator(QDomElement & elem)
-  : CodeGenerator(elem)
-{
-    init();
-}
-
-/**
- * Constructor.
- */
 JavaCodeGenerator::JavaCodeGenerator()
+  : CodeGenerator()
 {
-    init();
+    // load Classifier documents from parent document
+    //initFromParentDocument();
+
+    // add in an ANT document
+    JavaANTCodeDocument * buildDoc = newANTCodeDocument( );
+    addCodeDocument(buildDoc);
+
+    // set our 'writeout' policy for that code document
+    setCreateANTBuildFile(UmbrelloSettings::buildANTDocumentJava());
 }
 
 /**
@@ -322,22 +321,6 @@
 }
 
 /**
- * Initialize class.
- */
-void JavaCodeGenerator::init()
-{
-    // load Classifier documents from parent document
-    //initFromParentDocument();
-
-    // add in an ANT document
-    JavaANTCodeDocument * buildDoc = newANTCodeDocument( );
-    addCodeDocument(buildDoc);
-
-    // set our 'writeout' policy for that code document
-    setCreateANTBuildFile(UmbrelloSettings::buildANTDocumentJava());
-}
-
-/**
  * Adds Java's primitives as datatypes.
  * @return a string list of Java primitives
  */
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/java/javacodegenerator.h #1278120:1278121
@@ -5,7 +5,7 @@
  *   (at your option) any later version.                                   *
  *                                                                         *
  *   copyright (C) 2003      Brian Thomas <thomas at mail630.gsfc.nasa.gov>   *
- *   copyright (C) 2004-2011                                               *
+ *   copyright (C) 2004-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -30,8 +30,6 @@
 public:
 
     JavaCodeGenerator();
-    JavaCodeGenerator(QDomElement & element);
-
     virtual ~JavaCodeGenerator();
 
     void setCreateANTBuildFile(bool buildIt);
@@ -70,9 +68,8 @@
 
 private:
 
-    void init();
-
     bool m_createANTBuildFile;
+
 };
 
 #endif // JAVACODEGENERATOR_H
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/ruby/rubycodegenerator.cpp #1278120:1278121
@@ -6,7 +6,7 @@
  *                                                                         *
  *   copyright (C) 2005                                                    *
  *   Richard Dale  <Richard_Dale at tipitina.demon.co.uk>                     *
- *   copyright (C) 2006-2011                                               *
+ *   copyright (C) 2006-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -28,18 +28,14 @@
 
 /**
  * Constructor.
- * @param elem DOM element
  */
-RubyCodeGenerator::RubyCodeGenerator(QDomElement & elem)
-  : CodeGenerator(elem)
-{
-}
-
-/**
- * Constructor.
- */
 RubyCodeGenerator::RubyCodeGenerator()
+   : CodeGenerator()
 {
+    // These initializations are done in CodeGenFactory::createObject()
+        //UMLApp::app()->setPolicyExt ( new RubyCodeGenerationPolicy(UMLApp::app()->getConfig()) );
+        // load Classifier documents from parent document
+        //initFromParentDocument();
 }
 
 /**
@@ -156,15 +152,6 @@
     return doc;
 }
 
-/* These initializations are done in CodeGenFactory::createObject()
-void RubyCodeGenerator::initFields()
-{
-    UMLApp::app()->setPolicyExt ( new RubyCodeGenerationPolicy(UMLApp::app()->getConfig()) );
-    // load Classifier documents from parent document
-    initFromParentDocument();
-}
-*/
-
 /**
  * Get list of reserved keywords.
  * @return the list of reserved keywords
--- trunk/KDE/kdesdk/umbrello/umbrello/codegenerators/ruby/rubycodegenerator.h #1278120:1278121
@@ -6,7 +6,7 @@
  *                                                                         *
  *   copyright (C) 2005                                                    *
  *   Richard Dale  <Richard_Dale at tipitina.demon.co.uk>                     *
- *   copyright (C) 2006-2011                                               *
+ *   copyright (C) 2006-2012                                               *
  *   Umbrello UML Modeller Authors <uml-devel at uml.sf.net>                  *
  ***************************************************************************/
 
@@ -30,8 +30,6 @@
 public:
 
     RubyCodeGenerator();
-    RubyCodeGenerator(QDomElement & element);
-
     virtual ~RubyCodeGenerator();
 
     bool getAutoGenerateAttribAccessors();




More information about the umbrello-devel mailing list