umbrello  2.32.1
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
stereotype.h
Go to the documentation of this file.
1 /*
2  SPDX-License-Identifier: GPL-2.0-or-later
3  SPDX-FileCopyrightText: 2003-2020 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4 */
5 
6 #ifndef STEREOTYPE_H
7 #define STEREOTYPE_H
8 
9 #include "umlobject.h"
10 
35 class UMLStereotype : public UMLObject
36 {
37  Q_OBJECT
38 public:
39  explicit UMLStereotype(const QString &name, Uml::ID::Type id = Uml::ID::None);
40  UMLStereotype();
41 
42  virtual ~UMLStereotype();
43 
44  bool operator==(const UMLStereotype &rhs) const;
45 
46  virtual void copyInto(UMLObject *lhs) const;
47 
48  virtual UMLObject* clone() const;
49 
50  void incrRefCount();
51  void decrRefCount();
52 
53  int refCount() const;
54 
55  QString name(bool includeAdornments=false) const;
56 
58  {
59  public:
60  QString name;
62  QString defaultVal;
63  AttributeDef() : type(Uml::PrimitiveTypes::String) {}
64  AttributeDef(QString nm, Uml::PrimitiveTypes::Enum t, QString dfltVal = QString())
65  : name(nm), type(t), defaultVal(dfltVal) {}
66  virtual ~AttributeDef() {}
67  };
68 
69  typedef QVector<AttributeDef> AttributeDefs;
70 
71  void clearAttributeDefs();
72  void setAttributeDefs(const AttributeDefs& adefs);
73  const AttributeDefs& getAttributeDefs() const;
75 
76  void saveToXMI1(QXmlStreamWriter& writer);
77  bool load1(QDomElement& element);
78 
79  virtual bool showPropertiesDialog(QWidget* parent);
80 
81 protected:
84 
85 };
86 
87 #endif
UMLStereotype::AttributeDef::AttributeDef
AttributeDef(QString nm, Uml::PrimitiveTypes::Enum t, QString dfltVal=QString())
Definition: stereotype.h:64
UMLDoc::findStereotype
UMLStereotype * findStereotype(const QString &name) const
Definition: umldoc.cpp:1313
Uml::PrimitiveTypes::String
@ String
Definition: basictypes.h:270
UMLObject::name
QString name() const
Definition: umlobject.cpp:206
UMLStereotype::AttributeDef::~AttributeDef
virtual ~AttributeDef()
Definition: stereotype.h:66
stereotype.h
UMLStereotype::incrRefCount
void incrRefCount()
Definition: stereotype.cpp:200
UMLObject::save1
void save1(const QString &tag, QXmlStreamWriter &writer)
Definition: umlobject.cpp:850
UMLStereotype::load1
bool load1(QDomElement &element)
Definition: stereotype.cpp:148
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:373
UMLStereotype::getAttributeDefs
const AttributeDefs & getAttributeDefs() const
Definition: stereotype.cpp:109
Uml::PrimitiveTypes::toString
QString toString(Enum item)
Definition: basictypes.cpp:865
UMLStereotype::m_refCount
int m_refCount
Definition: stereotype.h:82
UMLObject::setName
virtual void setName(const QString &strName)
Definition: umlobject.cpp:187
UMLStereotype::UMLStereotype
UMLStereotype()
Definition: stereotype.cpp:39
UMLStereotype::decrRefCount
void decrRefCount()
Definition: stereotype.cpp:208
Uml::ID::Type
std::string Type
Definition: basictypes.h:371
UMLStereotype::refCount
int refCount() const
Definition: stereotype.cpp:216
UMLObject
The base class for UML objects.
Definition: umlobject.h:69
UMLObject::baseType
ObjectType baseType() const
Definition: umlobject.cpp:392
UMLObject::m_BaseType
ObjectType m_BaseType
objects type
Definition: umlobject.h:276
UMLStereotype::operator==
bool operator==(const UMLStereotype &rhs) const
Definition: stereotype.cpp:57
UMLStereotype
Sets up stereotype information.
Definition: stereotype.h:35
UMLObject::m_name
QString m_name
objects name
Definition: umlobject.h:275
UMLStereotype::saveToXMI1
void saveToXMI1(QXmlStreamWriter &writer)
Definition: stereotype.cpp:125
UMLObject::ot_Stereotype
@ ot_Stereotype
Definition: umlobject.h:95
UMLStereotype::AttributeDef::defaultVal
QString defaultVal
Definition: stereotype.h:62
UMLStereotype::~UMLStereotype
virtual ~UMLStereotype()
Definition: stereotype.cpp:49
UMLObject::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: umlobject.cpp:309
Uml::PrimitiveTypes::fromString
Enum fromString(const QString &item, bool strict)
Definition: basictypes.cpp:885
UMLStereotype::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: stereotype.cpp:74
UMLStereotype::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent)
Definition: stereotype.cpp:186
uDebug
#define uDebug()
Definition: debug_utils.h:108
UMLStereotype::AttributeDef::name
QString name
Definition: stereotype.h:60
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:275
UMLStereotype::AttributeDef
Definition: stereotype.h:57
Uml
Definition: basictypes.cpp:22
UMLStereotype::AttributeDef::AttributeDef
AttributeDef()
Definition: stereotype.h:63
UMLDoc::tagEq
static bool tagEq(const QString &tag, const QString &pattern)
Definition: umldoc.cpp:3562
uError
#define uError()
Definition: debug_utils.h:109
UMLStereotype::m_attrDefs
AttributeDefs m_attrDefs
Definition: stereotype.h:83
uml.h
debug_utils.h
umlobject.h
UMLStereotype::clearAttributeDefs
void clearAttributeDefs()
Definition: stereotype.cpp:93
dialog_utils.h
UMLStereotype::setAttributeDefs
void setAttributeDefs(const AttributeDefs &adefs)
Definition: stereotype.cpp:101
UMLStereotype::AttributeDefs
QVector< AttributeDef > AttributeDefs
size is at most N_STEREOATTRS
Definition: stereotype.h:69
Uml::PrimitiveTypes::Enum
Enum
Definition: basictypes.h:269
Dialog_Utils::askRenameName
bool askRenameName(WidgetBase::WidgetType type, QString &name)
Definition: dialog_utils.cpp:257
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1063
UMLStereotype::AttributeDef::type
Uml::PrimitiveTypes::Enum type
Definition: stereotype.h:61
umldoc.h
UMLStereotype::clone
virtual UMLObject * clone() const
Definition: stereotype.cpp:82