cppcodegenerator.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 * copyright (C) 2004-2006 * 00009 * Umbrello UML Modeller Authors <uml-devel@uml.sf.net> * 00010 ***************************************************************************/ 00011 00012 /* This code generated by: 00013 * Author : thomas 00014 * Date : Thu Jun 19 2003 00015 */ 00016 00017 00018 #ifndef CPPCODEGENERATOR_H 00019 #define CPPCODEGENERATOR_H 00020 00021 #include <qstring.h> 00022 #include "../codedocumentlist.h" 00023 #include "../codeviewerstate.h" 00024 #include "../codegenerator.h" 00025 #include "../umldoc.h" 00026 #include "cppmakecodedocument.h" 00027 00028 class CodeViewerDialog; 00029 class CPPHeaderCodeDocument; 00030 class CodeBlockWithComments; 00031 class KConfig; 00032 00033 class CPPCodeGenerator : public CodeGenerator 00034 { 00035 Q_OBJECT 00036 public: 00037 00038 static const bool DEFAULT_BUILD_MAKEFILE; 00039 00040 // Constructors/Destructors 00041 // 00042 00046 CPPCodeGenerator (); 00047 00051 virtual ~CPPCodeGenerator ( ); 00052 00057 void setCreateProjectMakefile ( bool new_var ); 00058 00063 bool getCreateProjectMakefile ( ); 00064 00065 // Public attribute accessor methods 00066 // 00067 00068 QString fixTypeName(const QString &string); 00069 00073 bool addHeaderCodeDocument ( CPPHeaderCodeDocument * doc ); 00074 00078 bool removeHeaderCodeDocument ( CPPHeaderCodeDocument * remove_object ); 00079 00083 Uml::Programming_Language getLanguage(); 00084 00085 // generate 2 different types of classifier code documents. 00086 CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier); 00087 CPPHeaderCodeDocument * newHeaderClassifierCodeDocument (UMLClassifier * classifier); 00088 00091 virtual CodeViewerDialog * getCodeViewerDialog( QWidget* parent, CodeDocument * doc, 00092 Settings::CodeViewerState state); 00093 00097 virtual void writeCodeToFile ( ); 00098 00099 // this method is here to provide class wizard the 00100 // ability to write out only those classes which 00101 // are selected by the user. 00102 virtual void writeCodeToFile(UMLClassifierList &list); 00103 00107 QStringList defaultDatatypes(); 00108 00112 virtual void saveToXMI ( QDomDocument & doc, QDomElement & root ); 00113 00117 virtual const QStringList reservedKeywords() const; 00118 00122 virtual void createDefaultStereotypes (); 00123 00124 void initFromParentDocument( ); 00125 00126 protected: 00127 00131 CPPMakefileCodeDocument * newMakefileCodeDocument ( ); 00132 00138 CPPHeaderCodeDocument * findHeaderCodeDocumentByClassifier (UMLClassifier * classifier ); 00139 00140 private: 00141 00142 bool m_createMakefile; 00143 00144 // a separate list for recording the header documents 00145 CodeDocumentList m_headercodedocumentVector; 00146 00147 void initAttributes ( ) ; 00148 00149 public slots: 00150 00156 virtual void checkAddUMLObject (UMLObject * obj); 00157 virtual void checkRemoveUMLObject (UMLObject * obj); 00158 00164 virtual void syncCodeToDocument ( ); 00165 }; 00166 00167 #endif // CPPCODEGENERATOR_H
