Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv516/pyplusplus/decl_wrappers
Modified Files:
calldef_wrapper.py class_wrapper.py decl_wrapper.py
namespace_wrapper.py scopedef_wrapper.py
Removed Files:
finalizable.py
Log Message:
removing finalize from the code_creators and adding it to decl wrappers
Index: scopedef_wrapper.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/scopedef_wrapper.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** scopedef_wrapper.py 19 Mar 2006 13:35:39 -0000 1.3
--- scopedef_wrapper.py 20 Mar 2006 05:47:56 -0000 1.4
***************
*** 5,13 ****
import decl_wrapper
- import finalizable
from pygccxml import declarations
import mdecl_wrapper
! class scopedef_t(decl_wrapper.decl_wrapper_t, finalizable.finalizable_t):
RECURSIVE_DEFAULT = True
--- 5,12 ----
import decl_wrapper
from pygccxml import declarations
import mdecl_wrapper
! class scopedef_t(decl_wrapper.decl_wrapper_t):
RECURSIVE_DEFAULT = True
***************
*** 15,19 ****
def __init__(self):
decl_wrapper.decl_wrapper_t.__init__( self )
- finalizable.finalizable_t.__init__( self )
def exclude( self ):
--- 14,17 ----
***************
*** 25,34 ****
map( lambda decl: decl.include(), self.declarations )
- def finalize( self ):
- finalizables = filter( lambda decl: isinstance( decl, finalizable.finalizable_t )
- and decl.is_finalizable()
- , declarations.make_flatten( self.declarations ) )
- map( lambda decl: decl.finalize(), finalizables )
-
def __create_matcher( self, match_class, *args, **keywds ):
if len( args ) == 1 and callable( args[0] ):
--- 23,26 ----
Index: decl_wrapper.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/decl_wrapper.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** decl_wrapper.py 19 Mar 2006 13:35:39 -0000 1.2
--- decl_wrapper.py 20 Mar 2006 05:47:56 -0000 1.3
***************
*** 14,17 ****
--- 14,21 ----
__REPOTED_REPLACES.append( msg )
+ class ERROR_BEHAVIOUR:
+ PRINT = 'print'
+ RAISE = 'raise'
+
class decl_wrapper_t(object):
def __init__(self):
***************
*** 54,56 ****
--- 58,78 ----
def include( self ):
self.ignore = False
+
+ #I think that almost every declaration could have some wrapper. This is the
+ #main reason why those 3 functions does not have some well defined interface.
+ def has_wrapper( self ):
+ return False
+
+ def _finalize_impl( self, error_behaviour ):
+ pass
+
+ def finalize( self, error_behaviour=None):
+ try:
+ self._finalize_impl( self )
+ except Exception, error:
+ if None is error_behaviour or error_behaviour == ERROR_BEHAVIOUR.PRINT:
+ print 'Unable to finalize declaration: ', str( error )
+ else:
+ raise
+
\ No newline at end of file
Index: namespace_wrapper.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/namespace_wrapper.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** namespace_wrapper.py 15 Mar 2006 09:27:06 -0000 1.2
--- namespace_wrapper.py 20 Mar 2006 05:47:56 -0000 1.3
***************
*** 5,9 ****
import scopedef_wrapper
- import finalizable
from pygccxml import declarations
--- 5,8 ----
***************
*** 12,18 ****
scopedef_wrapper.scopedef_t.__init__( self )
declarations.namespace_t.__init__(self, *arguments, **keywords )
-
- def is_finalizable(self):
- return True
def namespace( self, *args, **keywds ):
--- 11,14 ----
Index: class_wrapper.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/class_wrapper.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** class_wrapper.py 19 Mar 2006 05:45:14 -0000 1.2
--- class_wrapper.py 20 Mar 2006 05:47:56 -0000 1.3
***************
*** 6,10 ****
import decl_wrapper
import scopedef_wrapper
- import finalizable
from pygccxml import declarations
import user_text
--- 6,9 ----
***************
*** 27,31 ****
self._user_code = []
self._wrapper_user_code = []
-
def _get_always_expose_using_scope( self ):
--- 26,29 ----
***************
*** 59,68 ****
wrapper_alias = property( _get_wrapper_alias, _set_wrapper_alias )
! def is_finalizable(self):
! finalizables = filter( lambda decl: isinstance( decl, finalizable.finalizable_t )
! , self.declarations )
! temp = filter( lambda creator: creator.is_finalizable(), finalizables )
! return len( temp ) == len( finalizables )
def _get_user_code( self ):
return self._user_code
--- 57,70 ----
wrapper_alias = property( _get_wrapper_alias, _set_wrapper_alias )
! def has_wrapper( self ):
! for decl in self.declarations:
! if decl.has_wrapper():
! return True
! return False
+ def _finalize_impl( self, error_behaviour ):
+ for decl in self.declarations:
+ decl.finalize( error_behaviour )
+
def _get_user_code( self ):
return self._user_code
--- finalizable.py DELETED ---
Index: calldef_wrapper.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/calldef_wrapper.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** calldef_wrapper.py 5 Mar 2006 05:51:30 -0000 1.2
--- calldef_wrapper.py 20 Mar 2006 05:47:56 -0000 1.3
***************
*** 5,15 ****
import decl_wrapper
- import finalizable
from pygccxml import declarations
! class calldef_t(decl_wrapper.decl_wrapper_t, finalizable.finalizable_t):
def __init__(self, *arguments, **keywords):
decl_wrapper.decl_wrapper_t.__init__( self, *arguments, **keywords )
- finalizable.finalizable_t.__init__( self )
self._call_policies = None
--- 5,20 ----
import decl_wrapper
from pygccxml import declarations
! ##May be in future I will enable this functionality again, right now it seems
! ##that this is useless
! ##def is_finalizable(self):
! ##if not self.wrapper:
! ##return False
! ##return self.declaration.virtuality != declarations.VIRTUALITY_TYPES.PURE_VIRTUAL
!
! class calldef_t(decl_wrapper.decl_wrapper_t):
def __init__(self, *arguments, **keywords):
decl_wrapper.decl_wrapper_t.__init__( self, *arguments, **keywords )
self._call_policies = None
***************
*** 42,46 ****
--- 47,70 ----
use_default_arguments = property( _get_use_default_arguments, _set_use_default_arguments )
+ def has_wrapper( self ):
+ if not isinstance( self, declarations.member_calldef_t ):
+ return False
+ elif self.virtuality == declarations.VIRTUALITY_TYPES.PURE_VIRTUAL:
+ return True
+ elif self.access_type == declarations.ACCESS_TYPES.PROTECTED:
+ return True
+ else:
+ return False
+ def _finalize_impl( self, error_behaviour ):
+ if not isinstance( self, declarations.member_calldef_t ):
+ pass
+ elif self.virtuality == declarations.VIRTUALITY_TYPES.PURE_VIRTUAL:
+ raise RuntimeError( "In order to expose pure virtual function, you should allow to pyplusplus to create wrapper." )
+ elif self.access_type == declarations.ACCESS_TYPES.PROTECTED:
+ self.ignore = True
+ else:
+ pass
+
class member_function_t( declarations.member_function_t, calldef_t ):
def __init__(self, *arguments, **keywords):
|