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

Function writeDynamicCPPMethod

Source/buildbindingccpp.go:569–852  ·  view source on GitHub ↗
(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassIdentifier string, ClassName string,
	implementationLines []string, isGlobal bool, includeComments bool, doNotThrow bool, useCPPTypes bool, ExplicitLinking bool)

Source from the content-addressed store, hash-verified

567}
568
569func writeDynamicCPPMethod(method ComponentDefinitionMethod, w LanguageWriter, NameSpace string, ClassIdentifier string, ClassName string,
570 implementationLines []string, isGlobal bool, includeComments bool, doNotThrow bool, useCPPTypes bool, ExplicitLinking bool) error {
571
572 CMethodName := ""
573 requiresInitCall := false
574 initCallParameters := "" // usually used to check sizes of buffers
575 callParameters := ""
576 checkErrorCodeBegin := ""
577 checkErrorCodeEnd := ")"
578 makeSharedParameter := ""
579
580 if isGlobal {
581 if ExplicitLinking {
582 CMethodName = fmt.Sprintf("m_WrapperTable.m_%s", method.MethodName)
583 } else {
584 CMethodName = fmt.Sprintf("%s_%s", strings.ToLower(NameSpace), strings.ToLower(method.MethodName))
585 }
586 checkErrorCodeBegin = "CheckError(nullptr,"
587 makeSharedParameter = "this"
588 } else {
589 if ExplicitLinking {
590 CMethodName = fmt.Sprintf("m_pWrapper->m_WrapperTable.m_%s_%s", ClassName, method.MethodName)
591 } else {
592 CMethodName = fmt.Sprintf("%s_%s_%s", strings.ToLower(NameSpace), strings.ToLower(ClassName), strings.ToLower(method.MethodName))
593 }
594 callParameters = "m_pHandle"
595 initCallParameters = "m_pHandle"
596 checkErrorCodeBegin = "CheckError("
597 makeSharedParameter = "m_pWrapper"
598 }
599 if doNotThrow {
600 checkErrorCodeBegin = ""
601 checkErrorCodeEnd = ""
602 }
603
604 parameters := ""
605 returntype := "void"
606
607 definitionCodeLines := []string{}
608 functionCodeLines := []string{}
609 returnCodeLines := []string{}
610 commentcodeLines := []string{}
611 postCallCodeLines := []string{}
612
613 cppClassPrefix := "C"
614 if !useCPPTypes {
615 cppClassPrefix += NameSpace
616 }
617 cppClassName := cppClassPrefix + ClassIdentifier + ClassName
618
619 for k := 0; k < len(method.Params); k++ {
620 param := method.Params[k]
621 variableName := getBindingCppVariableName(param)
622
623 callParameter := ""
624 initCallParameter := ""
625
626 switch param.ParamPass {

Callers 1

buildCppHeaderFunction · 0.85

Calls 6

getBindingCppParamTypeFunction · 0.85
decomposeParamClassNameFunction · 0.85
WritelnMethod · 0.80
WritelnsMethod · 0.80

Tested by

no test coverage detected