Skip to main content
aboutsummaryrefslogblamecommitdiffstats
blob: d2b364f150618573e0162641ae41d34ead398824 (plain) (tree)
1
2
3
4
5
6
7
8
                                                                                                         

                                                                 
                                                              
                                                                 


                                                                              











                                                                                       
                                                                                                                                                                               

           


                                                                  
                                                                                                               


                                                                        
                  
                                                                                                                          

           
 
        

                                                                                         
                                     

                                               
                                                

                                                          
                                                         

                                                                   




                                                                        
                             





                     


                                                                       
                          
                            
                                                            

                                     


             
 
[module CppAttribute('http://www.eclipse.org/uml2/5.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
			if cl.oclIsKindOf(Interface) then
				oclAsType(Interface).ownedAttribute
			else
				if cl.oclIsKindOf(Signal) then
					oclAsType(Signal).ownedAttribute
				else
					Sequence{}
				endif
			endif
		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