summaryrefslogtreecommitdiffstats
path: root/umbrello/umbrello/codegenerators/codegenfactory.h
blob: 01854879911d37ea3642cb066704d151b48df6c5 (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
/***************************************************************************
 *                                                                         *
 *   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) 2004-2006                                               *
 *   Umbrello UML Modeller Authors <uml-devel@uml.sf.net>                  *
 ***************************************************************************/

#ifndef CODEGENFACTORY_H
#define CODEGENFACTORY_H

#include "../umlnamespace.h"
#include "../codeaccessormethod.h"

// fwd decls
class CodeGenerator;
class ClassifierCodeDocument;
class CodeOperation;
class CodeClassField;
class CodeClassFieldDeclarationBlock;
class UMLClassifier;
class UMLOperation;
class UMLAttribute;
class UMLRole;

/**
 * CodeGenFactory allows creating the available code generators as well
 * as the auxiliary objects required for the advanced code generators.
 *
 * @author Jonathan Riddell
 * @author Oliver Kellogg <okellogg@users.sourceforge.net>
 * Bugs and comments to uml-devel@lists.sf.net or http://bugs.trinitydesktop.org
 */
namespace CodeGenFactory {

    /**
     * Create a code generator specific to the given language.
     */
    CodeGenerator* createObject(Uml::Programming_Language pl);


    /**
     * Create a CodeOperation belonging to the given ClassifierCodeDocument.
     * Only applies to the advanced generators.
     *
     * @param cd    the parent ClassifierCodeDocument.
     * @param op    the related UMLOperation
     * @return  CodeOperation which is specific to the current language
     */
    CodeOperation *newCodeOperation(ClassifierCodeDocument *cd, UMLOperation * op);

    /**
     * Create an attribute CodeClassField belonging to the given
     * ClassifierCodeDocument.
     * Only applies to the advanced generators.
     *
     * @param cd         the parent ClassifierCodeDocument
     * @param at         attribute which is parent of this class field
     * @return  CodeClassField which is specific to the current language
     */
    CodeClassField * newCodeClassField (ClassifierCodeDocument *cd, UMLAttribute * at);

    /**
     * Create an association role CodeClassField belonging to the given
     * ClassifierCodeDocument.
     * Only applies to the advanced generators.
     *
     * @param cd         the parent ClassifierCodeDocument
     * @param role       association role which is parent of this class field
     * @return  CodeClassField which is specific to the current language
     */
    CodeClassField * newCodeClassField(ClassifierCodeDocument *cd, UMLRole *role);

    /**
     * Create a CodeAccessorMethod object belonging to the given ClassifierCodeDocument.
     * Only applies to the advanced generators.
     *
     * @param cd         the parent ClassifierCodeDocument
     * @param cf         CodeClassField which is parent of this object
     * @param type       CodeAccessorMethod::AccessorType to create
     *
     * @return  CodeAccessorMethod which is specific to the current language
     */
    CodeAccessorMethod * newCodeAccessorMethod(ClassifierCodeDocument *cd,
                                               CodeClassField *cf,
                                               CodeAccessorMethod::AccessorType type);

    /**
     * Create a CodeClassFieldDeclarationBlock object belonging to the given
     * ClassifierCodeDocument.
     * Only applies to the advanced generators.
     *
     * @param cd         the parent ClassifierCodeDocument
     * @param cf         CodeClassField which is parent of this object
     *
     * @return  CodeClassFieldDeclarationBlock which is specific to the current language
     */
    CodeClassFieldDeclarationBlock * newDeclarationCodeBlock (ClassifierCodeDocument *cd,
                                                              CodeClassField * cf);

    /**
     * Create a new CodeComment object belonging to the given CodeDocument.
     * Only applies to the advanced generators.
     *
     * @param cd         the parent CodeDocument
     * @return      CodeBlockWithComments
     */
    CodeComment * newCodeComment (CodeDocument *cd);

    /**
     * Currently unused (for possible future use)
     */
    CodeDocument * newClassifierCodeDocument (UMLClassifier * classifier);
}

#endif //CODEGENFACTORY_H