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

Function OutputStructFields

codegen/openvr_capi.h.py:98–121  ·  view source on GitHub ↗
(struct)

Source from the content-addressed store, hash-verified

96namespace = 'vr'
97
98def OutputStructFields(struct):
99
100 # recursively add base class fields first
101 basename = getclasswithoutnamespace(struct['struct'])
102 if basename in structparents:
103 parentname = structparents[basename]
104 i = structindices[parentname];
105 OutputStructFields(data['structs'][i])
106
107 for enumvalue in struct['fields']:
108 fieldtype = enumvalue['fieldtype']
109 otype = striparraysuffix(fieldtype)
110 lastchar = fieldtype[len(fieldtype) - 1]
111 if(lastchar == ']'):
112 #print('\t//fixed '+otype+' '+enumvalue['fieldname']+ fieldtype[fieldtype.find('['):]+';')
113 dims = map(int, fieldtype[fieldtype.find('[')+1:-1].split(']['))
114 size = reduce(operator.mul, dims, 1)
115 utype = unmanagedtype(otype)
116 print('\t'+('char ' if(otype=='char') else ctype(otype)+' ')+enumvalue['fieldname']+ fieldtype[fieldtype.find('['):]+'; //'+otype+fieldtype[fieldtype.find('['):])
117 else:
118 if(lastchar == '*'):
119 print('\t'+ctype(fieldtype)+' '+enumvalue['fieldname']+';'+' // '+fieldtype)
120 else:
121 print('\t'+ctype(otype)+' '+enumvalue['fieldname']+';')
122
123########
124# Output constants into OpenVR class

Callers 1

openvr_capi.h.pyFile · 0.85

Calls 5

getclasswithoutnamespaceFunction · 0.85
striparraysuffixFunction · 0.85
unmanagedtypeFunction · 0.85
ctypeFunction · 0.85
findMethod · 0.80

Tested by

no test coverage detected