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 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
|
#ifndef _UMLBASEOPERATION_H
#define _UMLBASEOPERATION_H
#include "UmlClassMember.h"
#include "anItemKind.h"
#include "UmlTypeSpec.h"
#include <qvaluelist.h>
#include <qcstring.h>
#include "UmlParameter.h"
class UmlOperation;
class UmlClass;
struct UmlParameter;
// Manage the class's operations
class UmlBaseOperation : public UmlClassMember {
public:
// returns a new operation named 's' 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 UmlOperation * create(UmlClass * parent, const char * s);
// returns the kind of the item
virtual anItemKind kind();
// indicates if the operation is abstract, returns TRUE if yes
bool isAbstract();
// to set the 'abstract' flag
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isAbstract(bool y);
// returns the operation value type
const UmlTypeSpec & returnType();
// to set the operation value type
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_ReturnType(const UmlTypeSpec & t);
// returns (in java a copy of) the parameters list
const QValueList<UmlParameter> params();
// adds a parameter at the given rank (0...)
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool addParameter(unsigned rank, const UmlParameter & p);
// remove the parameter of the given rank (0...)
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool removeParameter(unsigned rank);
// replace the parameter at the given rank (0...)
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool replaceParameter(unsigned rank, const UmlParameter & p);
// returns the exceptions
const QValueList<UmlTypeSpec> exceptions();
// adds the exception at the given rank (0...)
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool addException(unsigned rank, const UmlTypeSpec & t);
// remove the exception of the given rank (0...)
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool removeException(unsigned rank);
// replaces the exception at the given rank (0...)
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool replaceException(unsigned rank, const UmlTypeSpec & t);
// in case the operation is a 'get' operation, returns the associated
// attribute or relation
UmlClassMember * getOf();
// in case the operation is a 'set' operation, returns the associated
// attribute or relation
UmlClassMember * setOf();
#ifdef WITHCPP
// returns TRUE if the operation is declared const in C++
bool isCppConst();
// to set if the operation is declared const in C++
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isCppConst(bool y);
// returns TRUE if the operation is a friend in C++
bool isCppFriend();
// to set if the operation is a friend in C++
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isCppFriend(bool y);
// returns TRUE if the operation is declared virtual in C++
bool isCppVirtual();
// to set if the operation is declared virtual in C++
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isCppVirtual(bool y);
// returns TRUE if the operation is declared inline in C++
bool isCppInline();
// to set if the operation is declared inline in C++
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isCppInline(bool y);
// returns the operation's definition in C++, notes that the declaration
// is returned by the inherited ClassItemBase::CppDecl() operation
const QCString & cppDef();
// sets the operation's definition in C++, notes that the declaration
// is set through the inherited ClassItemBase::set_CppDecl() operation
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_CppDef(const char * s);
// returns the operation's body in C++, useless if the def does not
// contains ${body}. Note that the body is get each time from BOUML
// for memory size reason
QCString cppBody();
// sets the operation's body in C++, useless if the def does not
// contains ${body}
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_CppBody(const char * s);
// in case the operation is a 'get' or 'set' operation, returns how
// the operation's C++ name must be generated
const QCString & cppNameSpec();
// in case the operation is a 'get' or 'set' operation, returns how
// the operation's C++ name must be generated
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_CppNameSpec(const char * s);
#endif
#ifdef WITHJAVA
// returns TRUE if the operation is declared final in JAVA
bool isJavaFinal();
// to set if the operation is declared final in JAVA
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isJavaFinal(bool y);
// returns TRUE if the operation is declared synchronized in JAVA
bool isJavaSynchronized();
// to set if the operation is declared synchronized in JAVA
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isJavaSynchronized(bool y);
// returns the operation's definition in Java, notes that it is
// already made by the inherited JavaDecl operation
const QCString & javaDef();
// sets the operation's definition in Java, notes that it is
// already made by the inherited set_JavaDecl operation
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_JavaDef(const char * s);
// returns the operation's body in Java++, useless if the def does
// not contains ${body} Note that the body is get each time from BOUML
// for memory size reason
QCString javaBody();
// sets the operation's body in Java, useless if the def does not
// contains ${body}
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_JavaBody(const char * s);
// in case the operation is a 'get' or 'set' operation, returns how
// the operation's JAVA name must be generated
const QCString & javaNameSpec();
// in case the operation is a 'get' or 'set' operation, returns how
// the operation's JAVA name must be generated
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_JavaNameSpec(const char * s);
#endif
#ifdef WITHIDL
// returns TRUE if the operation is declared oneway in IDL
bool isIdlOneway();
// to set if the operation is declared oneway in IDL
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isIdlOneway(bool y);
// in case the operation is a 'get' or 'set' operation, returns how
// the operation's IDL name must be generated
const QCString & idlNameSpec();
// in case the operation is a 'get' or 'set' operation, returns how
// the operation's IDL name must be generated
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_IdlNameSpec(const char * s);
#endif
// to unload the object to free memory, it will be reloaded
// automatically if needed. args unused
virtual void unload(bool = FALSE, bool = FALSE);
private:
bool _abstract : 1;
#ifdef WITHCPP
bool _cpp_const : 1;
bool _cpp_friend : 1;
bool _cpp_virtual : 1;
bool _cpp_inline : 1;
#endif
#ifdef WITHJAVA
bool _java_final : 1;
bool _java_synchronized : 1;
#endif
#ifdef WITHIDL
bool _idl_oneway : 1;
#endif
UmlTypeSpec _return_type;
QValueList<UmlParameter> _params;
QValueList<UmlTypeSpec> _exceptions;
#ifdef WITHCPP
QCString _cpp_def;
QCString _cpp_name_spec;
#endif
#ifdef WITHJAVA
QCString _java_name_spec;
#endif
#ifdef WITHIDL
QCString _idl_name_spec;
#endif
// exclusive with set_of
UmlClassMember * _get_of;
// exclusive with get_of
UmlClassMember * _set_of;
protected:
// the constructor, do not call it yourself !!!!!!!!!!
UmlBaseOperation(void * id, const QCString & n);
//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
};
inline UmlBaseOperation::UmlBaseOperation(void * id, const QCString & n) : UmlClassMember(id, n) {
_get_of = 0;
_set_of = 0;
}
#endif
|