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
|
#ifndef _UMLBASEATTRIBUTE_H
#define _UMLBASEATTRIBUTE_H
#include "UmlClassMember.h"
#include "anItemKind.h"
#include <qcstring.h>
#include "UmlTypeSpec.h"
class UmlAttribute;
class UmlClass;
class UmlOperation;
// Manage the class's attributs
class UmlBaseAttribute : public UmlClassMember {
public:
// returns a new attribute 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 UmlAttribute * create(UmlClass * parent, const char * s);
// returns the kind of the item
virtual anItemKind kind();
// indicates if the attribute is read only, returns TRUE if yes
bool isReadOnly();
// to set the 'read only' state of the attribute
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isReadOnly(bool y);
// returns the default attribute value, may be an empty string
const QCString & defaultValue();
// to set the default attribute value ("" allowed)
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_DefaultValue(const char * s);
// returns the attribute UML type
const UmlTypeSpec & type();
// to set the attribute UML type
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_Type(const UmlTypeSpec & t);
// returns the 'get' operation of the attribute, or 0 if it does not exist
UmlOperation * getOperation();
// to generate an associated 'get' operation
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool addGetOperation();
// returns the 'set' operation of the attribute, or 0 if it does not exist
UmlOperation * setOperation();
// to generate an associated 'set' operation
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool addSetOperation();
#ifdef WITHCPP
// Indicate if the attribute is 'mutable'
bool isCppMutable();
// Set if the attribute is 'mutable'
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isCppMutable(bool y);
#endif
#ifdef WITHJAVA
// indicates if the attribute is 'transient', returns TRUE if yes
bool isJavaTransient();
// to set the 'transient' state of the attribute
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_isJavaTransient(bool y);
#endif
#ifdef WITHIDL
// in case the attribute is an IDL union's member returns the
// corresponding 'case', an empty string in case it is not specified
QCString idlCase();
// to set the 'case' even the attribute is not (already) known as
// an IDL union's member
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_IdlCase(UmlAttribute * a);
// to set the 'case' even the attribute is not (already) known as
// an IDL union's member
//
// On error return FALSE in C++, produce a RuntimeException in Java
bool set_IdlCase(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 _read_only;
#ifdef WITHCPP
bool _cpp_mutable;
#endif
#ifdef WITHJAVA
bool _java_transient;
#endif
QCString _default_value;
UmlTypeSpec _type;
UmlOperation * _get_oper;
UmlOperation * _set_oper;
#ifdef WITHIDL
// exclusive with idl_explicit_case
UmlAttribute * _idl_case;
QCString _idl_explicit_case;
#endif
public:
// the constructor, do not call it yourself !!!!!!!!!!
UmlBaseAttribute(void * id, const QCString & n);
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
};
inline UmlBaseAttribute::UmlBaseAttribute(void * id, const QCString & n) : UmlClassMember(id, n) {
_get_oper = 0;
_set_oper = 0;
#ifdef WITHIDL
_idl_case = 0;
#endif
}
#endif
|