blob: 301dc780535d3d05c12186448ce5501ed7432821 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* This code generated by:
* Author : thomas
* Date : Sep Mon 1 2003
*
* copyright (C) 2004
* Umbrello UML Modeller Authors <uml-devel@uml.sf.net>
*/
#ifndef SIMPLECODEGENERATOR_H
#define SIMPLECODEGENERATOR_H
#include <tqstringlist.h>
#include <tqstring.h>
#include <tqmap.h>
#include "../codegenerator.h"
#include "../umlnamespace.h"
class UMLDoc;
/**
* A simple code generator interface designed to work with
* the existing codewriters.
*/
class SimpleCodeGenerator : public CodeGenerator
{
Q_OBJECT
TQ_OBJECT
public:
// Constructors/Destructors
//
/**
* Empty Constructor
*/
SimpleCodeGenerator (bool createDirHierarchyForPackages = true);
/**
* Empty Destructor
*/
virtual ~SimpleCodeGenerator ( );
// Public attribute accessor methods
//
void writeCodeToFile ( UMLClassifierList & concepts);
void writeCodeToFile ( );
/**
* call this method to generate code for a UMLClassifier
* @param c the class you want to generate code for.
*/
virtual void writeClass(UMLClassifier *c) = 0;
/**
* This is implemented only because we HAVE to.
* @return ClassifierCodeDocument
* @param classifier
*/
CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier);
protected:
// compatability methods..
TQString findFileName(UMLPackage* concept, const TQString &ext);
TQString overwritableName(UMLPackage* concept, const TQString &name, const TQString &ext);
bool hasDefaultValueAttr(UMLClassifier *c);
bool hasAbstractOps(UMLClassifier *c);
/**
* Returns the current indent string based on m_indentLevel and m_indentation.
*/
TQString getIndent ();
/**
* Maps UMLObjects to filenames. Used for finding out which file
* each class was written to.
*/
TQMap<UMLPackage*,TQString> m_fileMap;
// the tqparent document
UMLDoc *m_doc;
/**
* For some code generators, it does not make much sense to create a
* directory for each package because that would lead to a rather
* sparsely populated directory tree (maximum of just one source file
* per directory.)
*/
bool m_createDirHierarchyForPackages;
/* Old Attributes writers will look for */
TQString m_indentation;
int m_indentLevel;
TQString m_endl;
// override tqparent method..we need special handling
void initFromParentDocument( );
private:
void initFields ( UMLDoc * doc) ;
public slots:
void syncCodeToDocument ( );
};
#endif // SIMPLECODEGENERATOR_H
|