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

Function outputenums

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

Source from the content-addressed store, hash-verified

295 return classname
296
297def outputenums(namespace, data):
298 for enum in data['enums']:
299 if(len(enum) > 0 and len(enum['enumname'])):
300 ns = getnamespace(enum['enumname'])
301 enumname = getclasswithoutnamespace(enum['enumname'])
302 if(ns == namespace or (namespace == '' and ns[:1] == 'I')):
303 print('public enum '+enumname+'\n{')
304 enumNameWithoutE = enumname
305 if( enumname.startswith( "E" ) ):
306 enumNameWithoutE = enumname[1:]
307 for enumvalue in enum['values']:
308 entry = enumvalue['name']
309 if(entry.startswith(enumname)): entry = entry[len(enumname):] # strip off enum name
310 if(entry.startswith(enumNameWithoutE)): entry = entry[len(enumNameWithoutE):] # strip off enum name
311 if(entry.startswith('_')): entry = entry[1:] # strip off leading underscore
312 print('\t'+entry+' = '+enumvalue['value']+',')
313 print('}')
314
315def outputstructfields(struct, data):
316

Callers

nothing calls this directly

Calls 2

getnamespaceFunction · 0.85
getclasswithoutnamespaceFunction · 0.85

Tested by

no test coverage detected