本文整理汇总了Python中generator.OutputGenerator.genCmd方法的典型用法代码示例。如果您正苦于以下问题:Python OutputGenerator.genCmd方法的具体用法?Python OutputGenerator.genCmd怎么用?Python OutputGenerator.genCmd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类generator.OutputGenerator
的用法示例。
在下文中一共展示了OutputGenerator.genCmd方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: genCmd
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import genCmd [as 别名]
def genCmd(self, cmdinfo, name, alias):
OutputGenerator.genCmd(self, cmdinfo, name, alias)
# @@@ (Jon) something needs to be done here to handle aliases, probably
self.makeThreadSafetyBlocks(cmdinfo.elem, 'param')
self.writeInclude()
示例2: genCmd
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import genCmd [as 别名]
def genCmd(self, cmdinfo, name, alias):
OutputGenerator.genCmd(self, cmdinfo, name, alias)
# if alias:
# prefix = '// ' + name + ' is an alias of command ' + alias + '\n'
# else:
# prefix = ''
prefix = ''
decls = self.makeCDecls(cmdinfo.elem)
self.appendSection('command', prefix + decls[0] + '\n')
if self.genOpts.genFuncPointers:
self.appendSection('commandPointer', decls[1])
示例3: genCmd
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import genCmd [as 别名]
def genCmd(self, cmdinfo, name, alias):
OutputGenerator.genCmd(self, cmdinfo, name, alias)
return_type = cmdinfo.elem.find('proto/type')
if self.genOpts.conventions.requires_error_validation(return_type):
# This command returns an API result code, so check that it
# returns at least the required errors.
required_errors = self.genOpts.conventions.required_errors
errorcodes = cmdinfo.elem.get('errorcodes').split(',')
if not required_errors.issubset(set(errorcodes)):
self.logMsg('error', 'Missing required error code for command: ', name, '\n')
exit(1)
decls = self.makeCDecls(cmdinfo.elem)
self.writeInclude('protos', name, decls[0])
示例4: genCmd
# 需要导入模块: from generator import OutputGenerator [as 别名]
# 或者: from generator.OutputGenerator import genCmd [as 别名]
def genCmd(self, cmdinfo, name, alias):
OutputGenerator.genCmd(self, cmdinfo, name, alias)
if alias:
# Add name -> alias mapping
self.addName(self.alias, name, alias)
else:
# May want to only emit definition on this branch
True
# Add a typeCategory{} entry for the category of this type.
self.addName(self.typeCategory, name, 'protos')
params = [param.text for param in cmdinfo.elem.findall('param/name')]
self.protos[name] = params
paramTypes = [param.text for param in cmdinfo.elem.findall('param/type')]
for param_type in paramTypes:
self.addMapping(name, param_type)