@@ -609,7 +609,7 @@ func buildDynamicCPPMethodDeclaration(method ComponentDefinitionMethod, NameSpac
609
609
}
610
610
611
611
func writeDynamicCPPMethod (component ComponentDefinition , method ComponentDefinitionMethod , w LanguageWriter , ClassIdentifier string , ClassName string ,
612
- implementationLines []string , isGlobal bool , includeComments bool , checkErrorSafely bool , useCPPTypes bool , ExplicitLinking bool ) error {
612
+ implementationLines []string , isGlobal bool , includeComments bool , checkErrorSafely bool , useCPPTypes bool , ExplicitLinking bool , isAbstract bool ) error {
613
613
NameSpace := component .NameSpace
614
614
615
615
CMethodName := ""
@@ -868,6 +868,10 @@ func writeDynamicCPPMethod(component ComponentDefinition, method ComponentDefini
868
868
869
869
w .Writeln (" {" )
870
870
w .Writelns (" " , definitionCodeLines )
871
+ if isAbstract {
872
+ w .Writeln (" if (!%s)" , CMethodName )
873
+ w .Writeln (" throw E%sException(%s_ERROR_NOTIMPLEMENTED, \" Method '%s' not found\" );" , NameSpace , strings .ToUpper (NameSpace ), method .MethodName )
874
+ }
871
875
if requiresInitCall {
872
876
w .Writeln (" %s%s(%s)%s;" , checkErrorCodeBegin , CMethodName , initCallParameters , checkErrorCodeEnd )
873
877
}
@@ -903,8 +907,12 @@ func writeLoadingOfClassFunctionTable(component ComponentDefinition, stubfile La
903
907
904
908
for k := 0 ; k < len (class .Methods ); k ++ {
905
909
method := class .Methods [k ]
910
+ readMethod := "readMethodInto"
911
+ if (class .IsAbstract ()) {
912
+ readMethod = "readAbstractMethodInto"
913
+ }
906
914
CMethodName := strings .ToLower (fmt .Sprintf ("%s_%s_%s" , NameSpace , class .ClassName , method .MethodName ));
907
- stubfile .Writeln (" %s::readMethodInto (pLookupFunction, \" %s\" , (void**)&(%s->m_%s_%s));" , WrapperName , CMethodName , sTableName , class .ClassName , method .MethodName );
915
+ stubfile .Writeln (" %s::%s (pLookupFunction, \" %s\" , (void**)&(%s->m_%s_%s));" , WrapperName , readMethod , CMethodName , sTableName , class .ClassName , method .MethodName );
908
916
}
909
917
}
910
918
@@ -1413,6 +1421,13 @@ func buildCppHeader(component ComponentDefinition, w LanguageWriter, NameSpace s
1413
1421
w .Writeln (" }" )
1414
1422
w .Writeln ("" )
1415
1423
1424
+ w .Writeln (" static void readAbstractMethodInto(%sSymbolLookupType pLookupMethod, std::string sFunctionName, void** pfnTarget) {" , NameSpace )
1425
+ w .Writeln (" %sResult eLookupError = (*pLookupMethod)(sFunctionName.c_str(), pfnTarget);" , NameSpace );
1426
+ w .Writeln (" if (eLookupError != %s_SUCCESS)" , strings .ToUpper (NameSpace ))
1427
+ w .Writeln (" *pfnTarget = 0;" )
1428
+ w .Writeln (" }" )
1429
+ w .Writeln ("" )
1430
+
1416
1431
1417
1432
for i := 0 ; i < len (component .Classes ); i ++ {
1418
1433
class := component .Classes [i ]
@@ -1510,7 +1525,7 @@ func buildCppHeader(component ComponentDefinition, w LanguageWriter, NameSpace s
1510
1525
checkErrorSafely = true
1511
1526
}
1512
1527
1513
- err = writeDynamicCPPMethod (component , method , w , ClassIdentifier , "Wrapper" , implementationLines , true , true , checkErrorSafely , useCPPTypes , ExplicitLinking )
1528
+ err = writeDynamicCPPMethod (component , method , w , ClassIdentifier , "Wrapper" , implementationLines , true , true , checkErrorSafely , useCPPTypes , ExplicitLinking , false )
1514
1529
if err != nil {
1515
1530
return err
1516
1531
}
@@ -1599,7 +1614,7 @@ func buildCppHeader(component ComponentDefinition, w LanguageWriter, NameSpace s
1599
1614
checkErrorSafely = true
1600
1615
}
1601
1616
1602
- err := writeDynamicCPPMethod (component , method , w , ClassIdentifier , class .ClassName , make ([]string ,0 ), false , true , checkErrorSafely , useCPPTypes , ExplicitLinking )
1617
+ err := writeDynamicCPPMethod (component , method , w , ClassIdentifier , class .ClassName , make ([]string ,0 ), false , true , checkErrorSafely , useCPPTypes , ExplicitLinking , class . IsAbstract () )
1603
1618
if err != nil {
1604
1619
return err
1605
1620
}
0 commit comments