pyplusplus.code_creators.instruction

Package pyplusplus :: Package code_creators :: Module instruction |

# Source Code for Module pyplusplus.code_creators.instruction

     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 code_creator
     8
     9 -class instruction_t(code_creator.code_creator_t):
    10      """
    11      This class is used as a base class for different instruction for code creators.
    12      """
    13      #TODO: add silent option and make it default
    14 -    def __init__(self, silent=True):
    15          code_creator.code_creator_t.__init__(self)
    16          self._silent = silent
    17
    18 -    def get_silent(self):
    19          return self._silent
    20
    21 -    def set_silent(self, silent ):
    22          self._silent = silent
    23
    24      silent = property( get_silent, set_silent
    25                         , doc="""silent property controls, whether instruction
    26                           should be written within generated code or not.
    27                           Default value is True - not written.""" )
    28
    29 -    def _create_impl(self):
    30          if self.silent:
    31              return ''
    32          answer = []
    33          for line in self._generate_description().split( os.linesep ):
    34              answer.append( '// %s' % line )
    35          return os.linesep.join( answer )
    36
    37 -    def _generate_description(self):
    38          raise NotImplementedError()
    39
    40 -    def _get_system_headers_impl( self ):
    41          return []
    42