pyplusplus.code_creators.ctypes_integration_creators

Package pyplusplus :: Package code_creators :: Module ctypes_integration_creators |

# Source Code for Module pyplusplus.code_creators.ctypes_integration_creators

     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 declaration_based
    10  import registration_based
    11  from pygccxml import declarations
    12  from pyplusplus import decl_wrappers
    13  from pyplusplus import code_repository
    14
    15 -class  expose_this_t( registration_based.registration_based_t
    16                        , declaration_based.declaration_based_t ):
    17      """
    18      creates code that expose address of the object to Python
    19      """
    20
    21 -    def __init__(self, class_ ):
    22          registration_based.registration_based_t.__init__( self )
    23          declaration_based.declaration_based_t.__init__( self, declaration=class_)
    24
    25 -    def _create_impl(self):
    26          answer = [ 'add_property' ]
    27          answer.append( '( ' )
    28          answer.append('"this"')
    29          answer.append( self.PARAM_SEPARATOR )
    30          answer.append( 'pyplus_conv::make_addressof_inst_getter< %s >()' % self.decl_identifier )
    31          if self.documentation:
    32              answer.append( self.PARAM_SEPARATOR )
    33              answer.append( self.documentation )
    34          answer.append( ' ) ' )
    35
    36          return ''.join( answer )
    37
    38 -    def _get_system_headers_impl( self ):
    39          return [code_repository.ctypes_integration.file_name]
    40
    41 -class  expose_sizeof_t( registration_based.registration_based_t
    42                          , declaration_based.declaration_based_t ):
    43      """
    44      creates code that expose address of the object to Python
    45      """
    46
    47 -    def __init__(self, class_ ):
    48          registration_based.registration_based_t.__init__( self )
    49          declaration_based.declaration_based_t.__init__( self, declaration=class_)
    50
    51 -    def _create_impl(self):
    52          return 'def( pyplus_conv::register_sizeof( boost::type< %s >() ) )' % self.decl_identifier
    53
    54 -    def _get_system_headers_impl( self ):
    55          return [code_repository.ctypes_integration.file_name]
    56