示例#1
0
def serialize_class(filename):
    xml = objectify.parse(filename)
    doxygen = xml.getroot()

    clazz = doxygen.compounddef
    docs_class = getclass(clazz.compoundname.text)
    
    #f = open('docs/' + classname + ".html.mako",'w')
    
    #index.write("[" + classname + "](" + classname + ".html)\n\n")
    
    #f.write( '<%inherit file="_templates/docs.mako" />\n' )
    #f.write( '___' + classname + "___\n" )
    
    inheritsfrom = []
    if clazz.find('derivedcompoundref')!=None:
        inheritsfrom = clazz.derivedcompoundref


    if clazz.find('sectiondef')!=None:
        for section in clazz.sectiondef:
            for member in section.memberdef:
                #if section.get("kind") == public TODO: access, virtual, pure virtual
                if member.get("kind") == 'enum':
                    pass
                else:
                    #f.write( "$$code(lang=c++)\n" )
                    if member.get("kind") == 'variable':
                        var = docs_class.var_by_name(member.name.text)
                        if not var:
                            var = DocsVar(0)
                            var.name = member.name.text
                            var.access = member.get("prot")
                            var.version_started = currentversion
                            var.version_deprecated = ""
                            var.constant = member.get("mutable")=="no"
                            var.static = member.get("static")
                            var.clazz = docs_class.name
                            var.type = member.type.ref.text if hasattr(member.type,'ref') else member.type.text
                            docs_class.var_list.append(var)
                        #f.write( str(member.type.text) + " " + str(member.name.text) + "\n" )
                    if member.get("kind") == 'function':
                        argstring = str(member.argsstring.text)
                        params = argstring[argstring.find('(')+1:argstring.rfind(')')]
                        returns = member.type.ref.text if hasattr(member.type,'ref') else member.type.text
                        returns = ("" if returns is None else returns)
                        method = docs_class.function_by_signature(member.name.text, returns, params)
                        method.static = member.get("static")
                        method.clazz = docs_class.name
                        method.access = member.get("prot")
                        method.returns = returns
                        if method.new:
                            method.version_started = currentversion
                        #f.write( str(member.type.text) + " " + str(member.name.text) + str(member.argsstring.text) + "\n" )
                    #f.write( "$$/code\n\n\n\n" )
    
    #f.close()
    setclass(docs_class)
示例#2
0
def serialize_class(filename):
    xml = objectify.parse(filename)
    doxygen = xml.getroot()

    clazz = doxygen.compounddef
    docs_class = getclass(clazz.compoundname.text)

    inheritsfrom = []
    if clazz.find('derivedcompoundref') != None:
        inheritsfrom = clazz.derivedcompoundref

    if clazz.find('sectiondef') != None:
        for section in clazz.sectiondef:
            for member in section.memberdef:
                if member.get("kind") == 'enum':
                    pass
                else:
                    if member.get("kind") == 'variable':
                        var = docs_class.var_by_name(member.name.text)
                        if not var:
                            var = DocsVar(0)
                            var.name = member.name.text
                            var.access = member.get("prot")
                            var.version_started = currentversion
                            var.version_deprecated = ""
                            var.constant = member.get("mutable") == "no"
                            var.static = member.get("static")
                            var.clazz = docs_class.name
                            var.type = member.type.ref.text if hasattr(
                                member.type, 'ref') else member.type.text
                            docs_class.var_list.append(var)
                    if member.get("kind") == 'function':
                        argstring = str(member.argsstring.text)
                        params = argstring[argstring.find('(') +
                                           1:argstring.rfind(')')]
                        returns = member.type.ref.text if hasattr(
                            member.type, 'ref') else member.type.text
                        returns = ("" if returns is None else returns)
                        method = docs_class.function_by_signature(
                            member.name.text, returns, params)
                        method.static = member.get("static")
                        method.clazz = docs_class.name
                        method.access = member.get("prot")
                        method.returns = returns
                        if method.new:
                            method.version_started = currentversion

    setclass(docs_class)
示例#3
0
def serialize_class(filename):
    xml = objectify.parse(filename)
    doxygen = xml.getroot()

    clazz = doxygen.compounddef
    docs_class = getclass(clazz.compoundname.text)
    
    inheritsfrom = []
    if clazz.find('derivedcompoundref')!=None:
        inheritsfrom = clazz.derivedcompoundref


    if clazz.find('sectiondef')!=None:
        for section in clazz.sectiondef:
            for member in section.memberdef:
                if member.get("kind") == 'enum':
                    pass
                else:
                    if member.get("kind") == 'variable':
                        var = docs_class.var_by_name(member.name.text)
                        if not var:
                            var = DocsVar(0)
                            var.name = member.name.text
                            var.access = member.get("prot")
                            var.version_started = currentversion
                            var.version_deprecated = ""
                            var.constant = member.get("mutable")=="no"
                            var.static = member.get("static")
                            var.clazz = docs_class.name
                            var.type = member.type.ref.text if hasattr(member.type,'ref') else member.type.text
                            docs_class.var_list.append(var)
                    if member.get("kind") == 'function':
                        argstring = str(member.argsstring.text)
                        params = argstring[argstring.find('(')+1:argstring.rfind(')')]
                        returns = member.type.ref.text if hasattr(member.type,'ref') else member.type.text
                        returns = ("" if returns is None else returns)
                        method = docs_class.function_by_signature(member.name.text, returns, params)
                        method.static = member.get("static")
                        method.clazz = docs_class.name
                        method.access = member.get("prot")
                        method.returns = returns
                        if method.new:
                            method.version_started = currentversion
    
    setclass(docs_class)
示例#4
0
def getclass(clazz):
    method = DocsMethod(0)
    var = DocsVar(0)
    docs_clazz = DocsClass(0)
    var.clazz  = clazz
    docs_clazz.name = clazz
    docs_clazz.new = True
    for root, dirs, files in os.walk(os.path.join(docs_root)):
        for name in files:
            file_split = os.path.splitext(name)
            if file_split[1]=='.markdown' and file_split[0] == clazz: 
                f = open(os.path.join(root,name),'r')
                state = 'begin'
                for line in f:
                    if state == 'begin' and line.find('#class') == 0 and line.find(clazz)!=-1:
                        state = 'class'
                        docs_clazz.module = os.path.basename(root)
                        docs_clazz.new = False
                        
                    elif state == 'class' and line.rstrip('\n').rstrip(' ') == '##Methods':
                        state = 'methods'
                        
                    elif state == 'methods' and line.find('###') == 0:
                        #print "##########method: " + line
                        state = 'method'
                        
                    elif state == 'method' and line.find('_')==0 and line.find('_description')==-1:
                        #print "##########field: " + line
                        addfield(method,line)
                        
                    elif state == 'method' and line.find('_description')==0:
                        state = 'description'
                        
                    elif state == 'description' and line.find('##')!=0:
                        method.description = method.description + line
                        
                    elif state == 'description' and line.find('###') == 0:
                        state = 'method'
                        docs_clazz.function_list.append(method)
                        method = DocsMethod(0)
                        method.clazz  = docs_clazz.name
                        
                    elif state == 'description' and line.rstrip('\n').rstrip(' ') == '##Variables':
                        docs_clazz.function_list.append(method)
                        state = 'vars'
                        
                    elif state == 'vars' and line.find('###') == 0:
                        #print line
                        state = 'var'
                        
                    elif state == 'var' and line.find('_')==0 and line.find('_description')==-1:
                        addfield(var,line)
                        
                    elif state == 'var' and line.find('_description') == 0:
                        state = 'vardescription'
                        
                    elif state == 'vardescription' and line.find('##')!=0:
                        var.description = var.description + line
                        
                    elif state == 'vardescription' and line.find('###') == 0:
                        #print line
                        state = 'var'
                        docs_clazz.var_list.append(var)
                        var = DocsVar(0)
                        var.clazz  = docs_clazz.name
                        
                    elif state == 'class' and line.find('##Description')==-1:
                        docs_clazz.reference  = docs_clazz.reference + line
                        
                if state == 'vardescription':
                    docs_clazz.var_list.append(var)
                f.close()
                return docs_clazz   


    return docs_clazz
示例#5
0
def serialize_class(filename):
    xml = objectify.parse(filename)
    doxygen = xml.getroot()

    clazz = doxygen.compounddef
    docs_class = getclass(clazz.compoundname.text)

    #f = open('docs/' + classname + ".html.mako",'w')

    #index.write("[" + classname + "](" + classname + ".html)\n\n")

    #f.write( '<%inherit file="_templates/docs.mako" />\n' )
    #f.write( '___' + classname + "___\n" )

    inheritsfrom = []
    if clazz.find('derivedcompoundref') != None:
        inheritsfrom = clazz.derivedcompoundref

    if clazz.find('sectiondef') != None:
        for section in clazz.sectiondef:
            for member in section.memberdef:
                #if section.get("kind") == public TODO: access, virtual, pure virtual
                if member.get("kind") == 'enum':
                    pass
                else:
                    #f.write( "$$code(lang=c++)\n" )
                    if member.get("kind") == 'variable':
                        var = docs_class.var_by_name(member.name.text)
                        if not var:
                            var = DocsVar(0)
                            var.name = member.name.text
                            var.access = member.get("prot")
                            var.version_started = currentversion
                            var.version_deprecated = ""
                            var.constant = member.get("mutable") == "no"
                            var.static = member.get("static")
                            var.clazz = docs_class.name
                            var.type = member.type.ref.text if hasattr(
                                member.type, 'ref') else member.type.text
                            docs_class.var_list.append(var)
                        #f.write( str(member.type.text) + " " + str(member.name.text) + "\n" )
                    if member.get("kind") == 'function':
                        argstring = str(member.argsstring.text)
                        params = argstring[argstring.find('(') +
                                           1:argstring.rfind(')')]
                        returns = member.type.ref.text if hasattr(
                            member.type, 'ref') else member.type.text
                        returns = ("" if returns is None else returns)
                        method = docs_class.function_by_signature(
                            member.name.text, returns, params)
                        method.static = member.get("static")
                        method.clazz = docs_class.name
                        method.access = member.get("prot")
                        method.returns = returns
                        if method.new:
                            method.version_started = currentversion
                        #f.write( str(member.type.text) + " " + str(member.name.text) + str(member.argsstring.text) + "\n" )
                    #f.write( "$$/code\n\n\n\n" )

    #f.close()
    setclass(docs_class)
示例#6
0
def getclass(clazz):
    method = DocsMethod(0)
    var = DocsVar(0)
    docs_clazz = DocsClass(0)
    var.clazz = clazz
    docs_clazz.name = clazz
    docs_clazz.new = True
    for root, dirs, files in os.walk(os.path.join(docs_root)):
        for name in files:
            file_split = os.path.splitext(name)
            if file_split[1] == '.markdown' and file_split[0] == clazz:
                f = open(os.path.join(root, name), 'r')
                state = 'begin'
                for line in f:
                    if state == 'begin' and line.find(
                            '#class') == 0 and line.find(clazz) != -1:
                        state = 'class'
                        docs_clazz.module = os.path.basename(root)
                        docs_clazz.new = False

                    elif state == 'class' and line.rstrip('\n').rstrip(
                            ' ') == '##Methods':
                        state = 'methods'

                    elif state == 'methods' and line.find('###') == 0:
                        #print "##########method: " + line
                        state = 'method'

                    elif state == 'method' and line.find(
                            '_') == 0 and line.find('_description') == -1:
                        #print "##########field: " + line
                        addfield(method, line)

                    elif state == 'method' and line.find('_description') == 0:
                        state = 'description'

                    elif state == 'description' and line.find('##') != 0:
                        method.description = method.description + line

                    elif state == 'description' and line.find('###') == 0:
                        state = 'method'
                        docs_clazz.function_list.append(method)
                        method = DocsMethod(0)
                        method.clazz = docs_clazz.name

                    elif state == 'description' and line.rstrip('\n').rstrip(
                            ' ') == '##Variables':
                        docs_clazz.function_list.append(method)
                        state = 'vars'

                    elif state == 'vars' and line.find('###') == 0:
                        #print line
                        state = 'var'

                    elif state == 'var' and line.find('_') == 0 and line.find(
                            '_description') == -1:
                        addfield(var, line)

                    elif state == 'var' and line.find('_description') == 0:
                        state = 'vardescription'

                    elif state == 'vardescription' and line.find('##') != 0:
                        var.description = var.description + line

                    elif state == 'vardescription' and line.find('###') == 0:
                        #print line
                        state = 'var'
                        docs_clazz.var_list.append(var)
                        var = DocsVar(0)
                        var.clazz = docs_clazz.name

                    elif state == 'class' and line.find('##Description') == -1:
                        docs_clazz.reference = docs_clazz.reference + line

                if state == 'vardescription':
                    docs_clazz.var_list.append(var)
                f.close()
                return docs_clazz

    return docs_clazz