umbrello/umbrello
simplecodegenerator.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * This program is free software; you can redistribute it and/or modify * 00003 * it under the terms of the GNU General Public License as published by * 00004 * the Free Software Foundation; either version 2 of the License, or * 00005 * (at your option) any later version. * 00006 * * 00007 * copyright (C) 2003 Brian Thomas <thomas@mail630.gsfc.nasa.gov> * 00008 * copyright (C) 2004-2009 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 #ifndef SIMPLECODEGENERATOR_H 00013 #define SIMPLECODEGENERATOR_H 00014 00015 #include <QtCore/QStringList> 00016 #include <QtCore/QString> 00017 #include <QtCore/QMap> 00018 00019 #include "codegenerator.h" 00020 #include "umlnamespace.h" 00021 00022 class UMLDoc; 00023 00028 class SimpleCodeGenerator : public CodeGenerator 00029 { 00030 Q_OBJECT 00031 public: 00032 00033 SimpleCodeGenerator (bool createDirHierarchyForPackages = true); 00034 virtual ~SimpleCodeGenerator ( ); 00035 00036 void writeCodeToFile ( UMLClassifierList & concepts); 00037 void writeCodeToFile ( ); 00038 00043 virtual void writeClass(UMLClassifier *c) = 0; 00044 00045 CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier); 00046 00047 protected: 00048 00049 QString className_; 00050 QString fileName_; 00051 00052 QString findFileName(UMLPackage* concept, const QString &ext); 00053 QString overwritableName(UMLPackage* concept, const QString &name, const QString &ext); 00054 bool hasDefaultValueAttr(UMLClassifier *c); 00055 bool hasAbstractOps(UMLClassifier *c); 00056 00057 QString getIndent (); 00058 00063 QMap<UMLPackage*,QString> m_fileMap; 00064 00065 // the parent document 00066 UMLDoc *m_doc; 00067 00074 bool m_createDirHierarchyForPackages; 00075 00076 /* Old Attributes writers will look for */ 00077 QString m_indentation; 00078 int m_indentLevel; 00079 QString m_endl; 00080 00081 // override parent method..we need special handling 00082 void initFromParentDocument( ); 00083 00084 private: 00085 00086 void initFields ( UMLDoc * doc) ; 00087 00088 public slots: 00089 00090 void syncCodeToDocument ( ); 00091 00092 }; 00093 00094 #endif // SIMPLECODEGENERATOR_H
KDE 4.4 API Reference