diff options
author | Shuai Li | 2015-11-04 08:33:22 +0000 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org | 2015-11-25 09:56:33 +0000 |
commit | 830214fbd63cc1a0deff2be4715af0a4d88353df (patch) | |
tree | 7a832a35e6f0c42f5e2b5fd7f2296fcdbfac39e5 /extraplugins | |
parent | 8d0c365545b5b1523c54ced2fd13438abc7586c4 (diff) | |
download | org.eclipse.papyrus-830214fbd63cc1a0deff2be4715af0a4d88353df.tar.gz org.eclipse.papyrus-830214fbd63cc1a0deff2be4715af0a4d88353df.tar.xz org.eclipse.papyrus-830214fbd63cc1a0deff2be4715af0a4d88353df.zip |
Bug 481296 - [C++ codegen] Initialization of static const member of a
class
- Generate default value of static const variable in .cpp
- Do not in .h
- Update JUnit test for static const initialization test
Change-Id: Ica243081ffeb9d0d2b32493b91282d7376f035ca
Signed-off-by: Shuai Li <shuai.li@cea.fr>
Diffstat (limited to 'extraplugins')
-rw-r--r-- | extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend index 3e806406da2..35305e4427d 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.codegen/src/org/eclipse/papyrus/cpp/codegen/xtend/CppAttribute.xtend @@ -34,7 +34,7 @@ class CppAttribute { var code = ''' // static attributes (if any) «FOR ownedAttribute : getOwnedAttributes(classifier)» - «IF (ownedAttribute.isStatic && !GenUtils.hasStereotype(ownedAttribute, Const) && !GenUtils.hasStereotype(ownedAttribute, Mutable))» + «IF (ownedAttribute.isStatic)» «CppStaticAttributeImplementation(ownedAttribute)» «ENDIF» «ENDFOR» @@ -82,8 +82,7 @@ class CppAttribute { static def CppAttributeDeclaration(Property attribute) ''' «CppDocumentation.CppElementDoc(attribute)» «staticValue(attribute)» «Modifier.modCVQualifier(attribute)»«CppGenUtils.cppQualifiedName(attribute.type)»«Modifier. - modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.name»«Modifier.modArray(attribute)»«IF GenUtils. - hasStereotype(attribute, Const)»«defaultValue(attribute)»«ENDIF»; + modPtr(attribute)»«Modifier.modRef(attribute)» «attribute.name»«Modifier.modArray(attribute)»; ''' static def staticValue(Property attribute) { |