[pygccxml-commit] source/pyplusplus/experimental filters.py,1.3,1.4
Brought to you by:
mbaas,
roman_yakovenko
From: Matthias B. <mb...@us...> - 2006-03-15 17:14:52
|
Update of /cvsroot/pygccxml/source/pyplusplus/experimental In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32535 Modified Files: filters.py Log Message: The ParentFilter was only working with recursive=False. The RetvalFilter now also accepts regular expressions. Index: filters.py =================================================================== RCS file: /cvsroot/pygccxml/source/pyplusplus/experimental/filters.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** filters.py 14 Mar 2006 22:48:53 -0000 1.3 --- filters.py 15 Mar 2006 17:14:49 -0000 1.4 *************** *** 248,251 **** --- 248,258 ---- """ def __init__(self, parent, grandparents=False): + """Constructor. + + @param parent: Parent node + @type parent: declaration_t + @param grandparents: Determine whether the parent may also be a grandparent + @type grandparent: bool + """ FilterBase.__init__(self) self.parent = parent *************** *** 253,260 **** def __str__(self): ! return "parent=='%s'"%self.parent.name def __call__(self, decl): ! return decl.parent==self.parent def filterRange(self): --- 260,275 ---- def __str__(self): ! if self.recursive: ! return "anyparent=='%s'"%self.parent.name ! else: ! return "parent=='%s'"%self.parent.name def __call__(self, decl): ! # We can always return True as the filter range was already adjusted ! # so that all visited declarations meet the requirements for this ! # filter ! return True ! # The following line only works with recursive=False ! # return id(decl.parent)==id(self.parent) def filterRange(self): *************** *** 266,275 **** """ ! def __init__(self, retval): FilterBase.__init__(self) ! self.retval = retval def __str__(self): ! return "retval==%s"%self.retval def __call__(self, decl): --- 281,290 ---- """ ! def __init__(self, retvalpattern): FilterBase.__init__(self) ! self.matcher = _StringMatcher(retvalpattern) def __str__(self): ! return "retval==%s"%self.matcher.pattern def __call__(self, decl): *************** *** 277,281 **** if rettype==None: return False ! return rettype.decl_string==self.retval # ArgsFilter --- 292,296 ---- if rettype==None: return False ! return self.matcher.match(rettype.decl_string) # ArgsFilter |