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


Python CursorKind.CONSTRUCTOR属性代码示例

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


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

示例1: parse_copenvrcontext

# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import CONSTRUCTOR [as 别名]
def parse_copenvrcontext(self, cursor):
        name = cursor.type.spelling
        class_ = model.COpenVRContext(name=name, docstring=clean_comment(cursor))
        for child in cursor.get_children():
            if child.kind == CursorKind.CXX_ACCESS_SPEC_DECL:
                continue  # no such thing in python
            elif child.kind == CursorKind.CONSTRUCTOR:
                continue  # I will translate this manually
            elif child.kind == CursorKind.CXX_METHOD:
                if child.spelling == 'Clear':
                    continue  # I will translate this manually
                elif child.spelling == 'CheckClear':
                    continue  # I will translate this manually
                elif child.spelling.startswith('VR'):
                    class_.add_vr_method_name(child.spelling)
                else:
                    self.report_unparsed(child)
            elif child.kind == CursorKind.FIELD_DECL:
                if child.spelling.startswith('m_pVR'):
                    class_.add_vr_member_name(child.spelling)
                else:
                    self.report_unparsed(child)
            else:
                self.report_unparsed(child)
        return class_ 
开发者ID:cmbruns,项目名称:pyopenvr,代码行数:27,代码来源:parser.py

示例2: read_cursor

# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import CONSTRUCTOR [as 别名]
def read_cursor(asg, cursor, scope):
    if cursor.kind is CursorKind.UNEXPOSED_DECL:
        if cursor.spelling == '':
            children = []
            for child in cursor.get_children():
                children.extend(read_cursor(asg, child, scope))
            return children
        else:
            warnings.warn('Named unexposed cursor not read')
            return []
    elif cursor.kind is CursorKind.TYPEDEF_DECL:
        return read_typedef(asg, cursor, scope)
    elif cursor.kind in [CursorKind.VAR_DECL, CursorKind.PARM_DECL]:
        return read_variable(asg, cursor, scope)
    elif cursor.kind in [CursorKind.FUNCTION_DECL, CursorKind.CXX_METHOD,
            CursorKind.DESTRUCTOR, CursorKind.CONSTRUCTOR]:
        return read_function(asg, cursor, scope)
    elif cursor.kind is CursorKind.FIELD_DECL:
        return read_field(asg, cursor, scope)
    elif cursor.kind in [CursorKind.ENUM_DECL, CursorKind.STRUCT_DECL,
            CursorKind.UNION_DECL, CursorKind.CLASS_DECL]:
        return read_tag(asg, cursor, scope)
    elif cursor.kind is CursorKind.NAMESPACE:
        return read_namespace(asg, cursor, scope)
    elif cursor.kind in [CursorKind.NAMESPACE_ALIAS, CursorKind.FUNCTION_TEMPLATE,
            CursorKind.USING_DECLARATION, CursorKind.USING_DIRECTIVE,
            CursorKind.UNEXPOSED_ATTR, CursorKind.CLASS_TEMPLATE,
            CursorKind.CLASS_TEMPLATE_PARTIAL_SPECIALIZATION,
            CursorKind.CXX_ACCESS_SPEC_DECL, CursorKind.CONVERSION_FUNCTION]:
        return []
    else:
        warnings.warn('Undefined behaviour for \'' + str(cursor.kind) + '\' cursor')
        return [] 
开发者ID:StatisKit,项目名称:AutoWIG,代码行数:35,代码来源:libclang_parser.py

示例3: parse_struct

# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import CONSTRUCTOR [as 别名]
def parse_struct(self, cursor):
        name = cursor.type.spelling
        struct = model.Struct(name=name, docstring=clean_comment(cursor))
        for child in cursor.get_children():
            if child.kind == CursorKind.FIELD_DECL:
                field = self.parse_field(child)
                struct.add_field(field)
            elif child.kind == CursorKind.CXX_BASE_SPECIFIER:
                struct.base = child.spelling
            elif child.kind == CursorKind.CONSTRUCTOR:
                print(f'*** WARNING *** skipping constructor for struct {cursor.spelling}')
            else:
                self.report_unparsed(child)
        return struct 
开发者ID:cmbruns,项目名称:pyopenvr,代码行数:16,代码来源:parser.py

示例4: read_function

# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import CONSTRUCTOR [as 别名]
def read_function(asg, cursor, scope):
    spelling = scope
    if spelling.startswith('class '):
        spelling = spelling[6:]
    elif spelling.startswith('union '):
        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.kind in [CursorKind.DESTRUCTOR, CursorKind.CXX_METHOD, CursorKind.CONSTRUCTOR] and cursor.lexical_parent.kind is CursorKind.NAMESPACE:
        return []
    else:
        if cursor.kind is not CursorKind.DESTRUCTOR:
            spelling = spelling + '::' + str(uuid.uuid4())
        if cursor.kind is CursorKind.FUNCTION_DECL:
            asg._nodes[spelling] = dict(_proxy=FunctionProxy,
                                        _comment="")
            if cursor.location is not None:
                filename = str(Path(str(cursor.location.file)).abspath())
                asg.add_file(filename, proxy=HeaderProxy, _language=asg._language)
                asg._nodes[spelling]['_header'] = filename
        elif cursor.kind is CursorKind.CXX_METHOD:
            asg._nodes[spelling] = dict(_proxy=MethodProxy,
                    _is_static=cursor.is_static_method(),
                    _is_volatile=False,
                    _is_virtual=True,
                    _is_const=cursor.is_const_method(),
                    _is_pure=True,
                    _comment="")
        elif cursor.kind is CursorKind.CONSTRUCTOR:
            asg._nodes[spelling] = dict(_proxy=ConstructorProxy,
                     _is_virtual=False, #TODO
                     _comment="")
        else:
            asg._nodes[spelling] = dict(_proxy=DestructorProxy,
                    is_virtual=True,
                    _comment="")
        asg._parameter_edges[spelling] = []
        asg._syntax_edges[scope].append(spelling)
        try:
            with warnings.catch_warnings():
                warnings.simplefilter("error")
                if cursor.kind in [CursorKind.FUNCTION_DECL, CursorKind.CXX_METHOD]:
                    target, specifiers = read_qualified_type(asg, cursor.result_type)
                    asg._type_edges[spelling] = dict(target=target, qualifiers=specifiers)
                for child in [child for child in cursor.get_children() if child.kind is CursorKind.PARM_DECL]:
                    target, specifiers = read_qualified_type(asg, child.type)
                    asg._parameter_edges[spelling].append(dict(name = child.spelling, target=target, qualifiers=specifiers))
        except Warning as warning:
            asg._syntax_edges[scope].remove(spelling)
            asg._type_edges.pop(spelling, None)
            asg._parameter_edges.pop(spelling, None)
            asg._nodes.pop(spelling)
            warnings.warn(str(warning), warning.__class__)
            return []
        else:
            read_access(asg, cursor.access_specifier, spelling)
            return [spelling] 
开发者ID:StatisKit,项目名称:AutoWIG,代码行数:63,代码来源:libclang_parser.py


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