summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codegenerators/classifierinfo.h
blob: 53b7c02b9d62bd7a10d32f343876e4056b0d8838 (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
/***************************************************************************
 *                                                                         *
 *   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) 2003 Brian Thomas <brian.thomas@gsfc.nasa.gov>          *
 *   copyright (C) 2004-2007                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

#ifndef CLASSIFIERINFO_H
#define CLASSIFIERINFO_H

#include "../umldoc.h"
#include "../attribute.h"
#include "../association.h"
#include "../umlclassifierlist.h"
#include "../umlassociationlist.h"
#include "../umlattributelist.h"

#include <qstring.h>


class UMLClassifier;
	

/**
  * class ClassInfo is an object to hold summary information about a classifier
  * in a convenient form for easy access by a code generator.
  */
class ClassifierInfo {
public:

    /**
     * Constructor, initialises a couple of variables
     */
    ClassifierInfo (UMLClassifier * classifier);

    /**
     * Destructor, empty
     */
    virtual ~ClassifierInfo();

    // Fields
    //

    /**
     * Lists of attributes of this classifier (if a class)
     * Sorted by scope.
     */
    UMLAttributeList atpub;
    UMLAttributeList atprot;
    UMLAttributeList atpriv;

    /**
     * Lists of static attributes of this classifier (if a class)
     */
    UMLAttributeList static_atpub;
    UMLAttributeList static_atprot;
    UMLAttributeList static_atpriv;

    /**
     * Lists of types of associations this classifier has
     */
    UMLAssociationList plainAssociations;
    UMLAssociationList uniAssociations;
    UMLAssociationList aggregations;
    UMLAssociationList compositions;

    /**
     * what sub and super classifiers are related to this class
     */
    UMLClassifierList superclasses;
    UMLClassifierList subclasses;

    /**
     * Various conditional information about our classifier.
     */
    bool isInterface; // Whether or not this classifier is an interface.
    bool hasAssociations;
    bool hasAttributes;
    bool hasStaticAttributes;
    bool hasMethods;
    bool hasAccessorMethods;
    bool hasOperationMethods;
    bool hasVectorFields;

    /**
     * Class and File names
     */
    QString className;
    QString fileName;

    /**
     * utility functions to allow easy determination of what classifiers
     * are "owned" by the current one via named association type (e.g.
     * plain, aggregate or compositions).
     */
    UMLClassifierList getPlainAssocChildClassifierList();
    UMLClassifierList getAggregateChildClassifierList();
    UMLClassifierList getCompositionChildClassifierList();

    /**
     * Utility method to obtain list of attributes, if they exist, for
     * the current classfier.
     */
    UMLAttributeList getAttList();

private:

    UMLClassifier* classifier_;
    
    /**
     * Utility method called by "get*ChildClassfierList()" methods. It basically
     * finds all the classifiers named in each association in the given association list
     * which arent the current one. Usefull for finding which classifiers are "owned" by the
     * current one via declared associations such as in aggregations/compositions.
     */
    UMLClassifierList findAssocClassifierObjsInRoles (UMLAssociationList * list);

};

#endif // CLASSIFIERINFO_H