MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / decomposeParamClassName

Function decomposeParamClassName

Source/componentdefinition.go:724–744  ·  view source on GitHub ↗

decomposeParamClassName decomposes a classname into a namespace and the actual classname within this namespace

(paramClassName string)

Source from the content-addressed store, hash-verified

722
723// decomposeParamClassName decomposes a classname into a namespace and the actual classname within this namespace
724func decomposeParamClassName(paramClassName string) (string, string, error) {
725 if len(paramClassName) == 0 {
726 return "", paramClassName, nil
727 }
728
729 namespaceRegexp := "[A-Z][a-zA-Z0-9_]{0,63}"
730 var IsValidParamClassName = regexp.MustCompile(fmt.Sprintf("^((%s):){0,1}([a-zA-Z0-9_]{0,64})$", namespaceRegexp) )
731
732 if !(IsValidParamClassName.MatchString(paramClassName)) {
733 return "","", fmt.Errorf("param class name \"%s\" is ill formatted", paramClassName);
734 }
735 slices := IsValidParamClassName.FindStringSubmatch(paramClassName)
736 if (len(slices) != 4) {
737 return "","", fmt.Errorf("param class name \"%s\" is ill formatted", paramClassName);
738 }
739
740 namespace := slices[2]
741 className := slices[3]
742
743 return namespace, className, nil
744}
745
746func nameIsValidIdentifier(name string) bool {
747 var IsValidIdentifier = regexp.MustCompile("^[A-Z][a-zA-Z0-9_]{0,63}$").MatchString

Callers 11

checkMethodMethod · 0.85
writeMethodFunction · 0.85
getCParameterTypeNameFunction · 0.85
getCPPParameterTypeNameFunction · 0.85
getCSharpParameterTypeFunction · 0.85
getPascalParameterTypeFunction · 0.85
writeDynamicCPPMethodFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected