Просмотр исходного кода

Added const keyword to return type of getter function for constant.

Markus Mühlbrandt 10 лет назад
Родитель
Сommit
ad96f92fcb

+ 2 - 2
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineHeader.xtend

@@ -278,7 +278,7 @@ class StatemachineHeader extends Statemachine {
 
 	override dispatch functionPrototypes(VariableDefinition it) '''
 		/*! Gets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */ 
-		«type.targetLanguageName» «it.asGetter»();
+		«IF const»const «ENDIF»«type.targetLanguageName» «it.asGetter»();
 
 		«IF !readonly && !const»
 			/*! Sets the value of the variable '«name»' that is defined in the «scope.scopeDescription». */ 
@@ -288,7 +288,7 @@ class StatemachineHeader extends Statemachine {
 	'''
 
 	/* ===================================================================================
-	 * Handling decralartion of function prototypes
+	 * Handling declaration of function prototypes
 	 */
 	/** */
 	def prototypes(ExecutionFlow it) '''

+ 2 - 2
plugins/org.yakindu.sct.generator.cpp/src/org/yakindu/sct/generator/cpp/StatemachineImplementation.xtend

@@ -341,12 +341,12 @@ class StatemachineImplementation {
 				«ENDIF»
 			«ENDFOR»
 			«FOR variable : scope.variableDefinitions»
-				«variable.type.targetLanguageName» «module»::«scope.interfaceName»::«variable.asGetter»() {
+				«IF variable.const»const «ENDIF»«variable.type.targetLanguageName» «module»::«scope.interfaceName»::«variable.asGetter»() {
 					return «variable.localAccess»;
 				}
 				
 				«IF scope.defaultInterface»
-					«variable.type.targetLanguageName» «module»::«variable.asGetter»() {
+					«IF variable.const»const «ENDIF»«variable.type.targetLanguageName» «module»::«variable.asGetter»() {
 						return «variable.access»;
 					}