blob: 227947b9fd0796344cc6057e92bdd71becdafa27 (
plain) (
blame)
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
|
[module CppClassHeader('http://www.eclipse.org/uml2/4.0.0/UML', 'http://www.eclipse.org/papyrus/C_Cpp/1')/]
[import org::eclipse::papyrus::acceleo::GenUtils/]
[import org::eclipse::papyrus::cpp::codegen::utils::CppGenUtils/]
[import org::eclipse::papyrus::cpp::codegen::utils::ClassUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::CppIncludeUtils/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassIncludeClassDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassTypeAndEnum/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassFriendDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassInheritedDeclarations/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassAttributesDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsDeclaration/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::clazz::CppClassOperationsImplementation/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppTemplates/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]
[template public classUnionOrStruct(classifier : Classifier)]
[if (hasStereotype(C_Cpp::Union))]
'union'
[else]
[if (oclIsKindOf(DataType))]
[VisibilityKind::public.resetVisibility()/]
struct
[else]
[VisibilityKind::private.resetVisibility()/]
class
[/if]
[/if]
[/template]
[comment default initializer for non-static attributes with a default value
TODO: should be disabled by default, since non-static members can be initialized directly
in C++ 011/]
[template public defaultInitializer(classifier : Classifier) post(trim())]
[let attributeList : Set(Property) = attribute->select(
(isStatic = false) and
(defaultValue <> null) and
(defaultValue.stringValue() <> null))]
[if not attributeList->isEmpty()]
[classifier.name/]() : [for (a : Property | attributeList) separator(', ')
][name/]([defaultValue.stringValue()/])[/for] {}
[/if][/let]
[/template]
[template public CppClassHeader(class : Classifier)]
#ifndef [getFullNameUC()/]_H
#define [getFullNameUC()/]_H
/************************************************************
[class.name/] class header
************************************************************/
[_package.CppOwnerPackageIncludeDeclaration()/]
[CppClassAllIncludesDeclaration()/]
[CppIncludeHeader()/]
[openNS()/]
/************************************************************/
[CppElementDoc()/]
[templateSignature()/][classUnionOrStruct()/] [class.name/][CppClassInheritedDeclarations()/] {
[CppClassIncludeFriendDeclaration()/][CppClassTypeAndEnum()/]
[VisibilityKind::public.getSection(defaultInitializer())/]
[VisibilityKind::public.getSection(CppClassAttributesDeclaration(VisibilityKind::public))/]
[VisibilityKind::public.getSection(CppClassOperationsDeclaration(VisibilityKind::public))/]
[VisibilityKind::protected.getSection(CppClassAttributesDeclaration(VisibilityKind::protected))/]
[VisibilityKind::protected.getSection(CppClassOperationsDeclaration(VisibilityKind::protected))/]
[VisibilityKind::private.getSection(CppClassAttributesDeclaration(VisibilityKind::private))/]
[VisibilityKind::private.getSection(CppClassOperationsDeclaration(VisibilityKind::private))/]
};
/************************************************************/
/* External declarations (package visibility) */
[CppClassAttributesDeclaration(VisibilityKind::_package)/]
[CppClassOperationsDeclaration(VisibilityKind::_package)/]
/************************************************************/
[if isTemplate()]
/************************************************************/
/* Template functions */
[CppClassOperationsImplementation(false)/]
[/if]
/* Inline functions */
[CppClassOperationsImplementation(true)/]
[closeNS()/]
/************************************************************
End of [class.name/] class header
************************************************************/
#endif
[/template]
|