Update of /cvsroot/pygccxml/source/pyplusplus/decl_wrappers
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13809/pyplusplus/decl_wrappers
Modified Files:
__init__.py class_wrapper.py
Added Files:
user_text.py
Log Message:
adding support to user text/code on decl_wrappers.class_t class
--- NEW FILE: user_text.py ---
# Copyright 2004 Roman Yakovenko.
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
class user_text_t(object):
def __init__( self, text ):
object.__init__( self )
self.text = text
class class_user_text_t( user_text_t ):
def __init__( self, text, works_on_instance=True ):
"""works_on_instance: If true, the custom code can be applied directly to obj inst.
Ex: ObjInst."CustomCode"
"""
user_text_t.__init__( self, text )
self.works_on_instance = works_on_instance
Index: class_wrapper.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/class_wrapper.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** class_wrapper.py 28 Feb 2006 07:31:33 -0000 1.1
--- class_wrapper.py 19 Mar 2006 05:45:14 -0000 1.2
***************
*** 8,11 ****
--- 8,12 ----
import finalizable
from pygccxml import declarations
+ import user_text
class class_declaration_t(decl_wrapper.decl_wrapper_t, declarations.class_declaration_t):
***************
*** 24,27 ****
--- 25,31 ----
self._noncopyable = False
self._wrapper_alias = self._generate_valid_name() + "_wrapper"
+ self._user_code = []
+ self._wrapper_user_code = []
+
def _get_always_expose_using_scope( self ):
***************
*** 60,61 ****
--- 64,87 ----
temp = filter( lambda creator: creator.is_finalizable(), finalizables )
return len( temp ) == len( finalizables )
+
+ def _get_user_code( self ):
+ return self._user_code
+ def _set_user_code( self, value ):
+ self._user_code = value
+ user_code = property( _get_user_code, _set_user_code )
+
+ def _get_wrapper_user_code( self ):
+ return self._wrapper_user_code
+ def _set_wrapper_user_code( self, value ):
+ self._wrapper_user_code = value
+ wrapper_user_code = property( _get_wrapper_user_code, _set_wrapper_user_code )
+
+ def add_code( self, code, works_on_instance=True ):
+ """works_on_instance: If true, the custom code can be applied directly to obj inst.
+ Ex: ObjInst."CustomCode"
+ """
+ self.user_code.append( user_text.class_user_text_t( code, works_on_instance ) )
+
+ def add_wrapper_code( self, code ):
+ self.wrapper_user_code.append( user_text.user_text_t( code ) )
+
\ No newline at end of file
Index: __init__.py
===================================================================
RCS file: /cvsroot/pygccxml/source/pyplusplus/decl_wrappers/__init__.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** __init__.py 10 Mar 2006 10:57:31 -0000 1.4
--- __init__.py 19 Mar 2006 05:45:14 -0000 1.5
***************
*** 88,91 ****
--- 88,94 ----
from mdecl_wrapper import mdecl_wrapper_t
+ from user_text import user_text_t
+ from user_text import class_user_text_t
+
class dwfactory_t( declarations.decl_factory_t ):
"""
|