Package pyplusplus :: Package code_creators :: Module custom |

# Source Code for Module pyplusplus.code_creators.custom

     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 code_creator
     7
     8 -class custom_t(code_creator.code_creator_t):
     9 -    def __init__(self, works_on_instance=True):
    10          """ Base class for custom code.
    11              works_on_instance: If true, the custom code can be applied directly to obj inst.
    12              Ex: ObjInst."CustomCode"
    13          """
    14          code_creator.code_creator_t.__init__(self)
    15          self.works_on_instance = works_on_instance
    16
    17 -    def _create_impl(self):
    18          raise NotImplementedError()
    19
    20 -    def _get_system_headers_impl( self ):
    21          return []
    22
    23 -class custom_text_t(custom_t):
    24 -    def __init__(self, text, works_on_instance=True):
    25          custom_t.__init__(self, works_on_instance)
    26          self._text = text
    27
    28 -    def _get_text(self):
    29          return self._text
    30 -    def _set_text(self, new_text):
    31          self._text = new_text
    32      text = property( _get_text, _set_text )
    33
    34 -    def _create_impl(self):
    35          return self.text
    36
    37 -    def _get_system_headers_impl( self ):
    38          return []
    39