def __init__(self, cls, filename, lineno, pos, children=None): # Initialize with no starting or ending Version IDLRelease.__init__(self, None, None) self.cls = cls self.lineno = lineno self.pos = pos self.filename = filename self.hashes = {} self.deps = {} self.errors = 0 self.namespace = None self.typelist = None self.parent = None self.property_node = IDLPropertyNode() # self.children is a list of children ordered as defined self.children = [] # Process the passed in list of children, placing ExtAttributes into the # property dictionary, and nodes into the local child list in order. In # addition, add nodes to the namespace if the class is in the NamedSet. if not children: children = [] for child in children: if child.cls == 'ExtAttribute': self.SetProperty(child.name, child.value) else: self.AddChild(child)
def __init__(self, cls, filename, lineno, pos, children=None): # Initialize with no starting or ending Version IDLRelease.__init__(self, None, None) self.cls = cls self.lineno = lineno self.pos = pos self.filename = filename self.filenode = None self.hashes = {} self.deps = {} self.errors = 0 self.namespace = None self.typelist = None self.parent = None self.property_node = IDLPropertyNode() # A list of unique releases for this node self.releases = None # A map from any release, to the first unique release self.first_release = None # self.children is a list of children ordered as defined self.children = [] # Process the passed in list of children, placing ExtAttributes into the # property dictionary, and nodes into the local child list in order. In # addition, add nodes to the namespace if the class is in the NamedSet. if not children: children = [] for child in children: if child.cls == 'ExtAttribute': self.SetProperty(child.name, child.value) else: self.AddChild(child)
def Dump(self, depth=0, comments=False, out=sys.stdout): if self.cls in ['Comment', 'Copyright']: is_comment = True else: is_comment = False # Skip this node if it's a comment, and we are not printing comments if not comments and is_comment: return tab = ''.rjust(depth * 2) if is_comment: out.write('%sComment\n' % tab) for line in self.GetName().split('\n'): out.write('%s "%s"\n' % (tab, line)) else: ver = IDLRelease.__str__(self) if self.releases: release_list = ': ' + ' '.join(self.releases) else: release_list = ': undefined' out.write('%s%s%s%s\n' % (tab, self, ver, release_list)) if self.typelist: out.write('%s Typelist: %s\n' % (tab, self.typelist.GetReleases()[0])) properties = self.property_node.GetPropertyList() if properties: out.write('%s Properties\n' % tab) for p in properties: if is_comment and p == 'NAME': # Skip printing the name for comments, since we printed above already continue out.write('%s %s : %s\n' % (tab, p, self.GetProperty(p))) for child in self.children: child.Dump(depth+1, comments=comments, out=out)
def __str__(self): name = self.GetName() ver = IDLRelease.__str__(self) if name is None: name = '' if not IDLNode.show_versions: ver = '' return '%s(%s%s)' % (self.cls, name, ver)
def GetNameVersion(self): name = self.GetProperty('NAME', default='') ver = IDLRelease.__str__(self) return '%s%s' % (name, ver)