| Trees | Indices | Help |
|
|---|
|
|
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 scoped 9 import calldef 10 import algorithm 11 import smart_pointers 12 import declaration_based 13 import registration_based 14 from pygccxml import declarations19 scoped.scoped_t.__init__( self, declaration=class_inst ) 20 registration_based.registration_based_t.__init__( self ) 21 self.works_on_instance = False2224 class_identifier = algorithm.create_identifier( self, '::boost::python::class_' ) 25 return declarations.templates.join( class_identifier, [self.decl_identifier] )2628 result = [] 29 result.append( self._generate_class_definition() + '("%s")' % self.declaration.alias ) 30 for x in self.creators: 31 code = x.create() 32 tmpl = '%s.%s' 33 if self.is_comment( code ): 34 tmpl = '%s%s' 35 result.append( self.indent( tmpl % ( os.linesep, code ) ) ) 36 result.append( ';' ) 37 return ''.join( result )38 39 @property 4244 if self.declaration.always_expose_using_scope: 45 return True 46 return bool( filter( lambda cc: not cc.works_on_instance, self.creators ) )47 48 @property50 return self.class_var_name + '_t'5153 result = [] 54 scope_var_name = self.alias + '_scope' 55 result.append( 'typedef ' + self._generate_class_definition() + ' ' + self.typedef_name + ';') 56 result.append( self.typedef_name + ' ' + self.class_var_name ) 57 result[-1] = result[-1] + ' = '+ self.typedef_name + '("%s");' % self.declaration.alias 58 59 result.append( algorithm.create_identifier( self, '::boost::python::scope' ) ) 60 result[-1] = result[-1] + ' ' + scope_var_name 61 result[-1] = result[-1] + '( %s );' % self.class_var_name 62 63 for x in self.creators: 64 if not x.works_on_instance: 65 result.append( x.