本文整理匯總了Python中generator.OutputGenerator.genStruct方法的典型用法代碼示例。如果您正苦於以下問題:Python OutputGenerator.genStruct方法的具體用法?Python OutputGenerator.genStruct怎麽用?Python OutputGenerator.genStruct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類generator.OutputGenerator
的用法示例。
在下文中一共展示了OutputGenerator.genStruct方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: genStruct
# 需要導入模塊: from generator import OutputGenerator [as 別名]
# 或者: from generator.OutputGenerator import genStruct [as 別名]
def genStruct(self, typeinfo, typeName, alias):
OutputGenerator.genStruct(self, typeinfo, typeName, alias)
typeElem = typeinfo.elem
if alias:
body = 'typedef ' + alias + ' ' + typeName + ';\n'
else:
body = ''
(protect_begin, protect_end) = self.genProtectString(typeElem.get('protect'))
if protect_begin:
body += protect_begin
body += 'typedef ' + typeElem.get('category')
# This is an OpenXR-specific alternative where aliasing refers
# to an inheritance hierarchy of types rather than C-level type
# aliases.
if self.genOpts.genAliasMacro and self.typeMayAlias(typeName):
body += ' ' + self.genOpts.aliasMacro
body += ' ' + typeName + ' {\n'
targetLen = 0
for member in typeElem.findall('.//member'):
targetLen = max(targetLen, self.getCParamTypeLength(member))
for member in typeElem.findall('.//member'):
body += self.makeCParamDecl(member, targetLen + 4)
body += ';\n'
body += '} ' + typeName + ';\n'
if protect_end:
body += protect_end
self.appendSection('struct', body)
示例2: genStruct
# 需要導入模塊: from generator import OutputGenerator [as 別名]
# 或者: from generator.OutputGenerator import genStruct [as 別名]
def genStruct(self, typeinfo, typeName, alias):
OutputGenerator.genStruct(self, typeinfo, typeName, alias)
if alias:
# Add name -> alias mapping
self.addName(self.alias, typeName, alias)
else:
# May want to only emit definition on this branch
True
members = [member.text for member in typeinfo.elem.findall('.//member/name')]
self.structs[typeName] = members
memberTypes = [member.text for member in typeinfo.elem.findall('.//member/type')]
for member_type in memberTypes:
self.addMapping(typeName, member_type)
示例3: genStruct
# 需要導入模塊: from generator import OutputGenerator [as 別名]
# 或者: from generator.OutputGenerator import genStruct [as 別名]
def genStruct(self, typeinfo, typeName, alias):
OutputGenerator.genStruct(self, typeinfo, typeName, alias)
typeElem = typeinfo.elem
if alias:
body = 'typedef ' + alias + ' ' + typeName + ';\n'
else:
body = 'typedef ' + typeElem.get('category') + ' ' + typeName + ' {\n'
targetLen = 0
for member in typeElem.findall('.//member'):
targetLen = max(targetLen, self.getCParamTypeLength(member))
for member in typeElem.findall('.//member'):
body += self.makeCParamDecl(member, targetLen + 4)
body += ';\n'
body += '} ' + typeName + ';'
self.writeInclude('structs', typeName, body)