Revision: 262
Author: roman_yakovenko
Date: 2006-06-28 23:18:44 -0700 (Wed, 28 Jun 2006)
ViewCVS: http://svn.sourceforge.net/pygccxml/?rev=262&view=rev
Log Message:
-----------
fixing code creators interface - parent should not be passed in __init__
Modified Paths:
--------------
pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py
pyplusplus_dev/pyplusplus/code_creators/calldef.py
pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
pyplusplus_dev/pyplusplus/code_creators/code_creator.py
pyplusplus_dev/pyplusplus/code_creators/compound.py
pyplusplus_dev/pyplusplus/code_creators/custom.py
pyplusplus_dev/pyplusplus/code_creators/declaration_based.py
pyplusplus_dev/pyplusplus/code_creators/enum.py
pyplusplus_dev/pyplusplus/code_creators/global_variable.py
pyplusplus_dev/pyplusplus/code_creators/include.py
pyplusplus_dev/pyplusplus/code_creators/include_directories.py
pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
pyplusplus_dev/pyplusplus/code_creators/instruction.py
pyplusplus_dev/pyplusplus/code_creators/license.py
pyplusplus_dev/pyplusplus/code_creators/member_variable.py
pyplusplus_dev/pyplusplus/code_creators/module.py
pyplusplus_dev/pyplusplus/code_creators/module_body.py
pyplusplus_dev/pyplusplus/code_creators/namespace.py
pyplusplus_dev/pyplusplus/code_creators/scoped.py
pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py
pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py
pyplusplus_dev/pyplusplus/module_creator/creator.py
Modified: pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/array_1_registrator.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -14,8 +14,8 @@
"""
This class creates code that register static sized array
"""
- def __init__( self, array_type, parent=None ):
- code_creator.code_creator_t.__init__(self, parent=parent)
+ def __init__( self, array_type ):
+ code_creator.code_creator_t.__init__( self )
self._array_type = array_type
self._call_policies = self._guess_call_policies()
self.works_on_instance = False
Modified: pyplusplus_dev/pyplusplus/code_creators/calldef.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/calldef.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -24,10 +24,8 @@
#private - override
class calldef_t( declaration_based.declaration_based_t):
- def __init__(self, function, wrapper=None, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=function
- , parent=parent )
+ def __init__(self, function, wrapper=None ):
+ declaration_based.declaration_based_t.__init__( self, declaration=function )
self._wrapper = wrapper
def _get_wrapper( self ):
@@ -63,10 +61,8 @@
return ''.join( result )
class calldef_wrapper_t( declaration_based.declaration_based_t):
- def __init__(self, function, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=function
- , parent=parent )
+ def __init__(self, function ):
+ declaration_based.declaration_based_t.__init__( self, declaration=function )
def argument_name( self, index ):
arg = self.declaration.arguments[ index ]
@@ -125,8 +121,8 @@
return ' throw( ' + self.PARAM_SEPARATOR.join( exceptions ) + ' )'
class free_function_t( calldef_t ):
- def __init__( self, function, parent=None ):
- calldef_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function ):
+ calldef_t.__init__( self, function=function )
def _create_impl(self):
param_sep = self.param_sep()
@@ -154,8 +150,8 @@
return ''.join( result )
class mem_fun_t( calldef_t ):
- def __init__( self, function, parent=None ):
- calldef_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function ):
+ calldef_t.__init__( self, function=function )
def _create_impl(self):
param_sep = self.param_sep()
@@ -184,8 +180,8 @@
class mem_fun_pv_t( calldef_t ):
- def __init__( self, function, wrapper, parent=None ):
- calldef_t.__init__( self, function=function, wrapper=wrapper, parent=parent )
+ def __init__( self, function, wrapper ):
+ calldef_t.__init__( self, function=function, wrapper=wrapper )
def _create_impl(self):
param_sep = self.param_sep()
@@ -216,8 +212,8 @@
return ''.join( result )
class mem_fun_pv_wrapper_t( calldef_wrapper_t ):
- def __init__( self, function, parent=None):
- calldef_wrapper_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function ):
+ calldef_wrapper_t.__init__( self, function=function )
def create_declaration(self):
template = 'virtual %(return_type)s %(name)s( %(args)s )%(constness)s%(throw)s'
@@ -260,8 +256,8 @@
return os.linesep.join( answer )
class mem_fun_v_t( calldef_t ):
- def __init__( self, function, wrapper=None, parent=None ):
- calldef_t.__init__( self, function=function, wrapper=wrapper, parent=parent )
+ def __init__( self, function, wrapper=None ):
+ calldef_t.__init__( self, function=function, wrapper=wrapper )
def _create_impl(self):
param_sep = self.param_sep()
@@ -296,8 +292,8 @@
return ''.join( result )
class mem_fun_v_wrapper_t( calldef_wrapper_t ):
- def __init__( self, function, parent=None):
- calldef_wrapper_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function ):
+ calldef_wrapper_t.__init__( self, function=function )
def default_full_name(self):
return self.parent.full_name + '::default_' + self.declaration.alias
@@ -378,8 +374,8 @@
class mem_fun_protected_t( calldef_t ):
- def __init__( self, function, wrapper, parent=None ):
- calldef_t.__init__( self, function=function, wrapper=wrapper, parent=parent )
+ def __init__( self, function, wrapper ):
+ calldef_t.__init__( self, function=function, wrapper=wrapper )
def _create_impl(self):
param_sep = self.param_sep()
@@ -407,8 +403,8 @@
return ''.join( result )
class mem_fun_protected_wrapper_t( calldef_wrapper_t ):
- def __init__( self, function, parent=None):
- calldef_wrapper_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function ):
+ calldef_wrapper_t.__init__( self, function=function )
def full_name(self):
return '::'.join( [self.parent.full_name, self.declaration.name] )
@@ -461,8 +457,8 @@
class mem_fun_protected_s_t( calldef_t ):
- def __init__( self, function, wrapper, parent=None ):
- calldef_t.__init__( self, function=function, wrapper=wrapper, parent=parent )
+ def __init__( self, function, wrapper ):
+ calldef_t.__init__( self, function=function, wrapper=wrapper )
def _create_impl(self):
param_sep = self.param_sep()
@@ -490,8 +486,8 @@
return ''.join( result )
class mem_fun_protected_s_wrapper_t( calldef_wrapper_t ):
- def __init__( self, function, parent=None):
- calldef_wrapper_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function ):
+ calldef_wrapper_t.__init__( self, function=function )
def full_name(self):
return '::'.join( [self.parent.full_name, self.declaration.name] )
@@ -535,8 +531,8 @@
return self.create_function()
class mem_fun_protected_v_t( calldef_t ):
- def __init__( self, function, wrapper, parent=None ):
- calldef_t.__init__( self, function=function, wrapper=wrapper, parent=parent )
+ def __init__( self, function, wrapper ):
+ calldef_t.__init__( self, function=function, wrapper=wrapper )
def _create_impl(self):
param_sep = self.param_sep()
@@ -564,8 +560,8 @@
class mem_fun_protected_v_wrapper_t( calldef_wrapper_t ):
- def __init__( self, function, parent=None):
- calldef_wrapper_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function):
+ calldef_wrapper_t.__init__( self, function=function )
def full_name(self):
return self.parent.full_name + '::' + self.declaration.name
@@ -623,8 +619,8 @@
return self.create_function()
class mem_fun_protected_pv_t( calldef_t ):
- def __init__( self, function, wrapper,parent=None ):
- calldef_t.__init__( self, function=function, wrapper=wrapper, parent=parent )
+ def __init__( self, function, wrapper ):
+ calldef_t.__init__( self, function=function, wrapper=wrapper )
def _create_impl(self):
param_sep = self.param_sep()
@@ -652,8 +648,8 @@
return ''.join( result )
class mem_fun_protected_pv_wrapper_t( calldef_wrapper_t ):
- def __init__( self, function, parent=None):
- calldef_wrapper_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function):
+ calldef_wrapper_t.__init__( self, function=function )
def full_name(self):
return self.parent.full_name + '::' + self.declaration.name
@@ -707,8 +703,8 @@
return os.linesep.join( answer )
class mem_fun_private_v_wrapper_t( calldef_wrapper_t ):
- def __init__( self, function, parent=None):
- calldef_wrapper_t.__init__( self, function=function, parent=parent )
+ def __init__( self, function):
+ calldef_wrapper_t.__init__( self, function=function )
def full_name(self):
return self.parent.full_name + '::' + self.declaration.name
@@ -783,8 +779,8 @@
"""
Creates boost.python code needed to expose constructor.
"""
- def __init__(self, constructor, wrapper=None, parent=None ):
- calldef_t.__init__( self, function=constructor, wrapper=wrapper, parent=parent )
+ def __init__(self, constructor, wrapper=None ):
+ calldef_t.__init__( self, function=constructor, wrapper=wrapper )
def _create_arg_code( self, arg ):
temp = arg.type
@@ -833,10 +829,8 @@
"""
Creates boost.python code that expose member function as static function.
"""
- def __init__(self, function, function_code_creator=None, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=function
- , parent=parent )
+ def __init__(self, function, function_code_creator=None ):
+ declaration_based.declaration_based_t.__init__( self, declaration=function )
self._function_code_creator = function_code_creator
@@ -854,8 +848,8 @@
Creates C++ code that builds wrapper arround exposed constructor.
"""
- def __init__( self, constructor, parent=None ):
- calldef_wrapper_t.__init__( self, function=constructor, parent=parent )
+ def __init__( self, constructor ):
+ calldef_wrapper_t.__init__( self, function=constructor )
def _create_declaration(self):
result = []
@@ -900,10 +894,8 @@
"""
Creates wrapper class constructor from wrapped class instance.
"""
- def __init__( self, class_inst, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=class_inst
- , parent=parent )
+ def __init__( self, class_inst ):
+ declaration_based.declaration_based_t.__init__( self, declaration=class_inst )
def _create_declaration(self):
result = []
@@ -938,10 +930,8 @@
"""
Creates wrapper for compiler generated null constructor.
"""
- def __init__( self, class_inst, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=class_inst
- , parent=parent )
+ def __init__( self, class_inst ):
+ declaration_based.declaration_based_t.__init__( self, declaration=class_inst )
def _create_constructor_call( self ):
return algorithm.create_identifier( self, self.parent.declaration.decl_string ) + '()'
@@ -969,10 +959,10 @@
SECOND = 'second'
BOTH = 'both'
- def __init__(self, operator, parent=None ):
+ def __init__(self, operator ):
declaration_based.declaration_based_t.__init__( self
, declaration=operator
- , parent=parent )
+ )
def _call_type_constructor( self, type ):
x = declarations.remove_reference( type )
@@ -1038,10 +1028,8 @@
"""
Creates boost.python code needed to register type conversions( implicitly_convertible )
"""
- def __init__( self, operator, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=operator
- , parent=parent )
+ def __init__( self, operator ):
+ declaration_based.declaration_based_t.__init__( self, declaration=operator )
def _create_impl(self):
#TODO add comment in case of non const operator
@@ -1061,10 +1049,8 @@
operators Pythonic name is given: __int__, __long__, __float__, __str__
"""
- def __init__( self, operator, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=operator
- , parent=parent )
+ def __init__( self, operator ):
+ declaration_based.declaration_based_t.__init__( self, declaration=operator )
self._call_policies = None
def _create_impl(self):
@@ -1089,10 +1075,8 @@
This case treat situation when class has public non explicit constuctor from
another type.
"""
- def __init__( self, constructor, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , declaration=constructor
- , parent=parent )
+ def __init__( self, constructor ):
+ declaration_based.declaration_based_t.__init__( self, declaration=constructor )
def _create_impl(self):
implicitly_convertible = algorithm.create_identifier( self, '::boost::python::implicitly_convertible' )
Modified: pyplusplus_dev/pyplusplus/code_creators/class_declaration.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/class_declaration.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -13,10 +13,8 @@
from pygccxml import declarations
class class_declaration_t( scoped.scoped_t ):
- def __init__(self, class_inst, parent=None ):
- scoped.scoped_t.__init__( self
- , parent=parent
- , declaration=class_inst )
+ def __init__(self, class_inst ):
+ scoped.scoped_t.__init__( self, declaration=class_inst )
self.works_on_instance = False
def _generate_class_definition(self):
@@ -84,10 +82,8 @@
"""
Creates boost.python code that needed to export a class
"""
- def __init__(self, class_inst, wrapper=None, parent=None ):
- scoped.scoped_t.__init__( self
- , parent=parent
- , declaration=class_inst )
+ def __init__(self, class_inst, wrapper=None ):
+ scoped.scoped_t.__init__( self, declaration=class_inst )
self._wrapper = wrapper
self.works_on_instance = False
@@ -299,10 +295,8 @@
Creates C++ code that creates wrapper arround some class
"""
- def __init__(self, declaration, class_creator, parent=None ):
- scoped.scoped_t.__init__( self
- , parent=parent
- , declaration=declaration )
+ def __init__(self, declaration, class_creator ):
+ scoped.scoped_t.__init__( self, declaration=declaration )
self._class_creator = class_creator
self._base_wrappers = []
Modified: pyplusplus_dev/pyplusplus/code_creators/code_creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/code_creator.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -23,16 +23,14 @@
__INDENTATION = ' '
LINE_LENGTH = 80
PARAM_SEPARATOR = ', '
- def __init__(self, parent=None):
+ def __init__(self):
"""Constructor.
@param parent: Parent code creator.
@type parent: code_creator_t
"""
object.__init__(self)
- if parent:
- assert isinstance( parent, code_creator_t )
- self._parent = parent
+ self._parent = None
self._target_configuration = None
self._works_on_instance = True
Modified: pyplusplus_dev/pyplusplus/code_creators/compound.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/compound.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/compound.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -7,13 +7,13 @@
import code_creator
class compound_t(code_creator.code_creator_t):
- def __init__(self, parent=None):
+ def __init__(self ):
"""Constructor.
@param parent: Parent code creator.
@type parent: L{code_creator_t}
"""
- code_creator.code_creator_t.__init__( self, parent )
+ code_creator.code_creator_t.__init__( self )
self._creators = []
def _get_creators(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/custom.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/custom.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/custom.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -6,20 +6,20 @@
import code_creator
class custom_t(code_creator.code_creator_t):
- def __init__(self, parent=None, works_on_instance=True):
+ def __init__(self, works_on_instance=True):
""" Base class for custom code.
works_on_instance: If true, the custom code can be applied directly to obj inst.
Ex: ObjInst."CustomCode"
"""
- code_creator.code_creator_t.__init__(self, parent)
+ code_creator.code_creator_t.__init__(self)
self.works_on_instance = works_on_instance
def _create_impl(self):
raise NotImplementedError()
class custom_text_t(custom_t):
- def __init__(self, text, parent=None, works_on_instance=True):
- custom_t.__init__(self, parent, works_on_instance)
+ def __init__(self, text, works_on_instance=True):
+ custom_t.__init__(self, works_on_instance)
self._text = text
def _get_text(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/declaration_based.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/declaration_based.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/declaration_based.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -9,7 +9,7 @@
class declaration_based_t(code_creator.code_creator_t):
"""Code creator that is based on a declaration.
"""
- def __init__(self, declaration, parent=None ):
+ def __init__(self, declaration ):
"""Constructor.
@param declaration: Declaration object
@@ -17,7 +17,7 @@
@param parent: Parent code creator.
@type parent: code_creator_t
"""
- code_creator.code_creator_t.__init__(self, parent)
+ code_creator.code_creator_t.__init__(self)
self._decl = declaration
def _create_impl(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/enum.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/enum.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/enum.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -11,10 +11,8 @@
"""
Creates boost.python code that expose C++ enum
"""
- def __init__(self, enum, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=enum)
+ def __init__(self, enum ):
+ declaration_based.declaration_based_t.__init__( self, declaration=enum)
self.works_on_instance = False
def _get_value_aliases(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/global_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/global_variable.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -17,10 +17,8 @@
Base class for all global variables code creators. Mainly exists to
simplify file writers algorithms.
"""
- def __init__(self, variable, wrapper=None, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=variable)
+ def __init__(self, variable, wrapper=None ):
+ declaration_based.declaration_based_t.__init__( self, declaration=variable)
self._wrapper = wrapper
def _get_wrapper( self ):
@@ -33,10 +31,8 @@
"""
Creates boost.python code that exposes global variable.
"""
- def __init__(self, variable, parent=None ):
- global_variable_base_t.__init__( self
- , variable=variable
- , parent=parent )
+ def __init__(self, variable ):
+ global_variable_base_t.__init__( self, variable=variable )
def _create_impl(self):
assert isinstance( self.declaration, pygccxml.declarations.variable_t )
@@ -53,11 +49,8 @@
"""
_PARAM_SEPARATOR = ', '
- def __init__(self, variable, wrapper, parent=None ):
- global_variable_base_t.__init__( self
- , variable=variable
- , wrapper=wrapper
- , parent=parent )
+ def __init__(self, variable, wrapper ):
+ global_variable_base_t.__init__( self, variable=variable, wrapper=wrapper )
def _create_impl( self ):
answer = []
@@ -73,10 +66,8 @@
Creates C++ code that register array class.
"""
- def __init__(self, variable, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=variable)
+ def __init__(self, variable ):
+ declaration_based.declaration_based_t.__init__( self, declaration=variable)
def _get_wrapper_type( self ):
ns_name = code_repository.array_1.namespace
Modified: pyplusplus_dev/pyplusplus/code_creators/include.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/include.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/include.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -12,8 +12,8 @@
"""
Creates C++ code for include directive
"""
- def __init__( self, header, parent=None ):
- code_creator.code_creator_t.__init__(self, parent)
+ def __init__( self, header ):
+ code_creator.code_creator_t.__init__(self)
self._header = include_directories.include_directories_t.normalize( header )
self._include_dirs_optimization = None #This parameter will be set from module_t.create function
Modified: pyplusplus_dev/pyplusplus/code_creators/include_directories.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/include_directories.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/include_directories.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -13,8 +13,8 @@
L{include_t} and {precompiled_header_t} code creators use it to generate
relative include directives.
"""
- def __init__(self, parent=None ):
- instruction.instruction_t.__init__(self, parent)
+ def __init__(self):
+ instruction.instruction_t.__init__(self)
self._user_defined = []
self._std = []
Modified: pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/indexing_suites.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -11,8 +11,8 @@
from pygccxml import declarations
class indexing_suite1_t( declaration_based.declaration_based_t ):
- def __init__(self, container, parent=None ):
- declaration_based.declaration_based_t.__init__( self, declaration=container, parent=parent )
+ def __init__(self, container ):
+ declaration_based.declaration_based_t.__init__( self, declaration=container )
def _get_configuration( self ):
return self.declaration.indexing_suite
@@ -47,8 +47,8 @@
class indexing_suite2_t( declaration_based.declaration_based_t ):
- def __init__(self, container, parent=None ):
- declaration_based.declaration_based_t.__init__( self, declaration=container, parent=parent )
+ def __init__(self, container ):
+ declaration_based.declaration_based_t.__init__( self, declaration=container )
self.__method_mask_var_name = "methods_mask"
self.works_on_instance = not self.does_user_disable_methods()
@@ -104,15 +104,15 @@
return ''.join( answer )
class value_traits_t( declaration_based.declaration_based_t ):
- def __init__( self, value_class, parent=None ):
- declaration_based.declaration_based_t.__init__( self, declaration=value_class, parent=parent )
+ def __init__( self, value_class ):
+ declaration_based.declaration_based_t.__init__( self, declaration=value_class )
def generate_value_traits( self ):
tmpl = os.linesep.join([
"namespace boost { namespace python { namespace indexing {"
, ""
, "template<>"
- , "struct value_traits<%(value_class)s>{"
+ , "struct value_traits< %(value_class)s >{"
, ""
, self.indent( "static bool const equality_comparable = %(has_equal)s;" )
, self.indent( "static bool const less_than_comparable = %(has_lessthan)s;" )
Modified: pyplusplus_dev/pyplusplus/code_creators/instruction.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/instruction.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/instruction.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -11,8 +11,8 @@
This class is used as a base class for different instruction for code creators.
"""
#TODO: add silent option and make it default
- def __init__(self, parent, silent=True):
- code_creator.code_creator_t.__init__(self, parent)
+ def __init__(self, silent=True):
+ code_creator.code_creator_t.__init__(self)
self._silent = silent
def get_silent(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/license.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/license.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/license.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -10,8 +10,8 @@
This class allows user to put his license on the top of every generated file.
License text will be generated as is.
"""
- def __init__(self, text, parent=None):
- code_creator.code_creator_t.__init__(self, parent)
+ def __init__(self, text ):
+ code_creator.code_creator_t.__init__(self)
self._text = text
def _get_text(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/member_variable.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/member_variable.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -16,10 +16,8 @@
simplify file writers algorithms.
"""
- def __init__(self, variable, wrapper=None, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=variable)
+ def __init__(self, variable, wrapper=None ):
+ declaration_based.declaration_based_t.__init__( self, declaration=variable)
self._wrapper = wrapper
def _get_wrapper( self ):
@@ -32,8 +30,8 @@
"""
Creates boost.python code that exposes member variable.
"""
- def __init__(self, variable, wrapper=None, parent=None ):
- member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper, parent=parent)
+ def __init__(self, variable, wrapper=None ):
+ member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper )
#> On Wednesday, 19. April 2006 23:05, Ralf W. Grosse-Kunstleve wrote:
#> .add_property("p", make_function(&A::get_p, return_value_policy<reference_existing_object>()))
@@ -159,10 +157,8 @@
, ''
])
- def __init__(self, variable, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=variable)
+ def __init__(self, variable ):
+ declaration_based.declaration_based_t.__init__( self, declaration=variable)
def _get_getter_full_name(self):
return self.parent.full_name + '::' + 'get_' + self.declaration.name
@@ -232,11 +228,8 @@
"""
Creates boost.python code that exposes bit fields member variables
"""
- def __init__(self, variable, wrapper, parent=None ):
- member_variable_base_t.__init__( self
- , variable=variable
- , wrapper=wrapper
- , parent=parent)
+ def __init__(self, variable, wrapper ):
+ member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper )
def _create_impl( self ):
if self.declaration.type_qualifiers.has_static:
@@ -285,10 +278,8 @@
, ''
])
- def __init__(self, variable, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=variable)
+ def __init__(self, variable ):
+ declaration_based.declaration_based_t.__init__( self, declaration=variable)
def _get_getter_full_name(self):
return self.parent.full_name + '::' + 'get_' + self.declaration.name
@@ -331,11 +322,8 @@
"""
Creates boost.python code that exposes array member variable.
"""
- def __init__(self, variable, wrapper, parent=None ):
- member_variable_base_t.__init__( self
- , variable=variable
- , wrapper=wrapper
- , parent=parent )
+ def __init__(self, variable, wrapper ):
+ member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper )
def _create_impl( self ):
assert isinstance( self.wrapper, array_mv_wrapper_t )
@@ -366,10 +354,8 @@
Creates C++ code that register array class.
"""
- def __init__(self, variable, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=variable)
+ def __init__(self, variable ):
+ declaration_based.declaration_based_t.__init__( self, declaration=variable)
def _get_wrapper_type( self ):
ns_name = code_repository.array_1.namespace
@@ -420,11 +406,8 @@
"""
Creates C++ code that creates accessor for class member variable, that has type reference.
"""
- def __init__(self, variable, wrapper, parent=None ):
- member_variable_base_t.__init__( self
- , variable=variable
- , wrapper=wrapper
- , parent=parent)
+ def __init__(self, variable, wrapper ):
+ member_variable_base_t.__init__( self, variable=variable, wrapper=wrapper )
self.param_sep = os.linesep + self.indent( self.PARAM_SEPARATOR, 2 )
self.works_on_instance = False
@@ -488,10 +471,8 @@
, ''
])
- def __init__(self, variable, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=variable)
+ def __init__(self, variable ):
+ declaration_based.declaration_based_t.__init__( self, declaration=variable)
def _get_getter_full_name(self):
return self.parent.full_name + '::' + 'get_' + self.declaration.name
Modified: pyplusplus_dev/pyplusplus/code_creators/module.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/module.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -21,7 +21,7 @@
def __init__(self):
"""Constructor.
"""
- compound.compound_t.__init__(self, None)
+ compound.compound_t.__init__(self)
self.__system_headers = []
def add_system_header( self, header ):
@@ -38,7 +38,7 @@
, where=self.creators
, recursive=False)
if 0 == len( include_dirs ):
- include_dirs = include_directories.include_directories_t(parent=self)
+ include_dirs = include_directories.include_directories_t()
if self.license:
self.adopt_creator( include_dirs, 1 )
else:
Modified: pyplusplus_dev/pyplusplus/code_creators/module_body.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/module_body.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/module_body.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -7,8 +7,8 @@
import compound
class module_body_t(compound.compound_t):
- def __init__( self, name, parent=None ):
- compound.compound_t.__init__(self, parent)
+ def __init__( self, name ):
+ compound.compound_t.__init__(self )
self._name = name
def _get_name(self):
Modified: pyplusplus_dev/pyplusplus/code_creators/namespace.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/namespace.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/namespace.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -6,8 +6,8 @@
import code_creator
class namespace_alias_t(code_creator.code_creator_t):
- def __init__( self, alias, full_namespace_name, parent=None ):
- code_creator.code_creator_t.__init__(self, parent)
+ def __init__( self, alias, full_namespace_name ):
+ code_creator.code_creator_t.__init__( self )
self._alias = alias
self._full_namespace_name = full_namespace_name
@@ -27,8 +27,8 @@
return 'namespace %s = %s;' % ( self.alias, self.full_namespace_name )
class namespace_using_t(code_creator.code_creator_t):
- def __init__( self, namespace_name, parent=None ):
- code_creator.code_creator_t.__init__(self, parent)
+ def __init__( self, namespace_name ):
+ code_creator.code_creator_t.__init__(self )
self._namespace_name = namespace_name
def _get_namespace_name( self ):
Modified: pyplusplus_dev/pyplusplus/code_creators/scoped.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/scoped.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/scoped.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -8,11 +8,9 @@
import declaration_based
class scoped_t(declaration_based.declaration_based_t, compound.compound_t):
- def __init__( self, declaration, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=declaration)
- compound.compound_t.__init__( self, parent )
+ def __init__( self, declaration ):
+ declaration_based.declaration_based_t.__init__( self, declaration=declaration)
+ compound.compound_t.__init__( self )
def _create_impl(self):
#template method pattern should be used.
Modified: pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/smart_pointers.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -37,9 +37,9 @@
Lets boost python know that it can use smart_ptr to hold a an object.
See: http://www.boost.org/libs/python/doc/v2/register_ptr_to_python.html
"""
- def __init__( self, smart_ptr, class_creator, parent=None ):
+ def __init__( self, smart_ptr, class_creator ):
""" smart_ptr: string of ptr type. Ex: 'boost::shared_ptr' """
- declaration_based.declaration_based_t.__init__( self, class_creator.declaration, parent )
+ declaration_based.declaration_based_t.__init__( self, class_creator.declaration )
self._smart_ptr = smart_ptr
self._class_creator = class_creator
self.works_on_instance = False
@@ -73,8 +73,8 @@
conversion from source to target.
See: http://www.boost.org/libs/python/doc/v2/implicit.html
"""
- def __init__( self, smart_ptr, source, target, parent=None ):
- declaration_based.declaration_based_t.__init__( self, source, parent )
+ def __init__( self, smart_ptr, source, target ):
+ declaration_based.declaration_based_t.__init__( self, source )
self._target = target
self._smart_ptr = smart_ptr
self.works_on_instance = False
Modified: pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py
===================================================================
--- pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/code_creators/unnamed_enum.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -9,10 +9,8 @@
import declaration_based
class unnamed_enum_t( declaration_based.declaration_based_t ):
- def __init__(self, unnamed_enum, parent=None ):
- declaration_based.declaration_based_t.__init__( self
- , parent=parent
- , declaration=unnamed_enum)
+ def __init__(self, unnamed_enum ):
+ declaration_based.declaration_based_t.__init__( self, declaration=unnamed_enum)
self.works_on_instance = False
def _get_value_aliases(self):
Modified: pyplusplus_dev/pyplusplus/module_creator/creator.py
===================================================================
--- pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-28 20:16:11 UTC (rev 261)
+++ pyplusplus_dev/pyplusplus/module_creator/creator.py 2006-06-29 06:18:44 UTC (rev 262)
@@ -371,19 +371,24 @@
#supported container : [ header file, is already used ]
+ used_headers = set()
isuite1 = {
- 'vector<' : [ "boost/python/suite/indexing/vector_indexing_suite.hpp", False ]
- , 'map<' : [ "boost/python/suite/indexing/map_indexing_suite.hpp", False ]
+ 'vector<' : "boost/python/suite/indexing/vector_indexing_suite.hpp"
+ , 'map<' : "boost/python/suite/indexing/map_indexing_suite.hpp"
}
- #include <boost/python/suite/indexing/vector.hpp>
-
- container_suite_header_was_used = False
- container_suite_header = "boost/python/suite/indexing/container_suite.hpp"
isuite2 = {
- 'vector<' : [ "boost/python/suite/indexing/vector.hpp", False ]
+ 'vector<' : "boost/python/suite/indexing/vector.hpp"
+ , 'deque<' : "boost/python/suite/indexing/deque.hpp"
+ , 'list<' : "boost/python/suite/indexing/list.hpp"
+ , 'map<' : "boost/python/suite/indexing/map.hpp"
+ , 'hash_map<' : "boost/python/suite/indexing/map.hpp"
+ , 'set<' : "boost/python/suite/indexing/set.hpp"
+ , 'hash_set<' : "boost/python/suite/indexing/set.hpp"
+ #TODO: queue, priority, stack, multimap, hash_multimap, multiset, hash_multiset
}
+ container_suite_header = "boost/python/suite/indexing/container_suite.hpp"
for cls in self.__types_db.used_containers:
container_name = cls.name.split( '<' )[0] + '<'
@@ -395,15 +400,10 @@
if not isuite.has_key( container_name ):
continue #not supported
- if isuite is isuite2 and not container_suite_header_was_used:
- container_suite_header_was_used = True
- self.__extmodule.add_system_header( container_suite_header )
- self.__extmodule.add_include( container_suite_header )
+ if isuite is isuite2:
+ used_headers.add( container_suite_header )
- if not isuite[ container_name ][1]:
- isuite[ container_name ][1] = True
- self.__extmodule.add_system_header( isuite[ container_name ][0] )
- self.__extmodule.add_include( header=isuite[ container_name ][0] )
+ used_headers.add( isuite[ container_name ] )
cls_creator = create_cls_cc( cls )
value_type = cls.indexing_suite.value_type()
@@ -420,7 +420,17 @@
self.__extmodule.adopt_creator( value_type_cc, self.__extmodule.creators.index( self.__module_body ) )
cls_creator.adopt_creator( code_creators.indexing_suite2_t(cls) )
self.__module_body.adopt_creator( cls_creator )
-
+
+ if container_suite_header in used_headers:
+ #I want this header to be the first one.
+ used_headers.remove( container_suite_header )
+ self.__extmodule.add_system_header( container_suite_header )
+ self.__extmodule.add_include( container_suite_header )
+
+ for header in used_headers:
+ self.__extmodule.add_system_header( header )
+ self.__extmodule.add_include( header )
+
def create(self, decl_headers=None):
"""Create and return the module for the extension.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|