umbrello  2.32.2
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  * This program is free software; you can redistribute it and/or modify *
3  * it under the terms of the GNU General Public License as published by *
4  * the Free Software Foundation; either version 2 of the License, or *
5  * (at your option) any later version. *
6  * *
7  * copyright (C) 2003-2020 *
8  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9  ***************************************************************************/
10 
11 #ifndef STEREOTYPE_H
12 #define STEREOTYPE_H
13 
14 #include "umlobject.h"
15 
40 class UMLStereotype : public UMLObject
41 {
42  Q_OBJECT
43 public:
44  explicit UMLStereotype(const QString &name, Uml::ID::Type id = Uml::ID::None);
45  UMLStereotype();
46 
47  virtual ~UMLStereotype();
48 
49  bool operator==(const UMLStereotype &rhs) const;
50 
51  virtual void copyInto(UMLObject *lhs) const;
52 
53  virtual UMLObject* clone() const;
54 
55  void incrRefCount();
56  void decrRefCount();
57 
58  int refCount() const;
59 
60  QString name(bool includeAdornments=false) const;
61 
62  class AttributeDef
63  {
64  public:
65  QString name;
67  QString defaultVal;
69  AttributeDef(QString nm, Uml::PrimitiveTypes::Enum t, QString dfltVal = QString())
70  : name(nm), type(t), defaultVal(dfltVal) {}
71  virtual ~AttributeDef() {}
72  };
73 
74  typedef QVector<AttributeDef> AttributeDefs;
75 
77  void setAttributeDefs(const AttributeDefs& adefs);
78  const AttributeDefs& getAttributeDefs() const;
80 
81  void saveToXMI1(QXmlStreamWriter& writer);
82  bool load1(QDomElement& element);
83 
84  virtual bool showPropertiesDialog(QWidget* parent);
85 
86 protected:
87  int m_refCount;
89 
90 };
91 
92 #endif
Uml::PrimitiveTypes::String
@ String
Definition: basictypes.h:301
UMLObject::name
QString name() const
Definition: umlobject.cpp:211
UMLStereotype::AttributeDef::~AttributeDef
virtual ~AttributeDef()
Definition: stereotype.h:79
stereotype.h
UMLStereotype::incrRefCount
void incrRefCount()
Definition: stereotype.cpp:205
UMLObject::save1
void save1(const QString &tag, QXmlStreamWriter &writer)
Definition: umlobject.cpp:854
UMLStereotype::load1
bool load1(QDomElement &element)
Definition: stereotype.cpp:153
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:404
UMLStereotype::getAttributeDefs
const AttributeDefs & getAttributeDefs() const
Definition: stereotype.cpp:114
Uml::PrimitiveTypes::toString
QString toString(Enum item)
Definition: basictypes.cpp:896
UMLStereotype::m_refCount
int m_refCount
Definition: stereotype.h:95
UMLObject::setName
virtual void setName(const QString &strName)
Definition: umlobject.cpp:192
UMLStereotype::UMLStereotype
UMLStereotype()
Definition: stereotype.cpp:44
UMLStereotype::decrRefCount
void decrRefCount()
Definition: stereotype.cpp:213
Uml::ID::Type
std::string Type
Definition: basictypes.h:402
UMLStereotype::refCount
int refCount() const
Definition: stereotype.cpp:221
UMLObject
The base class for UML objects.
Definition: umlobject.h:74
UMLObject::baseType
ObjectType baseType() const
Definition: umlobject.cpp:397
UMLObject::m_BaseType
ObjectType m_BaseType
objects type
Definition: umlobject.h:281
UMLStereotype::operator==
bool operator==(const UMLStereotype &rhs) const
Definition: stereotype.cpp:62
UMLStereotype
Sets up stereotype information.
Definition: stereotype.h:40
UMLObject::m_name
QString m_name
objects name
Definition: umlobject.h:280
UMLStereotype::saveToXMI1
void saveToXMI1(QXmlStreamWriter &writer)
Definition: stereotype.cpp:130
UMLObject::ot_Stereotype
@ ot_Stereotype
Definition: umlobject.h:100
UMLStereotype::AttributeDef::defaultVal
QString defaultVal
Definition: stereotype.h:75
UMLStereotype::~UMLStereotype
virtual ~UMLStereotype()
Definition: stereotype.cpp:54
UMLObject::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: umlobject.cpp:314
Uml::PrimitiveTypes::fromString
Enum fromString(const QString &item, bool strict)
Definition: basictypes.cpp:916
UMLStereotype::copyInto
virtual void copyInto(UMLObject *lhs) const
Definition: stereotype.cpp:79
UMLStereotype::showPropertiesDialog
virtual bool showPropertiesDialog(QWidget *parent)
Definition: stereotype.cpp:191
uDebug
#define uDebug()
Definition: debug_utils.h:122
UMLStereotype::AttributeDef::name
QString name
Definition: stereotype.h:73
UMLApp::app
static UMLApp * app()
Definition: uml.cpp:280
UMLStereotype::AttributeDef
Definition: stereotype.h:70
UMLStereotype::AttributeDef::AttributeDef
AttributeDef()
Definition: stereotype.h:76
UMLDoc::tagEq
static bool tagEq(const QString &tag, const QString &pattern)
Definition: umldoc.cpp:3553
uError
#define uError()
Definition: debug_utils.h:123
UMLStereotype::m_attrDefs
AttributeDefs m_attrDefs
Definition: stereotype.h:96
uml.h
debug_utils.h
umlobject.h
UMLDoc::findStereotype
UMLStereotype * findStereotype(const QString &name)
Definition: umldoc.cpp:1313
UMLStereotype::clearAttributeDefs
void clearAttributeDefs()
Definition: stereotype.cpp:98
dialog_utils.h
UMLStereotype::setAttributeDefs
void setAttributeDefs(const AttributeDefs &adefs)
Definition: stereotype.cpp:106
UMLStereotype::AttributeDefs
QVector< AttributeDef > AttributeDefs
size is at most N_STEREOATTRS
Definition: stereotype.h:82
Uml::PrimitiveTypes::Enum
Enum
Definition: basictypes.h:300
Dialog_Utils::askRenameName
bool askRenameName(WidgetBase::WidgetType type, QString &name)
Definition: dialog_utils.cpp:262
UMLApp::document
UMLDoc * document() const
Definition: uml.cpp:1068
UMLStereotype::AttributeDef::type
Uml::PrimitiveTypes::Enum type
Definition: stereotype.h:74
umldoc.h
UMLStereotype::clone
virtual UMLObject * clone() const
Definition: stereotype.cpp:87