当前位置: 首页>>代码示例>>Python>>正文


Python CursorKind.ENUM_CONSTANT_DECL属性代码示例

本文整理汇总了Python中clang.cindex.CursorKind.ENUM_CONSTANT_DECL属性的典型用法代码示例。如果您正苦于以下问题:Python CursorKind.ENUM_CONSTANT_DECL属性的具体用法?Python CursorKind.ENUM_CONSTANT_DECL怎么用?Python CursorKind.ENUM_CONSTANT_DECL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在clang.cindex.CursorKind的用法示例。


在下文中一共展示了CursorKind.ENUM_CONSTANT_DECL属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: element2kind

# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import ENUM_CONSTANT_DECL [as 别名]
def element2kind(self, element):
    if element.kind == CursorKind.STRUCT_DECL:
      return "struct"
    elif element.kind == CursorKind.ENUM_DECL:
      return "enum"
    elif element.kind == CursorKind.UNION_DECL:
      return "union"
    elif element.kind == CursorKind.TYPEDEF_DECL:
      return "typedef"
    elif element.kind == CursorKind.ENUM_CONSTANT_DECL:
      return ""
    else:
      return "" # Unknown thing 
开发者ID:joxeankoret,项目名称:pigaios,代码行数:15,代码来源:clang_exporter.py

示例2: parse_enum

# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import ENUM_CONSTANT_DECL [as 别名]
def parse_enum(self, cursor):
        name = cursor.spelling
        enum = model.EnumDecl(name=name)
        for child in cursor.get_children():
            if child.kind == CursorKind.ENUM_CONSTANT_DECL:
                value1 = child.enum_value
                enum_const = model.EnumConstant(name=child.spelling, value=value1)
                enum.add_constant(enum_const)
            else:
                self.report_unparsed(child)
        self.items.append(enum) 
开发者ID:cmbruns,项目名称:pyopenvr,代码行数:13,代码来源:parser.py

示例3: read_enum

# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import ENUM_CONSTANT_DECL [as 别名]
def read_enum(asg, cursor, scope):
    spelling = scope
    if spelling.startswith('class '):
        spelling = spelling[6:]
    elif spelling.startswith('struct '):
        spelling = spelling[7:]
    if not scope.endswith('::'):
        spelling = spelling + "::" + cursor.spelling
    else:
        spelling = spelling + cursor.spelling
    if cursor.spelling == '':
        children = []
        decls = []
        #if not spelling == '::':
        #    spelling = spelling[:-2]
        spelling = scope
        for child in cursor.get_children():
            if child.kind is CursorKind.ENUM_CONSTANT_DECL:
                children.extend(read_enum_constant(asg, child, spelling))
                decls.append(child)
        filename = str(Path(str(cursor.location.file)).abspath())
        asg.add_file(filename, proxy=HeaderProxy, _language=asg._language)
        for childspelling, child in zip(children, decls):
            asg._nodes[childspelling]['_header'] = filename
        read_access(asg, cursor.access_specifier, *children)
        return children
    else:
        spelling = 'enum ' + spelling
        if spelling not in asg:
            asg._syntax_edges[spelling] = []
            asg._nodes[spelling] = dict(_proxy = EnumerationProxy,
                                        _comment = "",
                                        _is_scoped = False) # TODO
            read_access(asg, cursor.access_specifier, spelling)
            asg._syntax_edges[scope].append(spelling)
        elif not asg[spelling].is_complete:
            asg._syntax_edges[scope].remove(spelling)
            asg._syntax_edges[scope].append(spelling)
        if not asg[spelling].is_complete:
            read_access(asg, cursor.access_specifier, spelling)
            for child in cursor.get_children():
                read_enum_constant(asg, child, spelling)
        if asg[spelling].is_complete:
            filename = str(Path(str(cursor.location.file)).abspath())
            asg.add_file(filename, proxy=HeaderProxy, _language=asg._language)
            asg._nodes[spelling]['_header'] = filename
        return [spelling] 
开发者ID:StatisKit,项目名称:AutoWIG,代码行数:49,代码来源:libclang_parser.py


注:本文中的clang.cindex.CursorKind.ENUM_CONSTANT_DECL属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。