Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e7cd43911d20749854a8692d3a8cce45f8c9c07f (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
[module CppAttribute('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::Modifier/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::Constants/]
[import org::eclipse::papyrus::cpp::codegen::acceleo::util::CppDocumentation/]


[template public defaultValue(attribute : Property)]
[if (defaultValue <> null) and isStatic] = [attribute.defaultValue.stringValue()/][/if]
[/template]


[template public staticValue(attribute : Property)]
[if (attribute.isStatic)]static [/if]
[/template]


[template public CppAttributeDeclaration(attribute : Property)]
[CppElementDoc()/]
[staticValue()/][modConst()/][attribute.type.cppQualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/][if (hasStereotype(C_Cpp::Const))][defaultValue()/][/if];
[/template]


[template public CppAttributeImplementation(attribute : Property)]
	[CppElementDoc()/]
	[modConst()/][attribute.type.cppQualifiedName()/][modPtr()/][modRef()/] [attribute.name/][modArray()/];
[/template]

[template public CppStaticAttributeImplementation(attribute : Property)]
[CppElementDoc()/]
[type.cppQualifiedName()/][modPtr()/][modRef()/] [attribute.class.name/]::[attribute.name/][modArray()/][defaultValue()/];
[/template]


[comment
return a list of owned attributes, since this is not supported directly on a classifier/]
[query public getOwnedAttributes(cl : Classifier) : Sequence(Property) =
	if (cl.oclIsKindOf(Class)) then
		oclAsType(Class).ownedAttribute
	else
		if (cl.oclIsKindOf(DataType)) then
			oclAsType(DataType).ownedAttribute
		else
			null
		endif
	endif
/]


[comment
Loop over attributes. Check that the attribute is not a static const.
Constant static attributes are declared within the class declaration/] 
[template public CppStaticAttributes(classifier : Classifier)]
[constStaticAttributes()/]
[for (getOwnedAttributes())]
	[if(isStatic and (not hasStereotype(C_Cpp::Const)))]
[CppStaticAttributeImplementation()/]

	[/if]
[/for]
[/template]

Back to the top