From 9e819e4282b87d566af0bd49bd6cb5da53f60c49 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:29:32 +0000 Subject: [PATCH 1/2] Initial plan From 9cf3c86a4210e27f7b2f19adb537565aa15aa6b8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 26 Feb 2026 16:53:32 +0000 Subject: [PATCH 2/2] Add stringoutclass attribute to global element, default to baseclassname Co-authored-by: martinweismann <30837766+martinweismann@users.noreply.github.com> --- Source/ACT.xsd | 3 +++ Source/buildimplementationcpp.go | 6 +++--- Source/componentdefinition.go | 24 +++++++++++++++++++++++- Source/componentdiff.go | 7 +++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Source/ACT.xsd b/Source/ACT.xsd index 0fdfb5d3..ea07c7aa 100644 --- a/Source/ACT.xsd +++ b/Source/ACT.xsd @@ -161,6 +161,9 @@ The <baseclassname> must match a class with the same name and specifies the name of a class that is the base class for all classes of the generated component. + + The <stringoutclass> specifies the class used for the error method's instance parameter. Defaults to <baseclassname> if not specified. + The <acquiremethod> must match a method with the same name and the correct signature. diff --git a/Source/buildimplementationcpp.go b/Source/buildimplementationcpp.go index 66708458..e1a4619f 100644 --- a/Source/buildimplementationcpp.go +++ b/Source/buildimplementationcpp.go @@ -574,7 +574,7 @@ func buildCPPInterfaceWrapperMethods(component ComponentDefinition, class Compon for j := 0; j < len(class.Methods); j++ { method := class.Methods[j] - err := writeCImplementationMethod(component, method, w, BaseName, NameSpace, ClassIdentifier, class.ClassName, component.Global.BaseClassName, false, doJournal, eSpecialMethodNone) + err := writeCImplementationMethod(component, method, w, BaseName, NameSpace, ClassIdentifier, class.ClassName, component.Global.StringOutClass, false, doJournal, eSpecialMethodNone) if err != nil { return err } @@ -666,7 +666,7 @@ func buildCPPInterfaceWrapper(component ComponentDefinition, w LanguageWriter, N journalParameter = fmt.Sprintf(", C%sInterfaceJournalEntry * pJournalEntry = nullptr", NameSpace) } - IBaseClassName := "I" + ClassIdentifier + component.Global.BaseClassName + IBaseClassName := "I" + ClassIdentifier + component.Global.StringOutClass registerErrorMethod := RegisterErrorMessageMethod() w.Writeln("%sResult handle%sException(%s * pIBaseClass, E%sInterfaceException & Exception%s)", NameSpace, NameSpace, IBaseClassName, NameSpace, journalParameter) w.Writeln("{") @@ -759,7 +759,7 @@ func buildCPPInterfaceWrapper(component ComponentDefinition, w LanguageWriter, N } // Write Static function implementation - err = writeCImplementationMethod(component, method, w, BaseName, NameSpace, ClassIdentifier, "Wrapper", component.Global.BaseClassName, true, doMethodJournal, isSpecialFunction) + err = writeCImplementationMethod(component, method, w, BaseName, NameSpace, ClassIdentifier, "Wrapper", component.Global.StringOutClass, true, doMethodJournal, isSpecialFunction) if err != nil { return err } diff --git a/Source/componentdefinition.go b/Source/componentdefinition.go index de864ba3..fe60dc53 100644 --- a/Source/componentdefinition.go +++ b/Source/componentdefinition.go @@ -116,6 +116,7 @@ type ComponentDefinitionGlobal struct { ComponentDiffableElement XMLName xml.Name `xml:"global"` BaseClassName string `xml:"baseclassname,attr"` + StringOutClass string `xml:"stringoutclass,attr"` ErrorMethod string `xml:"errormethod,attr"` ReleaseMethod string `xml:"releasemethod,attr"` AcquireMethod string `xml:"acquiremethod,attr"` @@ -972,6 +973,10 @@ func (component *ComponentDefinition) CheckComponentDefinition() error { if component.Global.BaseClassName == "" { return errors.New("No base class name specified") } + // Default StringOutClass to BaseClassName if not specified + if component.Global.StringOutClass == "" { + component.Global.StringOutClass = component.Global.BaseClassName + } found := 0 for i := 0; i < len(component.Classes); i++ { if component.Classes[i].ClassName == component.Global.BaseClassName { @@ -983,6 +988,18 @@ func (component *ComponentDefinition) CheckComponentDefinition() error { } else if found > 1 { return errors.New("Base clase defined more than once") } + // Validate StringOutClass references an existing class + if component.Global.StringOutClass != component.Global.BaseClassName { + foundStringOut := 0 + for i := 0; i < len(component.Classes); i++ { + if component.Classes[i].ClassName == component.Global.StringOutClass { + foundStringOut++ + } + } + if foundStringOut == 0 { + return errors.New("Specified stringoutclass not found") + } + } return nil } @@ -1103,10 +1120,15 @@ func CheckHeaderSpecialFunction(method ComponentDefinitionMethod, global Compone return eSpecialMethodNone, errors.New("Error method does not match the expected function template") } + // Use StringOutClass if specified, otherwise fall back to BaseClassName + errorMethodClass := global.StringOutClass + if errorMethodClass == "" { + errorMethodClass = global.BaseClassName + } if (method.Params[0].ParamType != "class") || (method.Params[0].ParamPass != "in") || (method.Params[1].ParamType != "string") || (method.Params[1].ParamPass != "out") || (method.Params[2].ParamType != "bool") || (method.Params[2].ParamPass != "return") || - (method.Params[0].ParamClass != global.BaseClassName) { + (method.Params[0].ParamClass != errorMethodClass) { return eSpecialMethodNone, errors.New("Error method does not match the expected function template") } diff --git a/Source/componentdiff.go b/Source/componentdiff.go index c5fa14e7..85e4c0b7 100644 --- a/Source/componentdiff.go +++ b/Source/componentdiff.go @@ -476,6 +476,13 @@ func diffGlobal(path string, globalA ComponentDefinitionGlobal, globalB Componen change.NewValue = globalB.JournalMethod changes = append(changes, change) } + if globalA.StringOutClass != globalB.StringOutClass { + var change ComponentDiffAttributeChange + change.Path = pathA + "/stringoutclass" + change.OldValue = globalA.StringOutClass + change.NewValue = globalB.StringOutClass + changes = append(changes, change) + } if globalA.ReleaseMethod != globalB.ReleaseMethod { var change ComponentDiffAttributeChange change.Path = pathA + "/releasemethod"