Package pyplusplus :: Package code_creators :: Module declaration_based

# Source Code for Module pyplusplus.code_creators.declaration_based

     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 algorithm
     7  import code_creator
     8
     9 -class declaration_based_t:
    10      """Code creator that is based on a declaration.
    11      """
    12 -    def __init__(self, declaration ):
    13          """Constructor.
    14
    15          @param declaration: Declaration object
    16          @type declaration: L{decl_wrapper_t<decl_wrappers.decl_wrapper_t>}
    17          @param parent: Parent code creator.
    18          @type parent: code_creator_t
    19          """
    20          self._decl = declaration
    21
    22 -    def _generate_valid_name(self, name=None):
    23          if name == None:
    24              name = self.declaration.name
    25          return algorithm.create_valid_name( name )
    26
    27      @property
    28 -    def declaration(self):
    29          """The declaration this code creator is based on.
    30          @type: L{decl_wrapper_t<decl_wrappers.decl_wrapper_t>}
    31          """
    32          return self._decl
    33
    34 -    def _get_alias_impl( self ):
    35          return self.declaration.alias
    36
    37 -    def _get_alias(self):
    38          return self._get_alias_impl()
    39 -    def _set_alias(self, alias):
    40          self.declaration.alias = alias
    41      alias = property( _get_alias, _set_alias )
    42
    43      @property
    44 -    def decl_identifier( self ):
    45          return algorithm.create_identifier( self, self.declaration.partial_decl_string )
    46
    47      @property
    48 -    def documentation( self ):
    49          if None is self.declaration.documentation:
    50              return ''
    51          return self.declaration.documentation
    52
    53 -    def get_user_headers( self, recursive=False, unique=False ):
    54          """return list of user header files to be included from the generated file"""
    55          return self.declaration.include_files
    56