MCPcopy Create free account
hub / github.com/ValveSoftware/openvr / outputfntables

Function outputfntables

codegen/api_shared.py:539–578  ·  view source on GitHub ↗
(namespace, data)

Source from the content-addressed store, hash-verified

537
538
539def outputfntables(namespace, data):
540 lastclass = ''
541 lastmethod = ''
542 for method in data['methods']:
543 if (len(method) > 0):
544 returntype = method['returntype']
545 if(returntype == 'class CSteamID'):
546 returntype = 'uint64'
547 methodname = method['methodname']
548 if(methodname == lastmethod):
549 methodname = methodname + repr(count)
550 count = count + 1
551 else:
552 count = 0
553 lastmethod = method['methodname']
554
555 classname = method['classname']
556
557 if(namespace != getnamespace(classname)):
558 continue
559
560 classname = getclasswithoutnamespace(classname)
561 if(classname != lastclass):
562 if(lastclass != ''):
563 print("};\n");
564
565 fntablename = method['classname'].replace('vr::', 'VR::').replace('::', '_') + '_FnTable'
566 print("struct " + fntablename + "\n{")
567 lastclass = classname
568
569 sys.stdout.write ('\t'+ ctype(returntype) + ' (OPENVR_FNTABLE_CALLTYPE *' + methodname + ')')
570
571 paramlist = []
572 if('params' in method):
573 for param in method['params']:
574 paramlist.append(ctype(param['paramtype']) + ' ' + param['paramname'])
575
576 print('('+", ".join(paramlist)+");")
577
578 print("};\n");
579
580def outputfntabledecls(namespace, data):
581 lastclass = ''

Callers

nothing calls this directly

Calls 4

getnamespaceFunction · 0.85
getclasswithoutnamespaceFunction · 0.85
ctypeFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected