summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/entityattribute.h
blob: c72e01d6dcadb28939dad40b6af19cc54292f333 (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
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
/***************************************************************************
 *                                                                         *
 *   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.                                   *
 *                                                                         *
 *   copyright (C) 2002-2006                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

#ifndef ENTITYATTRIBUTE_H
#define ENTITYATTRIBUTE_H

#include "attribute.h"
#include "umlnamespace.h"

/**
 * This class is used to set up information for an entityattribute.  This is a database field
 * It has a type, name, index type and default value.
 *
 * @short Sets up entityattribute information.
 * @author Jonathan Riddell <jr @jriddell.org>
 * @see UMLObject
 * Bugs and comments to uml-devel@lists.sf.net or http://bugs.trinitydesktop.org
 */
class UMLEntityAttribute : public UMLAttribute {
    Q_OBJECT
  
public:
    /**
     * Sets up an entityattribute.
     *
     * @param parent    The parent of this UMLEntityAttribute.
     * @param name      The name of this UMLEntityAttribute.
     * @param id        The unique id given to this UMLEntityAttribute.
     * @param s         The visibility of the UMLEntityAttribute.
     * @param type      The type of this UMLEntityAttribute.
     * @param iv        The initial value of the entityattribute.
     */
    UMLEntityAttribute(const UMLObject* parent, const TQString& name,
                       Uml::IDType id = Uml::id_None,
                       Uml::Visibility s = Uml::Visibility::Private,
                       UMLObject *type = 0, const TQString& iv = 0);

    /**
     * Sets up an entityattribute.
     *
     * @param parent    The parent of this UMLEntityAttribute.
     */
    UMLEntityAttribute(const UMLObject* parent);

    /**
     * Overloaded '==' operator
     */
    bool operator==( UMLEntityAttribute& rhs);

    /**
     * destructor.
     */
    virtual ~UMLEntityAttribute();

    /**
     * Copy the internal presentation of this object into the UMLEntityAttribute
     * object.
     */
    virtual void copyInto(UMLEntityAttribute* rhs) const;

    /**
     * Make a clone of the UMLEntityAttribute.
     */
    virtual UMLObject* clone() const;

    /**
     * Returns The value of the UMLEntityAttribute's attributes property.
     *
     * @return  The value of the UMLEntityAttribute's attributes property.
     */
    TQString getAttributes() const;

    /**
     * Sets the UMLEntityAttribute's attributes property.
     *
     * @param attributes  The new value for the attributes property.
     */
    void setAttributes(const TQString& attributes);

    /**
     * Returns the UMLEntityAttribute's index type property.
     *
     * @return  The value of the UMLEntityAttribute's index type property.
     */
    Uml::DBIndex_Type getIndexType() const;

    /**
     * Sets the UMLEntityAttribute's index type property.
     *
     * @param indexType  The UMLEntityAttribute's index type property.
     */
    void setIndexType(const Uml::DBIndex_Type indexType);

    /**
     * Returns the UMLEntityAttribute's length/values property.
     *
     * @return  The UMLEntityAttribute's length/values property.
     */
    TQString getValues() const;

    /**
     * Sets the UMLEntityAttribute's length/values property.
     *
     * @param values    The new value of the length/values property.
     */
    void setValues(const TQString& values);

    /**
     * Returns the UMLEntityAttribute's auto_increment boolean
     *
     * @return  The UMLEntityAttribute's auto_increment boolean
     */
    bool getAutoIncrement() const;

    /**
     * Sets the UMLEntityAttribute's auto_increment property
     *
     * @param autoIncrement  The UMLEntityAttribute's auto_increment property
     */
    void setAutoIncrement(const bool autoIncrement);

    /**
     * Returns the UMLEntityAttribute's allow null value.
     *
     * @return  The UMLEntityAttribute's allow null value.
     */
    bool getNull() const;

    /**
     * Sets the UMLEntityAttribute's allow null value.
     *
     * @param null      The UMLEntityAttribute's allow null value.
     */
    void setNull(const bool null);

    /**
     * Returns a string representation of the UMLEntityAttribute.
     *
     * @param sig               If true will show the entityattribute type and
     *                  initial value.
     * @return  Returns a string representation of the UMLEntityAttribute.
     */
    TQString toString(Uml::Signature_Type sig = Uml::st_NoSig);

    /**
     * Creates the <UML:EntityAttribute> XMI element.
     */
    void saveToXMI(TQDomDocument& qDoc, TQDomElement& qElement);

    /**
     * Display the properties configuration dialog for the entityattribute.
     */
    bool showPropertiesDialog(TQWidget* parent);

protected:
    /**
     * Initialize members of this class.
     * Auxiliary method used by constructors.
     */
    void init();

    /**
     * Loads the <UML:EntityAttribute> XMI element.
     */
    bool load(TQDomElement& element);

private:
    Uml::DBIndex_Type m_indexType;
    TQString m_values;
    TQString m_attributes;
    bool m_autoIncrement;
    bool m_null;
};

#endif