Package pyplusplus :: Package code_creators :: Module indexing_suites

Source Code for Module pyplusplus.code_creators.indexing_suites

  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 types 
  8  import algorithm 
  9  import code_creator 
 10  import declaration_based 
 11  import registration_based 
 12  from pygccxml import declarations 
13 14 -class indexing_suite1_t( registration_based.registration_based_t 15 , declaration_based.declaration_based_t ):
16 - def __init__(self, container ):
19 20 @property
21 - def configuration( self ):
22 return self.declaration.indexing_suite
23 24 @property
25 - def container( self ):
26 return self.declaration
27
28 - def guess_suite_name( self ):
29 if self.container.name.startswith( 'vector' ): 30 return 'boost::python::vector_indexing_suite' 31 else: 32 return 'boost::python::map_indexing_suite'
33
34 - def _create_suite_declaration( self ):
35 suite_identifier = algorithm.create_identifier( self, self.guess_suite_name() ) 36 args = [ self.container.partial_decl_string ] 37 try: 38 no_proxy = str( self.configuration.no_proxy ).lower() 39 except: 40 no_proxy = 'false' 41 if self.configuration.derived_policies: 42 args.append( no_proxy ) 43 args.append( self.configuration.derived_policies ) 44 else: 45 if 'true' == no_proxy: 46 args.append( no_proxy) 47 return declarations.templates.join( suite_identifier, args )
48
49 - def _create_impl(self):
50 return "def( %s() )" % self._create_suite_declaration() 51
52 - def _get_system_headers_impl( self ):
53 return self.configuration.include_files
54
55 -class indexing_suite2_t( registration_based.registration_based_t 56 , declaration_based.declaration_based_t ):
57 - def __init__(self, container ):