Package pyplusplus :: Package code_creators :: Module calldef

Source Code for Module pyplusplus.code_creators.calldef

   1  # Copyright 2004-2008 Roman Yakovenko
 
   2  # Distributed under the Boost Software License, Version 1.0. (See
 
   3  # accompanying file LICENSE_1_0.txt or copy at
 
   4  # http://www.boost.org/LICENSE_1_0.txt)
 
   5  
 
   6  import os 
   7  import algorithm 
   8  import code_creator 
   9  import calldef_utils 
  10  import declaration_based 
  11  import registration_based 
  12  import class_declaration 
  13  from pygccxml import declarations 
  14  from pyplusplus import decl_wrappers 
15 16 #TODO: 17 #Add to docs: 18 #public memebr functions - call, override, call base implementation 19 #protected member functions - call, override 20 #private - override 21 22 -class calldef_t( registration_based.registration_based_t 23 , declaration_based.declaration_based_t ):
24 - def __init__(self, function, wrapper=None ):
25 registration_based.registration_based_t.__init__( self ) 26 declaration_based.declaration_based_t.__init__( self, declaration=function ) 27 self._wrapper = wrapper 28 self._associated_decl_creators = []
29 30 @property
31 - def associated_decl_creators( self ):
32 """ references to declaration code creators. """ 33 return self._associated_decl_creators
34
35 - def _get_wrapper( self ):
36 return self._wrapper
37 - def _set_wrapper( self, new_wrapper ):
38 self._wrapper = new_wrapper
39 wrapper = property( _get_wrapper, _set_wrapper ) 40
41 - def def_identifier( self ):
42 return algorithm.create_identifier( self, '::boost::python::def' )
43
44 - def pure_virtual_identifier( self ):
45 return algorithm.create_identifier( self, '::boost::python::pure_virtual' )
46
47 - def param_sep(self):
48 return os.linesep + self.indent( self.PARAM_SEPARATOR )
49
50 - def create_keywords_args(self):
51 arg_utils = calldef_utils.argument_utils_t( self.declaration, algorithm.make_id_creator( self ) ) 52 return arg_utils.keywords_args()
53
54 - def create_call_policies( self, default_generates_code_too=False ):
55 if False == default_generates_code_too \ 56 and self.declaration.call_policies.is_default(): 57 return '' 58 else: 59 return self.declaration.call_policies.create( self )
60
61 - def create_def_code( self ):
62 if not self.works_on_instance: 63 return '%s.def' % self.parent.class_var_name 64 else: 65 return 'def'
66
67 - def create_doc(self):
68 return self.documentation
69
70 - def create_function_ref_code( self, use_function_alias=False ):
71 raise NotImplementedError()
72
73 - def _get_function_type_alias( self ):
74 return self.