本文整理汇总了Python中generator.OutputGenerator.genGroup方法的典型用法代码示例。如果您正苦于以下问题:Python OutputGenerator.genGroup方法的具体用法?Python OutputGenerator.genGroup怎么用?Python OutputGenerator.genGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类generator.OutputGenerator
的用法示例。
在下文中一共展示了OutputGenerator.genGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: genGroup
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import genGroup [as 别名]
def genGroup(self, groupinfo, groupName, alias):
OutputGenerator.genGroup(self, groupinfo, groupName, alias)
if alias:
# If the group name is aliased, just emit a typedef declaration
# for the alias.
body = 'typedef ' + alias + ' ' + groupName + ';\n'
else:
expand = self.genOpts.expandEnumerants
(_, body) = self.buildEnumCDecl(expand, groupinfo, groupName)
self.writeInclude('enums', groupName, body)
示例2: genGroup
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import genGroup [as 别名]
def genGroup(self, groupinfo, groupName, alias):
OutputGenerator.genGroup(self, groupinfo, groupName, alias)
groupElem = groupinfo.elem
if alias:
# Add name -> alias mapping
self.addName(self.alias, groupName, alias)
else:
# May want to only emit definition on this branch
True
# Loop over the nested 'enum' tags.
enumerants = [elem.get('name') for elem in groupElem.findall('enum')]
for name in enumerants:
self.addName(self.consts, name, groupName)
self.enums[groupName] = enumerants
示例3: genGroup
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import genGroup [as 别名]
def genGroup(self, groupinfo, groupName, alias = None):
OutputGenerator.genGroup(self, groupinfo, groupName, alias)
groupElem = groupinfo.elem
# After either enumerated type or alias paths, add the declaration
# to the appropriate section for the group being defined.
if groupElem.get('type') == 'bitmask':
section = 'bitmask'
else:
section = 'group'
if alias:
# If the group name is aliased, just emit a typedef declaration
# for the alias.
body = 'typedef ' + alias + ' ' + groupName + ';\n'
self.appendSection(section, body)
else:
(section, body) = self.buildEnumCDecl(self.genOpts.genEnumBeginEndRange, groupinfo, groupName)
self.appendSection(section, "\n" + body)