• Skip to content
  • Skip to link menu
KDE 4.0 API Reference
  • KDE API Reference
  • kdesdk
  • Sitemap
  • Contact Us
 

umbrello/umbrello

codegenerator.h

Go to the documentation of this file.
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-2007                                               *
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  *  Bugs and comments to uml-devel@lists.sf.net or http://bugs.kde.org
00016  */
00017 
00018 #ifndef CODEGENERATOR_H
00019 #define CODEGENERATOR_H
00020 
00021 #include <QtCore/QHash>
00022 #include <QtCore/QList>
00023 #include <QtCore/QDir>
00024 
00025 #include "codegenerators/codegenpolicyext.h"
00026 #include "codegenerationpolicy.h"
00027 #include "umlpackagelist.h"
00028 #include "umlclassifierlist.h"
00029 #include "codedocumentlist.h"
00030 #include "codeviewerstate.h"
00031 #include "umlnamespace.h"
00032 
00033 class UMLDoc;
00034 class UMLObject;
00035 
00036 class ClassifierCodeDocument;
00037 class CodeBlock;
00038 class CodeDocument;
00039 class CodeViewerDialog;
00040 
00041 
00075 class CodeGenerator : public QObject
00076 {
00077     Q_OBJECT
00078 
00079 public:
00080 
00085     CodeGenerator ();
00086 
00092     CodeGenerator (QDomElement & element );
00093 
00097     virtual ~CodeGenerator ( );
00098 
00103     bool addCodeDocument ( CodeDocument * add_object );
00104 
00112     // bool replaceCodeDocument (  CodeDocument * replace_doc=0, bool addIfPriorDocumentNotPresent=true,
00113     //                                bool deleteReplacedDocument=true );
00114 
00119     bool removeCodeDocument ( CodeDocument * remove_object );
00120 
00126     CodeDocumentList * getCodeDocumentList ( );
00127 
00132     QString getUniqueID ( CodeDocument * codeDoc );
00133 
00137     virtual void saveToXMI ( QDomDocument & doc, QDomElement & root );
00138 
00143     CodeDocument * findCodeDocumentByID (const QString &id );
00144 
00148     virtual void writeCodeToFile ( );
00149 
00155     virtual void writeCodeToFile(UMLClassifierList &list);
00156 
00157     // these are utility methods for accessing the default
00158     // code gen policy object and *perhaps* should go away when we
00159     // finally implement the CodeGenDialog class -b.t.
00160 
00161     void setModifyNamePolicy(CodeGenerationPolicy::ModifyNamePolicy p);
00162     CodeGenerationPolicy::ModifyNamePolicy modifyNamePolicy()const;
00163 
00164     void setIncludeHeadings(bool i);
00165     bool includeHeadings() const;
00166 
00167     void setHeadingFileDir(const QString &);
00168     QString headingFileDir() const;
00169 
00170     void setForceDoc(bool f);
00171     bool forceDoc() const;
00172 
00173     void setForceSections(bool f);
00174     bool forceSections() const;
00175 
00176 
00195     virtual QString getHeadingFile (const QString &file );
00196 
00206     virtual QString findFileName(CodeDocument * doc);
00207 
00213     static QString cleanName ( const QString &name );
00214 
00224     static QString formatDoc (const QString & text, const QString & linePrefix = " *", int lineWidth = 80 );
00225 
00233     static QString formatSourceCode(const QString& code, const QString& indentation);
00234 
00243     static void findObjectsRelated(UMLClassifier *c, UMLPackageList &cList);
00244 
00249     virtual CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier ) = 0;
00250 
00254     virtual void loadFromXMI (QDomElement & element );
00255 
00260     virtual CodeDocument * newCodeDocument ( );
00261 
00265     virtual Uml::Programming_Language getLanguage() = 0;
00266 
00272     //FIX
00273     // NOTE: this should be 'protected' or we could have problems with CPP code generator
00274     CodeDocument * findCodeDocumentByClassifier (UMLClassifier * classifier );
00275 
00280     virtual QStringList defaultDatatypes();
00281 
00285     virtual CodeViewerDialog * getCodeViewerDialog( QWidget* parent, CodeDocument * doc,
00286             Settings::CodeViewerState state);
00287 
00295     virtual bool isReservedKeyword(const QString & rPossiblyReservedKeyword);
00296 
00300     virtual const QStringList reservedKeywords() const;
00301 
00305     virtual void createDefaultStereotypes ();
00306 
00323     virtual void initFromParentDocument( );
00324 
00330     void connect_newcodegen_slots();
00331 
00332 protected:
00333 
00338     // void removeAndDeleteAllAutoGeneratedCodeDocuments ( bool deleteRemovedDocs=true );
00339 
00355     QString overwritableName (const QString& name, const QString &extension );
00356 
00365     bool openFile (QFile& file, const QString &name);
00366 
00370     void writeListedCodeDocsToFile(CodeDocumentList * docs);
00371 
00372     static const char * hierarchicalCodeBlockNodeName;
00373 
00374     // map of what code documents we currently have in this generator.
00375     QHash<QString, CodeDocument*> m_codeDocumentDictionary;
00376 
00381     bool m_applyToAllRemaining;
00382 
00386     UMLDoc* m_document;
00387 
00388 private:
00389 
00394     // this seems silly and overkill now. -b.t.
00395     // QMap<CodeDocument*,QString> *m_fileMap;
00396 
00397     CodeDocumentList m_codedocumentVector;
00398     int lastIDIndex;
00399 
00400     void initFields() ;
00401 
00405     void loadCodeForOperation(const QString& id, QDomElement codeDocElement);
00406 
00407 public slots:
00408 
00410     virtual void checkAddUMLObject (UMLObject * obj);
00411     virtual void checkRemoveUMLObject (UMLObject * obj);
00412 
00418     virtual void syncCodeToDocument ( );
00419 
00420 signals:
00421 
00429     void codeGenerated(UMLClassifier* concept, bool generated);
00430 
00431 };
00432 
00433 #endif // CODEGENERATOR_H
00434 

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdesdk

Skip menu "kdesdk"
  • kate
  •     kate
  • umbrello
  •   umbrello
Generated for kdesdk by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal