Package pyplusplus :: Package code_creators :: Module unnamed_enum

# Source Code for Module pyplusplus.code_creators.unnamed_enum

     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 pygccxml
     8  import algorithm
     9  import declaration_based
    10  import registration_based
    11
    12 -class unnamed_enum_t( registration_based.registration_based_t
    13                        , declaration_based.declaration_based_t ):
    14 -    def __init__(self, unnamed_enum ):
    15          registration_based.registration_based_t.__init__( self )
    16          declaration_based.declaration_based_t.__init__( self, declaration=unnamed_enum)
    17          self.works_on_instance = False
    18
    19 -    def _get_value_aliases(self):
    20          return self.declaration.value_aliases
    21 -    def _set_value_aliases(self, value_aliases):
    22          self.declaration.value_aliases = value_aliases
    23      value_aliases = property( _get_value_aliases, _set_value_aliases )
    24
    25 -    def _create_impl(self):
    26          if self.declaration.already_exposed:
    27              return ''
    28
    29          tmpl = algorithm.create_identifier( self, '::boost::python::scope' ) + '().attr("%s") = (int)%s;'
    30          full_name = pygccxml.declarations.full_name( self.declaration )
    31          result = []
    32          for name, value in self.declaration.values:
    33              result.append( tmpl % ( self.value_aliases.get( name, name )
    34                                      , algorithm.create_identifier( self, full_name + '::' + name ) ) )
    35          return os.linesep.join( result )
    36
    37 -    def _get_system_headers_impl( self ):
    38          return []
    39