File: UmlBasePackage.h

package info (click to toggle)
bouml 4.21-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 73,336 kB
  • ctags: 55,459
  • sloc: cpp: 290,644; makefile: 228; sh: 13
file content (204 lines) | stat: -rw-r--r-- 5,904 bytes parent folder | download | duplicates (6)
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#ifndef _UMLBASEPACKAGE_H
#define _UMLBASEPACKAGE_H


#include "UmlItem.h"
#include "anItemKind.h"
#include <qcstring.h>

class UmlPackage;
class UmlDiagram;

//  Manage the packages
class UmlBasePackage : public UmlItem {
  public:
    // returns a new package named 'name' created under 'parent'
    //
    // In case it cannot be created (the name is already used or
    // invalid, 'parent' cannot contain it etc ...) return 0 in C++
    // and produce a RuntimeException in Java
    static UmlPackage * create(UmlPackage * parent, const char * name);

    // returns the kind of the item
    virtual anItemKind kind();

    // returns the optional associated diagram
    UmlDiagram * associatedDiagram();

    // sets the associated diagram, arg may be null to unset it
    //
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_AssociatedDiagram(UmlDiagram * d);

#ifdef WITHCPP
    // returns the path where the C++ source files are generated by the
    // c++ generator.
    const QCString & cppSrcDir();

    // to set the path where the C++ source files are generated by the
    // C++ generator, may be relative even the 'root' path is not
    // (already) an absolute path
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppSrcDir(const QCString & s);

    // returns the path where the C++ header files are generated by the
    // C++ generator.
    const QCString & cppHDir();

    // to set the path where the C++ header files are generated by the
    // C++ generator, may be relative even the 'root' path is not
    // (already) an absolute path
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppHDir(const QCString & s);

    //returns the namespace name associed to the package
    QCString cppNamespace();

    //to set the namespace name associed to the package.
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_CppNamespace(const QCString & s);

    // returns a sub package of the current one having the c++ namespace 'n'
    // (including the current one), else 0/null
    UmlPackage * findNamespace(const QCString & n) const;
#endif

#ifdef WITHJAVA
    // returns the path where the JAVA files are generated by the
    // JAVA generator.
    const QCString & javaDir();

    // to set the path where the JAVA files are generated by the
    // JAVA generator, may be relative even the 'root' path is not
    // (already) an absolute path
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_JavaDir(const QCString & s);

    //returns the java package name associed to the package
    QCString javaPackage();

    // to set the java package name associed to the package.
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_JavaPackage(const QCString & s);

    // returns a sub package of the current one having the Java package 'n'
    // (including the current one), else 0/null
    UmlPackage * findPackage(const QCString & n) const;
#endif

#ifdef WITHIDL
    // returns the path where the IDL files are generated by the
    // IDL generator.
    const QCString & idlDir();

    // to set the path where the IDL files are generated by the
    // IDL generator, may be relative even the 'root' path is not
    // (already) an absolute path
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_IdlDir(const QCString & s);

    //returns the module name associed to the package
    QCString idlModule();

    // to set the module name associed to the package.
    // 
    // On error return FALSE in C++, produce a RuntimeException in Java
    bool set_IdlModule(const QCString & s);

    // returns a sub package of the current one having the IDL module 'n'
    // (including the current one), else 0/null
    UmlPackage * findModule(const QCString & n) const;
#endif

    //  Returns the project
    static UmlBasePackage * getProject();

    //return TRUE in case something is modified (i.e. the project must be saved)
    
    static bool isProjectModified();

    //save the project if needed
    static void saveProject();

    //Does nothing in case an edition is on going under BOUML. Else :
    //close the current project (in case it is not saved the last modifications are lost),
    //load the specified one, and all the communications with the plug-outs including the
    //current one are closed.
    
    static void loadProject(QCString p);

    // to unload the object to free memory, it will be reloaded automatically
    // if needed. Recursively done for the sub items if 'rec' is TRUE. 
    //
    // if 'del' is true the sub items are deleted in C++, and removed from the
    // internal dictionnary in C++ and Java (to allow it to be garbaged),
    // you will have to call Children() to re-access to them
    virtual void unload(bool rec = FALSE, bool del = FALSE);


  private:
    UmlDiagram * _assoc_diagram;

#ifdef WITHCPP
    QCString _cpp_src_dir;

    QCString _cpp_h_dir;

    QCString _cpp_namespace;
#endif
    

#ifdef WITHJAVA
    QCString _java_dir;

    QCString _java_package;
#endif
    

#ifdef WITHIDL
    QCString _idl_dir;

    QCString _idl_module;
#endif
    


  protected:
    //internal, do NOT use it
    
    virtual void read_uml_();

#ifdef WITHCPP
    //internal, do NOT use it
    
    virtual void read_cpp_();
#endif

#ifdef WITHJAVA
    //internal, do NOT use it
    
    virtual void read_java_();
#endif

#ifdef WITHIDL
    //internal, do NOT use it
    
    virtual void read_idl_();
#endif

    // the constructor, do not call it yourself !!!!!!!!!!
    UmlBasePackage(void * id, const QCString & n);

};

inline UmlBasePackage::UmlBasePackage(void * id, const QCString & n) : UmlItem(id, n) {
  _assoc_diagram = 0;
}

#endif