simplecodegenerator.h
00001 /*************************************************************************** 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * (at your option) any later version. * 00007 * * 00008 ***************************************************************************/ 00009 00010 /* This code generated by: 00011 * Author : thomas 00012 * Date : Sep Mon 1 2003 00013 * 00014 * copyright (C) 2004 00015 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> 00016 */ 00017 00018 00019 #ifndef SIMPLECODEGENERATOR_H 00020 #define SIMPLECODEGENERATOR_H 00021 00022 #include <qstringlist.h> 00023 #include <qstring.h> 00024 #include <qmap.h> 00025 00026 #include "../codegenerator.h" 00027 #include "../umlnamespace.h" 00028 00029 class QTextStream; 00030 class UMLDoc; 00031 class UMLAttribute; 00032 class CodeBlockWithComments; 00033 00038 class SimpleCodeGenerator : public CodeGenerator 00039 { 00040 Q_OBJECT 00041 public: 00042 00043 // Constructors/Destructors 00044 // 00045 00049 SimpleCodeGenerator (bool createDirHierarchyForPackages = true); 00050 00054 virtual ~SimpleCodeGenerator ( ); 00055 00056 // Public attribute accessor methods 00057 // 00058 00059 void writeCodeToFile ( UMLClassifierList & concepts); 00060 void writeCodeToFile ( ); 00061 00066 virtual void writeClass(UMLClassifier *c) = 0; 00067 00073 CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier); 00074 00075 protected: 00076 00077 // compatability methods.. 00078 QString findFileName(UMLPackage* concept, const QString &ext); 00079 QString overwritableName(UMLPackage* concept, const QString &name, const QString &ext); 00080 bool hasDefaultValueAttr(UMLClassifier *c); 00081 bool hasAbstractOps(UMLClassifier *c); 00082 00086 QString getIndent (); 00087 00092 QMap<UMLPackage*,QString> m_fileMap; 00093 00094 // the parent document 00095 UMLDoc *m_doc; 00096 00103 bool m_createDirHierarchyForPackages; 00104 00105 /* Old Attributes writers will look for */ 00106 QString m_indentation; 00107 int m_indentLevel; 00108 QString m_endl; 00109 00110 // override parent method..we need special handling 00111 void initFromParentDocument( ); 00112 00113 private: 00114 00115 void initFields ( UMLDoc * doc) ; 00116 00117 public slots: 00118 00119 void syncCodeToDocument ( ); 00120 00121 }; 00122 00123 #endif // SIMPLECODEGENERATOR_H
