\n'
return data2
def white_space(size) :
ret = ''
for iii in range(len(ret), size):
ret += " "
return ret
def generate_menu(element, level=1):
namespaceStack = element.get_namespace()
listBase = element.get_all_sub_type(['namespace'])
if len(listBase) == 0:
return ""
ret = ""
ret += '
\n'
for element in listBase:
retTmp = generate_menu(element['node'], level+1)
if retTmp != "":
subMenu = ' class="sousmenu"'
else:
subMenu = ''
ret += '
' + generate_link(element['node']) + '\n'
ret += retTmp
ret += '
\n'
ret += '
\n'
return ret
def generate_html_page_name(element):
return element.get_doc_website_page_local()
def generate_name(element):
namespaceStack = element.get_namespace()
namespaceExpanded = ""
for name in namespaceStack:
namespaceExpanded += name + "::"
if element.get_name() == "":
return element.get_node_type()
return element.get_node_type() + ": " + namespaceExpanded + element.get_name()
def generate_link(element):
if element.get_name() == "":
return '** No name **'
return '' + element.get_name() + ''
def calculate_methode_size(list):
returnSize = 0;
methodeSize = 0;
haveVirtual = False
for element in list:
debug.info("node type = " + element['node'].get_node_type())
if element['node'].get_node_type() == 'methode' \
or element['node'].get_node_type() == 'constructor' \
or element['node'].get_node_type() == 'destructor':
if element['node'].get_virtual() == True:
haveVirtual = True
if element['node'].get_node_type() == 'variable':
retType = element['node'].get_type().to_str()
elif element['node'].get_node_type() == 'using':
retType = ""
else:
retType = element['node'].get_return_type().to_str()
tmpLen = len(retType)
if returnSize < tmpLen:
returnSize = tmpLen
tmpLen = len(element['node'].get_name())
if methodeSize < tmpLen:
methodeSize = tmpLen
return [returnSize, methodeSize, haveVirtual]
def write_methode(element, namespaceStack, displaySize = None, link = True):
if element['node'].get_request_hidden() == True:
return ""
if displaySize == None:
displaySize = calculate_methode_size([element])
ret = ""
if 'access' in element.keys():
if element['access'] == 'private':
ret += '- '
return ""
elif element['access'] == 'protected':
ret += '# '
elif element['access'] == 'public':
ret += '+ '
else:
ret += ' '
else:
ret += ' '
if element['node'].get_node_type() in ['variable']:
if displaySize[2] == True:
ret += ' '
raw, decorated = element['node'].get_type().to_str_decorated()
elif element['node'].get_node_type() in ['using']:
if displaySize[2] == True:
ret += ' '
raw, decorated = element['node'].get_type().to_str_decorated()
else:
if element['node'].get_virtual() == True:
ret += module.display_color('virtual') + ' '
elif displaySize[2] == True:
ret += ' '
raw, decorated = element['node'].get_return_type().to_str_decorated()
if raw != "":
ret += decorated
ret += " "
raw += " "
ret += white_space(displaySize[0] - len(raw)+1)
name = element['node'].get_name()
if element['node'].get_node_type() == 'variable':
classDecoration = "code-member"
else:
classDecoration = "code-function"
if link == True:
ret += '' + name + ''
else:
ret += '' + name + ''
if element['node'].get_node_type() not in ['variable', 'using']:
ret += white_space(displaySize[1] - len(name)) + ' ('
listParam = element['node'].get_param()
first = True
for param in listParam:
if first == False:
ret += ', '
if displaySize[2] == True:
ret += ' '
ret += white_space(displaySize[0] + displaySize[1] +5)
first = False
typeNoDecoration, typeDecorated = param.get_type().to_str_decorated()
#retParam = module.display_color(param.get_type().to_str())
retParam = typeDecorated
if retParam != "":
ret += retParam
ret += " "
ret += "" + param.get_name() + ""
ret += ')'
if element['node'].get_constant() == True:
ret += module.display_color(' const')
if element['node'].get_override() == True:
ret += module.display_color(' override')
if element['node'].get_virtual_pure() == True:
ret += ' = 0'
if element['node'].get_delete() == True:
ret += ' = delete'
ret += ';'
ret += ' '
return ret
def generate_stupid_index_page(outFolder, header, footer, my_lutin_doc):
# create index.hml :
filename = outFolder + "/index.html"
tools.create_directory_of_file(filename);
file = open(filename, "w")
file.write(header)
file.write("
\n');
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
for nameElement in ['namespace', 'class', 'struct', 'enum', 'union', 'using']:
listBase = element.get_all_sub_type(nameElement)
if len(listBase) == 0:
continue
descLocal = ""
for elem in listBase:
if elem['node'].get_request_hidden() == True:
continue
if 'access' in elem.keys() \
and elem['access'] == 'private':
continue
descLocal += '
' + generate_link(elem['node']) + '
'
if descLocal != "":
file.write('
' + nameElement + ':
\n');
file.write('
\n');
file.write(descLocal)
file.write('
\n');
# calculate element size :
listBase = element.get_all_sub_type(['methode', 'constructor', 'destructor', 'variable', 'using'])
displayLen = calculate_methode_size(listBase)
if element.get_node_type() == 'class' \
or element.get_node_type() == 'struct':
if len(element.get_all_sub_type(['constructor', 'destructor'])) != 0:
globalWrite = ""
listBaseConstructor = element.get_all_sub_type(['constructor'])
for elem in listBaseConstructor:
if elem['access'] == 'private':
continue
globalWrite += write_methode(elem, namespaceStack, displayLen)
listBaseDestructor = element.get_all_sub_type(['destructor'])
for elem in listBaseDestructor:
if elem['access'] == 'private':
continue
globalWrite += write_methode(elem, namespaceStack, displayLen)
if globalWrite != "":
file.write('
Constructor and Destructor:
\n')
file.write('
\n');
file.write(globalWrite);
file.write('
\n');
file.write(' \n')
if element.get_node_type() in ['library', 'application', 'namespace', 'class', 'struct']:
listBaseMethode = element.get_all_sub_type(['methode', 'variable', 'using'])
if len(listBaseMethode) != 0:
globalWrite = ""
globalWriteProperties = ""
globalWriteSignals = ""
displayLen = calculate_methode_size(listBaseMethode)
for elem in listBaseMethode:
if 'access' in elem.keys() \
and elem['access'] == 'private':
continue
find_special = False
if 'node' in elem.keys() \
and elem['node'].get_node_type() == 'variable':
name = elem['node'].get_name()
if len(name) > 8 \
and name[:8] == "property":
globalWriteProperties += write_methode(elem, namespaceStack, displayLen)
find_special = True
elif len(name) > 6 \
and name[:6] == "signal":
globalWriteSignals += write_methode(elem, namespaceStack, displayLen)
find_special = True
if find_special == False:
globalWrite += write_methode(elem, namespaceStack, displayLen)
if globalWriteProperties != "":
file.write('