codedocument.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef CODEDOCUMENT_H
00018 #define CODEDOCUMENT_H
00019
00020 #include <qobject.h>
00021 #include <qmap.h>
00022 #include <qstring.h>
00023
00024 #include "codegenerationpolicy.h"
00025 #include "codegenobjectwithtextblocks.h"
00026 #include "hierarchicalcodeblock.h"
00027
00028 class QWidget;
00029 class CodeAccessorMethod;
00030 class CodeBlockWithComments;
00031 class CodeComment;
00032 class CodeOperation;
00033 class TextBlock;
00034 class UMLPackage;
00035
00036
00037
00043
00044
00045 class CodeDocument : public QObject, public CodeGenObjectWithTextBlocks
00046 {
00047 friend class HierarchicalCodeBlock;
00048 Q_OBJECT
00049 public:
00050
00051
00052
00053
00054
00061 CodeDocument ( );
00062
00066 virtual ~CodeDocument ( );
00067
00068
00069
00070
00071
00072
00073
00078 void setFileExtension ( const QString &new_var );
00079
00084 QString getFileExtension ( ) const;
00085
00090 void setFileName ( const QString &new_var );
00091
00097 QString getFileName ( ) const;
00098
00103 void setPackage ( UMLPackage *new_var );
00104
00109 QString getPackage ( ) const;
00110
00115 virtual QString getPath ( );
00116
00121 void setID ( const QString &new_id);
00122
00127 QString getID ( ) const;
00128
00135 void setWriteOutCode ( bool new_var );
00136
00143 bool getWriteOutCode ( );
00144
00148 void setHeader ( CodeComment * comment );
00149
00153 CodeComment * getHeader ( );
00154
00159 bool insertTextBlock (TextBlock * newBlock, TextBlock * existingBlock, bool after = true);
00160
00166 TextBlock * findTextBlockByTag( const QString &tag , bool descendIntoChildren = false);
00167
00172 virtual QString toString ( );
00173
00177 virtual void saveToXMI ( QDomDocument & doc, QDomElement & root );
00178
00182 virtual void loadFromXMI ( QDomElement & root );
00183
00188 virtual CodeBlock * newCodeBlock ( );
00189
00194 virtual HierarchicalCodeBlock * newHierarchicalCodeBlock ( );
00195
00200 virtual CodeBlockWithComments * newCodeBlockWithComments ( );
00201
00202
00203 virtual QString getUniqueTag( QString prefix = QString("") );
00204
00207 QString cleanName ( const QString &name );
00208
00209
00210 virtual void synchronize();
00211
00212
00213 protected:
00214
00218 virtual void setAttributesOnNode ( QDomDocument & doc, QDomElement & blockElement);
00219
00223 virtual void setAttributesFromNode ( QDomElement & element);
00224
00225
00226
00227
00228
00229
00230 void addChildTagToMap ( const QString &tag, TextBlock * tb);
00231 void removeChildTagFromMap ( const QString &tag );
00232
00233
00234 void updateHeader ();
00235
00236
00237 void resetTextBlocks();
00238
00239
00240
00241
00242 virtual void updateContent();
00243
00244
00245
00246 virtual TextBlock * findCodeClassFieldTextBlockByTag( const QString &tag );
00247
00248 private:
00249
00250 int lastTagIndex;
00251 QString m_filename;
00252 QString m_fileExtension;
00253 QString m_ID;
00254 QString m_pathName;
00255 UMLPackage *m_package;
00256
00257 bool m_writeOutCode;
00258
00259
00260 CodeComment * m_header;
00261
00262
00263 void initDoc ( ) ;
00264
00265
00266
00267
00268
00269 QMap<QString, TextBlock *> m_childTextBlockTagMap;
00270
00271 };
00272
00273 #endif // CODEDOCUMENT_H
This file is part of the documentation for umbrello Version 3.1.0.