Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17227/pyplusplus/decl_wrappers
Modified Files:
scopedef_wrapper.py
Log Message:
adding new flag for multiple select functionality: select can raise an exception if nothing has been selected
Index: scopedef_wrapper.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/scopedef_wrapper.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** scopedef_wrapper.py 29 Mar 2006 04:23:45 -0000 1.5
--- scopedef_wrapper.py 29 Mar 2006 07:02:36 -0000 1.6
***************
*** 12,15 ****
--- 12,17 ----
class scopedef_t(decl_wrapper.decl_wrapper_t):
RECURSIVE_DEFAULT = True
+ ALLOW_EMPTY_MDECL_WRAPPER = False
+
def __init__(self):
decl_wrapper.decl_wrapper_t.__init__( self )
***************
*** 28,34 ****
while bases:
base = bases.pop()
! if 'pygccxml' not in base.__module__:
continue
if base in visited:
continue
types.append( base )
--- 30,38 ----
while bases:
base = bases.pop()
! if base is declarations.declaration_t:
continue
if base in visited:
+ continue
+ if 'pygccxml' not in base.__module__:
continue
types.append( base )
***************
*** 39,44 ****
#start_time = time.clock()
! decl_types = [ declarations.declaration_t
! , declarations.scopedef_t
, declarations.enumeration_t
, declarations.namespace_t
--- 43,47 ----
#start_time = time.clock()
! decl_types = [ declarations.scopedef_t
, declarations.enumeration_t
, declarations.namespace_t
***************
*** 164,167 ****
--- 167,174 ----
found = declarations.matcher.find( matcher, decls, False )
mfound = mdecl_wrapper.mdecl_wrapper_t( found )
+ decl_wrapper.logger.info( 'There are %d declarations that match query' % len(mfound) )
+ if not mfound and not self.ALLOW_EMPTY_MDECL_WRAPPER:
+ raise RuntimeError( "Multi declaration query returned 0 declarations." )
+
decl_wrapper.logger.info( 'query execution took : %f seconds' % ( time.clock() - start_time ) )
return mfound
|