umbrello  2.32.3
Umbrello UML Modeller is a Unified Modelling Language (UML) diagram program based on KDE Technology
assocrules.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) 2002-2020 *
8  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9  ***************************************************************************/
10 
11 #ifndef ASSOCRULES_H
12 #define ASSOCRULES_H
13 
14 #include "umlobject.h"
15 #include "widgetbase.h"
16 
17 class UMLWidget;
18 
26 {
27 public:
28 
29  AssocRules();
30  ~AssocRules();
31 
32  static bool allowAssociation(Uml::AssociationType::Enum assocType, UMLWidget * widget);
33  static bool allowAssociation(Uml::AssociationType::Enum assocType,
34  UMLWidget * widgetA, UMLWidget * widgetB);
35 
36  static bool allowRole(Uml::AssociationType::Enum assocType);
37 
38  static bool allowMultiplicity(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType);
39 
40  static bool allowSelf(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType);
41 
43 
44  typedef enum {All, Java} Language;
45  typedef enum {Any, UML1, UML2 } Level;
46 
47 private:
48  class Assoc_Rule {
49  public:
50  bool isValid() const;
55  bool role;
56  bool multiplicity;
58  bool self;
60  };
61 
63  static int m_nNumRules;
64 };
65 
66 #endif
Definition: assocrules.h:48
Language language
language rule applies to
Definition: assocrules.h:51
WidgetBase::WidgetType widgetA_type
type of role A widget
Definition: assocrules.h:53
Level level
UML level.
Definition: assocrules.h:59
bool bidirectional
can have an association of same type going between widget each way
Definition: assocrules.h:57
WidgetBase::WidgetType widgetB_type
type of role B widget
Definition: assocrules.h:54
bool role
role text
Definition: assocrules.h:55
bool isValid() const
< Structure to help determine association rules.
Definition: assocrules.cpp:561
Uml::AssociationType::Enum assoc_type
association type
Definition: assocrules.h:52
bool multiplicity
multiplicity text on association
Definition: assocrules.h:56
Definition: assocrules.h:26
static bool allowMultiplicity(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType)
Definition: assocrules.cpp:363
static bool allowAssociation(Uml::AssociationType::Enum assocType, UMLWidget *widget)
Definition: assocrules.cpp:51
static Assoc_Rule m_AssocRules[]
Container that holds all the rules.
Definition: assocrules.h:62
static bool allowRole(Uml::AssociationType::Enum assocType)
Definition: assocrules.cpp:347
~AssocRules()
Definition: assocrules.cpp:43
AssocRules()
Definition: assocrules.cpp:36
static int m_nNumRules
The number of rules known about.
Definition: assocrules.h:63
static Uml::AssociationType::Enum isGeneralisationOrRealisation(UMLWidget *widgetA, UMLWidget *widgetB)
Definition: assocrules.cpp:397
static bool allowSelf(Uml::AssociationType::Enum assocType, WidgetBase::WidgetType widgetType)
Definition: assocrules.cpp:379
Language
Definition: assocrules.h:44
@ Java
Definition: assocrules.h:44
@ All
Definition: assocrules.h:44
Level
Definition: assocrules.h:45
@ UML2
Definition: assocrules.h:45
@ Any
Definition: assocrules.h:45
@ UML1
Definition: assocrules.h:45
The base class for graphical UML objects.
Definition: umlwidget.h:41
WidgetType
Definition: widgetbase.h:112
Enum
Definition: basictypes.h:106