Update of /cvsroot/pygccxml/source/pygccxml/declarations
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31240/pygccxml/declarations
Modified Files:
__init__.py algorithm.py scopedef.py type_traits.py
Log Message:
1. porting some tests to use new "select" interface
2. adding new type traits: has_public_assign
3. adding new patcher to treat GCC-XML default value typedef bug
Index: type_traits.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/type_traits.py,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** type_traits.py 6 Apr 2006 06:15:56 -0000 1.24
--- type_traits.py 23 Apr 2006 12:13:25 -0000 1.25
***************
*** 300,303 ****
--- 300,312 ----
return bool( constructors )
+ def has_public_assign(type):
+ """returns True if class has public assign operator, False otherwise"""
+ assert isinstance( type, class_declaration.class_t )
+ decls = algorithm.find_all_declarations( type.public_members
+ , type=calldef.member_operator_t
+ , recursive=False )
+ decls = filter( lambda decl: decl.symbol == '=', decls )
+ return bool( decls )
+
def has_public_destructor(type):
"""returns True if class has public destructor, False otherwise"""
Index: __init__.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/__init__.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -C2 -d -r1.38 -r1.39
*** __init__.py 20 Apr 2006 10:11:25 -0000 1.38
--- __init__.py 23 Apr 2006 12:13:25 -0000 1.39
***************
*** 67,70 ****
--- 67,71 ----
from algorithm import declaration_files
from algorithm import visit_function_has_not_been_found_t
+ from algorithm import get_global_namespace
from calldef import VIRTUALITY_TYPES
***************
*** 122,125 ****
--- 123,127 ----
from type_traits import has_destructor
from type_traits import has_trivial_copy
+ from type_traits import has_public_assign
from type_traits import has_public_destructor
from type_traits import has_public_constructor
Index: algorithm.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/algorithm.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** algorithm.py 2 Mar 2006 05:53:14 -0000 1.18
--- algorithm.py 23 Apr 2006 12:13:25 -0000 1.19
***************
*** 108,111 ****
--- 108,120 ----
yield internal
+ def get_global_namespace(decls):
+ import pygccxml.declarations
+ found = filter( lambda decl: decl.name == '::'
+ and isinstance( decl, pygccxml.declarations.namespace_t )
+ , make_flatten( decls ) )
+ if len( found ) == 1:
+ return found[0]
+ raise RuntimeError( "Unable to find global namespace." )
+
class match_declaration_t:
"""
Index: scopedef.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pygccxml/declarations/scopedef.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** scopedef.py 20 Apr 2006 10:11:25 -0000 1.11
--- scopedef.py 23 Apr 2006 12:13:25 -0000 1.12
***************
*** 40,44 ****
Example::
! ns - referers to global namespace
ns.member_function( "do_something ) - will return reference to member
function named "do_something". If there is no such function exception
--- 40,44 ----
Example::
! ns - referrers to global namespace
ns.member_function( "do_something ) - will return reference to member
function named "do_something". If there is no such function exception
***************
*** 284,300 ****
! def decl( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ):
"""Finds any declaration by criteria. Please see L{scopedef_t} for full explanation."""
return self._find_single( self._impl_matchers[ scopedef_t.decl ]
, name=name
, function=function
, header_dir=header_dir
, header_file=header_file
, recursive=recursive)
! def decls( self, name=None, function=None, header_dir=None, header_file=None, recursive=None ):
return self._find_multiple( self._impl_matchers[ scopedef_t.decl ]
, name=name
, function=function
, header_dir=header_dir
, header_file=header_file
--- 284,302 ----
! def decl( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None ):
"""Finds any declaration by criteria. Please see L{scopedef_t} for full explanation."""
return self._find_single( self._impl_matchers[ scopedef_t.decl ]
, name=name
, function=function
+ , decl_type=decl_type
, header_dir=header_dir
, header_file=header_file
, recursive=recursive)
! def decls( self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None ):
return self._find_multiple( self._impl_matchers[ scopedef_t.decl ]
, name=name
, function=function
+ , decl_type=decl_type
, header_dir=header_dir
, header_file=header_file
|