1 /*
2     SPDX-License-Identifier: GPL-2.0-or-later
3     SPDX-FileCopyrightText: 2002-2021 Umbrello UML Modeller Authors <umbrello-devel@kde.org>
4 */
5 
6 #ifndef CHECKCONSTRAINT_H
7 #define CHECKCONSTRAINT_H
8 
9 #include "basictypes.h"
10 #include "entityconstraint.h"
11 
12 /**
13  * This class is used to set up information for a unique entity constraint.
14  *
15  * @short Sets up Check Constraint information for UMLEntities.
16  * @author Sharan Rao
17  * @see UMLObject UMLClassifierListItem UMLEntityConstraint
18  * Bugs and comments to umbrello-devel@kde.org or https://bugs.kde.org
19  */
20 class UMLCheckConstraint : public UMLEntityConstraint
21 {
22      Q_OBJECT
23 public:
24 
25     UMLCheckConstraint(UMLObject *parent, const QString& name,
26                        Uml::ID::Type id = Uml::ID::None);
27     explicit UMLCheckConstraint(UMLObject *parent);
28 
29     bool operator==(const UMLCheckConstraint &rhs) const;
30 
31     virtual ~UMLCheckConstraint();
32 
33     virtual void copyInto(UMLObject *lhs) const;
34 
35     virtual UMLObject* clone() const;
36 
37     QString toString(Uml::SignatureType::Enum sig = Uml::SignatureType::NoSig,
38                      bool withStereotype=false) const;
39 
40     QString getFullyQualifiedName(const QString& separator = QString(),
41                                   bool includeRoot = false) const;
42 
43     void saveToXMI1(QXmlStreamWriter& writer);
44 
45     virtual bool showPropertiesDialog(QWidget* parent = 0);
46 
getCheckCondition()47     QString getCheckCondition() const {
48         return m_CheckCondition;
49     }
50 
setCheckCondition(const QString & condition)51     void setCheckCondition(const QString& condition) {
52         m_CheckCondition = condition.trimmed();
53     }
54 
55 protected:
56 
57     bool load1(QDomElement & element);
58 
59 private:
60 
61     void init();
62 
63     QString m_CheckCondition;   ///< the check condition
64 
65 };
66 
67 #endif
68