From aff1fdf89a04b8a4594c2742f875614e56cf8a31 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 24 Apr 2014 21:31:22 +0200 Subject: [PATCH] [DEV] add support of empty enum --- monkEnum.py | 13 ++++++++++--- monkHtml.py | 11 +++++++---- monkNode.py | 13 +++++++++++-- 3 files changed, 28 insertions(+), 9 deletions(-) diff --git a/monkEnum.py b/monkEnum.py index c5e0bc4..a0648c9 100644 --- a/monkEnum.py +++ b/monkEnum.py @@ -6,15 +6,22 @@ class Enum(Node.Node): def __init__(self, stack=[], file="", lineNumber=0, documentation=[]): self.baseValue = 0; # check input : - if len(stack) < 2: - debug.error("Can not parse class : " + str(stack)) + if len(stack) < 1: + debug.error("Can not parse enum : " + str(stack)) return self.typedef = False if stack[0] == 'typedef': self.typedef = True stack[1:] + if len(stack) == 0: + debug.error("Can not parse enum : " + str(stack)) + return + if len(stack) == 1: + localEnumName = "" + else: + localEnumName = stack[1] - Node.Node.__init__(self, 'enum', stack[1], file, lineNumber, documentation) + Node.Node.__init__(self, 'enum', localEnumName, file, lineNumber, documentation) self.listElement = [] diff --git a/monkHtml.py b/monkHtml.py index 5d3e015..3ac4631 100644 --- a/monkHtml.py +++ b/monkHtml.py @@ -126,13 +126,16 @@ def generate_html_page_name(element): def generate_name(element): namespaceStack = element.get_namespace() - link = "" + namespaceExpanded = "" for name in namespaceStack: - link += name + "::" - return element.get_node_type() + ": " + link + element.get_name() - + 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): diff --git a/monkNode.py b/monkNode.py index b9a8c84..8e6ddfa 100644 --- a/monkNode.py +++ b/monkNode.py @@ -44,6 +44,9 @@ class Node(): def get_name(self): return self.name + def get_UID(self): + return self.uid + def add_doc(self, doc): for element in doc: self.documenatationCode.append(element) @@ -214,7 +217,10 @@ class Node(): ret += "_" for name in self.namespace: ret += name + "__" - ret += self.name + if self.name == "": + ret += "NO_NAME_" + str(self.uid) + else: + ret += self.name ret += '.html' return ret @@ -223,7 +229,10 @@ class Node(): ret += "_" for name in self.namespace: ret += name + "__" - ret += self.name + if self.name == "": + ret += "NO_NAME_" + str(self.uid) + else: + ret += self.name ret += '.html' return ret