Back to index

salome-kernel  6.5.0
Public Member Functions | Public Attributes
IDLparser.Type Class Reference
Inheritance diagram for IDLparser.Type:
Inheritance graph
[legend]
Collaboration diagram for IDLparser.Type:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def merge
def addChild
def addNamedChild
def replaceChild
def insertFirstChild
def insertFirstNamedChild
def output_xml
def Dump
def parents
def getChild
def getNode
def __repr__
def mergeChilds
def setAttrib

Public Attributes

 name
 content
 key
 parent
 childs
 comments
 attrs

Detailed Description

Definition at line 597 of file IDLparser.py.


Constructor & Destructor Documentation

def IDLparser.Type.__init__ (   self,
  name,
  kind 
)

Definition at line 598 of file IDLparser.py.

00598 
00599   def __init__(self, name,kind):
00600     Tree.__init__(self, 'type')
00601     self.setAttrib("name",name)
00602     self.setAttrib("kind",kind)

Here is the call graph for this function:


Member Function Documentation

def IDLparser.Tree.__repr__ (   self) [inherited]

Definition at line 184 of file IDLparser.py.

00184 
00185     def __repr__(self):
00186         s = '<'
00187         if self.name != '':
00188             s += self.name
00189         else:
00190             s +=  'None'
00191         s += '>'
00192         return s

def IDLparser.Tree.addChild (   self,
  tree 
) [inherited]

Definition at line 87 of file IDLparser.py.

00087 
00088     def addChild(self, tree):
00089         if tree is not None:
00090             self.childs.append(tree)
00091             tree.parent = self
00092         return tree

Here is the caller graph for this function:

def IDLparser.Tree.addNamedChild (   self,
  name,
  content = '' 
) [inherited]

Definition at line 93 of file IDLparser.py.

00093 
00094     def addNamedChild(self, name, content = ''):
00095         return self.addChild(Tree(name, content))

Here is the call graph for this function:

Here is the caller graph for this function:

def IDLparser.Tree.Dump (   self,
  levels = -1,
  depth = 0 
) [inherited]

Definition at line 141 of file IDLparser.py.

00141 
00142     def Dump(self, levels=-1, depth=0):
00143         #Dumps the tree contents
00144 
00145         if levels == 0: return
00146 
00147         s = string.ljust('', 4*depth)
00148         print s, self, self.content
00149         for i in self.childs:
00150             i.Dump(levels-1, depth+1)

def IDLparser.Tree.getChild (   self,
  name,
  content = None 
) [inherited]

Definition at line 161 of file IDLparser.py.

00161 
00162     def getChild(self, name, content=None):
00163         # return child node with a given name
00164         # if content == None, don't compare contents
00165         for i in self.childs:
00166             if (i.name == name):
00167                 if (content is None) | (i.content == content):
00168                     return i
00169         return None

Here is the caller graph for this function:

def IDLparser.Tree.getNode (   self,
  name,
  content = '',
  depth = -1 
) [inherited]

Definition at line 170 of file IDLparser.py.

00170 
00171     def getNode(self, name, content='', depth=-1):
00172         # recursive search of a node with a given name
00173         # content == None, don't compare content
00174         if (self.name == name):
00175             if (content is None) | (self.content == content):
00176                 return self
00177 
00178         if (depth != 0):
00179             for i in self.childs:
00180                 n = i.getNode(name, content, depth-1)
00181                 if n:  return n
00182 
00183         return None

Here is the caller graph for this function:

def IDLparser.Tree.insertFirstChild (   self,
  tree 
) [inherited]

Definition at line 108 of file IDLparser.py.

00108 
00109     def insertFirstChild(self, tree):
00110         if tree is not None:
00111             self.childs.insert(0, tree)
00112         return tree

Here is the caller graph for this function:

def IDLparser.Tree.insertFirstNamedChild (   self,
  name,
  content = '' 
) [inherited]

Definition at line 113 of file IDLparser.py.

00113 
00114     def insertFirstNamedChild(self, name, content = ''):
00115         return self.insertFirstChild(Tree(name, content))

Here is the call graph for this function:

def IDLparser.Type.merge (   self,
  t 
)

Reimplemented from IDLparser.Tree.

Definition at line 603 of file IDLparser.py.

00603 
00604   def merge(self,t):
00605     self.setAttrib("kind",t.attrs["kind"])

Here is the call graph for this function:

def IDLparser.Tree.mergeChilds (   self,
  t,
  list 
) [inherited]

Definition at line 196 of file IDLparser.py.

00196 
00197     def mergeChilds(self, t, list):
00198         L_ext = t.getChild(list)
00199         L_int = self.getChild(list)
00200 
00201         L_merge = Tree(list)
00202 
00203         for i_ext in L_ext.childs:
00204             k_ext = i_ext.key
00205             if k_ext is None:  continue
00206             present = 0
00207 
00208             for i_int in L_int.childs:
00209                 k_int = i_int.key
00210                 if k_int is None:  continue
00211 
00212                 if (k_int == k_ext):
00213                     present = 1
00214                     break;
00215 
00216             if present :
00217                 i_int.merge(i_ext)
00218                 L_merge.addChild(i_int)
00219             else:
00220                 L_merge.addChild(i_ext)
00221 
00222         self.replaceChild(L_merge)

Here is the call graph for this function:

Here is the caller graph for this function:

def IDLparser.Tree.output_xml (   self,
  f,
  depth = 0 
) [inherited]

Definition at line 116 of file IDLparser.py.

00116 
00117     def output_xml(self, f, depth=0):
00118         d = depth
00119         if self.name != '':
00120             s = string.ljust('', 4*depth)
00121             s += '<' + self.name
00122             for k,v in self.attrs.items():
00123               s += ' ' + k + '="' + v + '"'
00124             s += '>'
00125             if self.content != '':
00126                 s +=  self.content
00127             else:
00128                 if len(self.childs) > 0:
00129                     s += '\n'
00130             f.write(s)
00131             d +=  1
00132 
00133         for i in self.childs:
00134             i.output_xml(f, d)
00135 
00136         if self.name != '':
00137             s = '</' + self.name + '>\n'
00138             if len(self.childs) > 0 :
00139                 s = string.ljust('', 4*depth) + s
00140             f.write(s)

def IDLparser.Tree.parents (   self) [inherited]

Definition at line 151 of file IDLparser.py.

00151 
00152     def parents(self):
00153         #Returns list of the parents
00154         l = []
00155         p = self.parent
00156         while p:
00157             l.append(p)
00158             l.append(p.name)
00159             p = p.parent
00160         return l

def IDLparser.Tree.replaceChild (   self,
  tree 
) [inherited]

Definition at line 96 of file IDLparser.py.

00096 
00097     def replaceChild(self, tree):
00098          if tree is not None:
00099             pos = 0
00100             for i in self.childs:
00101                 if (i.name == tree.name) & ((i.key is None) | (i.key == tree.key)):
00102                     self.childs.pop(pos)
00103                     self.childs.insert(pos, tree)
00104                     return tree
00105                 pos += 1
00106 
00107          return self.addChild(tree)

Here is the call graph for this function:

Here is the caller graph for this function:

def IDLparser.Tree.setAttrib (   self,
  name,
  value 
) [inherited]

Definition at line 223 of file IDLparser.py.

00223 
00224     def setAttrib(self, name,value):
00225       self.attrs[name]=value
00226 
00227 
00228 #--------------------------------------------------
00229 # implements parameter tree
#--------------------------------------------------

Here is the caller graph for this function:


Member Data Documentation

IDLparser.Tree.attrs [inherited]

Definition at line 85 of file IDLparser.py.

IDLparser.Tree.childs [inherited]

Reimplemented in IDLparser.ObjType, and IDLparser.StructType.

Definition at line 83 of file IDLparser.py.

Definition at line 84 of file IDLparser.py.

Definition at line 80 of file IDLparser.py.

IDLparser.Tree.key [inherited]

Definition at line 81 of file IDLparser.py.

IDLparser.Tree.name [inherited]

Definition at line 79 of file IDLparser.py.

IDLparser.Tree.parent [inherited]

Definition at line 82 of file IDLparser.py.


The documentation for this class was generated from the following file: