def __init__(self, cursor, parentclass, of_root): DocBase.__init__(self, cursor, of_root) self.parentclass = parentclass self.data['name'] = re.sub("<.*>", "", self.data['name']) self.data['type'] = 'function' # Access self.data['access'] = cursor.access_specifier.name.lower() # Static self.data['static'] = cursor.is_static_method() # Returns if cursor.kind == CursorKind.CONSTRUCTOR or cursor.kind == CursorKind.DESTRUCTOR or ( not parentclass is None and self.data['name'] == parentclass.name): returns = "" else: returns = clang_utils.substitutetype(cursor.result_type.spelling) returns = ("" if returns is None else returns) self.data['returns'] = returns # parameters self.data['deprecated'] = False self.parse_parameters()
def __init__(self, cursor, parentclass, of_root): DocBase.__init__(self, cursor, of_root) self.parentclass = parentclass self.data['type'] = 'variable' # Access self.data['access'] = cursor.access_specifier.name.lower() self.data['constant'] = cursor.result_type.is_volatile_qualified() self.data['static'] = cursor.kind == CursorKind.VAR_DECL self.data['kind'] = clang_utils.substitutetype(cursor.type.spelling)
def __init__(self, cursor, of_root): DocBase.__init__(self, cursor, of_root) self.data["type"] = "enum" self.data["options"] = [] for c in cursor.get_children(): if c.kind == CursorKind.ENUM_CONSTANT_DECL: doc = clang_documentation_parser.parse_docs(c) if len(self.data["options"]) > 0 and self.data["options"][-1]["documentation"]["text"] == doc["text"]: doc["text"] = "" self.data["options"].append({"name": c.spelling, "value": c.enum_value, "documentation": doc})
def __init__(self, cursor, of_root): DocBase.__init__(self, cursor, of_root) self.data['type'] = 'enum' self.data['options'] = [] for c in cursor.get_children(): if c.kind == CursorKind.ENUM_CONSTANT_DECL: doc = clang_documentation_parser.parse_docs(c) if len(self.data['options']) > 0 and self.data['options'][-1]['documentation']['text'] == doc['text']: doc['text'] = '' self.data['options'].append({ 'name':c.spelling, 'value': c.enum_value, 'documentation': doc })
def __init__(self, cursor, of_root): DocBase.__init__(self, cursor, of_root) self.data['type'] = 'typedef' self.data['typedef_type'] = cursor.underlying_typedef_type.spelling
def __init__(self, cursor, of_root): DocBase.__init__(self, cursor, of_root) self.data["type"] = "typedef" self.data["typedef_type"] = cursor.underlying_typedef_type.spelling
def __init__(self, cursor, of_root): DocBase.__init__(self, cursor, of_root) self.data['type'] = 'class' # Parse extends self.data['extends'] = [] for child in cursor.get_children(): if child.kind == CursorKind.CXX_BASE_SPECIFIER: if child.spelling.find("class") == 0: baseclass = child.spelling.split(' ')[1] self.data['extends'].append(baseclass) else: self.data['extends'].append(child.spelling) # Parse member children self.member_variables = [] self.member_functions = [] for member in cursor.get_children(): # Struct decleration # TODO if member.kind == CursorKind.CLASS_DECL or member.kind == CursorKind.CLASS_TEMPLATE or member.kind == CursorKind.STRUCT_DECL: if member.access_specifier.name.lower() == 'public': for child in member.get_children(): if clang_utils.is_variable(child) or clang_utils.is_method(child): #print "MEMBER"+member.spelling """if classname[-1] == '_': serialize_class(member,is_addon,classname[:-1]) visited_classes.append(classname[:-1] + "::" + member.spelling) else: serialize_class(member,is_addon,classname) visited_classes.append(classname + "::" + member.spelling) break""" # Union decleration # TODO elif member.kind == CursorKind.UNION_DECL: for union_member in member.get_children(): """ if clang_utils.is_variable(union_member): #print "UNION "+union_member.spelling #var = parse_variable(documentation_class, clazz, union_member) #current_variables_list.append(var) if union_member.kind == CursorKind.STRUCT_DECL: for union_struct_member in union_member.get_children(): if clang_utils.is_variable(union_struct_member): #print "UNION "+union_struct_member.spelling #var = parse_variable(documentation_class, clazz, union_struct_member) #current_variables_list.append(var) """ elif clang_utils.is_variable(member): if member.access_specifier.name.lower() == 'public': var = DocVariable(member, self, of_root) self.member_variables.append(var) #f.write( str(member.type.text) + " " + str(member.name.text) + "\n" ) elif clang_utils.is_method(member): func = DocFunction(member, self, of_root) self.member_functions.append(func) """
def __init__(self, cursor, of_root): DocBase.__init__(self, cursor, of_root) self.data['type'] = 'class' # Parse extends self.data['extends'] = [] for child in cursor.get_children(): if child.kind == CursorKind.CXX_BASE_SPECIFIER: if child.spelling.find("class") == 0: baseclass = child.spelling.split(' ')[1] self.data['extends'].append(baseclass) else: self.data['extends'].append(child.spelling) # Parse member children self.member_variables = [] self.member_functions = [] for member in cursor.get_children(): # Struct decleration # TODO if member.kind == CursorKind.CLASS_DECL or member.kind == CursorKind.CLASS_TEMPLATE or member.kind == CursorKind.STRUCT_DECL: if member.access_specifier.name.lower() == 'public': for child in member.get_children(): if clang_utils.is_variable( child) or clang_utils.is_method(child): #print "MEMBER"+member.spelling """if classname[-1] == '_': serialize_class(member,is_addon,classname[:-1]) visited_classes.append(classname[:-1] + "::" + member.spelling) else: serialize_class(member,is_addon,classname) visited_classes.append(classname + "::" + member.spelling) break""" # Union decleration # TODO elif member.kind == CursorKind.UNION_DECL: for union_member in member.get_children(): """ if clang_utils.is_variable(union_member): #print "UNION "+union_member.spelling #var = parse_variable(documentation_class, clazz, union_member) #current_variables_list.append(var) if union_member.kind == CursorKind.STRUCT_DECL: for union_struct_member in union_member.get_children(): if clang_utils.is_variable(union_struct_member): #print "UNION "+union_struct_member.spelling #var = parse_variable(documentation_class, clazz, union_struct_member) #current_variables_list.append(var) """ elif clang_utils.is_variable(member): if member.access_specifier.name.lower() == 'public': var = DocVariable(member, self, of_root) self.member_variables.append(var) #f.write( str(member.type.text) + " " + str(member.name.text) + "\n" ) elif clang_utils.is_method(member): func = DocFunction(member, self, of_root) self.member_functions.append(func) """