本文整理汇总了Python中clang.cindex.CursorKind.FIELD_DECL属性的典型用法代码示例。如果您正苦于以下问题:Python CursorKind.FIELD_DECL属性的具体用法?Python CursorKind.FIELD_DECL怎么用?Python CursorKind.FIELD_DECL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类clang.cindex.CursorKind
的用法示例。
在下文中一共展示了CursorKind.FIELD_DECL属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_copenvrcontext
# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import FIELD_DECL [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_
示例2: read_cursor
# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import FIELD_DECL [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 []
示例3: get_field
# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import FIELD_DECL [as 别名]
def get_field(self, element):
type_name = element.type.spelling
elem_name = self.clean_name(element.spelling)
kind = self.element2kind(element)
is_anon = type_name.find("(anonymous ") > -1
if is_anon:
type_name = kind
ret = []
ret.append(type_name)
if elem_name == "" and not elem_name.startswith(kind) and not is_anon:
ret.insert(0, self.element2kind(element))
children = list(element.get_children())
if len(children) > 0: ret.append("{")
for field in children:
if field.kind == CursorKind.FIELD_DECL:
field_name = field.spelling
type_name = field.type.spelling
if type_name.find("(anonymous ") > -1:
type_name = ""
pos = type_name.find("[")
if pos > -1:
ret.append(type_name[:pos] + field_name + type_name[pos:] + ";")
else:
ret.append("%s %s;" % (type_name, field_name))
else:
name, src = self.get_field(field)
ret.append(src)
if len(children) > 0:
ret.append("}")
if not is_anon:
ret.append(";")
ret = "\n".join(ret)
return elem_name, ret
示例4: parse_ivrclass
# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import FIELD_DECL [as 别名]
def parse_ivrclass(self, cursor):
name = cursor.type.spelling
class_ = model.IVRClass(name=name, docstring=clean_comment(cursor))
for child in cursor.get_children():
if child.kind == CursorKind.CXX_METHOD:
method = self.parse_method(child)
class_.add_method(method)
elif child.kind == CursorKind.CXX_ACCESS_SPEC_DECL:
continue # no such thing in python
elif child.kind == CursorKind.FIELD_DECL:
print(f'*** WARNING *** skipping class member {cursor.spelling}::{child.spelling}')
continue
else:
self.report_unparsed(child)
return class_
示例5: parse_struct
# 需要导入模块: from clang.cindex import CursorKind [as 别名]
# 或者: from clang.cindex.CursorKind import FIELD_DECL [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