Package pyplusplus :: Package decl_wrappers :: Module scopedef_wrapper

# Source Code for Module pyplusplus.decl_wrappers.scopedef_wrapper

     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  """defines base class for L{decl_wrappers.class_t} and L{decl_wrappers.namespace_t} classes"""
     7
     8  import decl_wrapper
     9  from pyplusplus import messages
    10
    11 -class scopedef_t(decl_wrapper.decl_wrapper_t):
    12      """base class for L{decl_wrappers.class_t} and L{decl_wrappers.namespace_t} classes
    13
    14      It provides convinience functionality: include\\exclude all internal declarations
    15      (not) to be exported.
    16      """
    17
    18 -    def __init__(self):
    19          decl_wrapper.decl_wrapper_t.__init__( self )
    20
    21 -    def exclude( self, compilation_errors=False ):
    22          """exclude "self" and child declarations from being exposed.
    23
    24          If compile_time_errors is True, than only declarations, which will cause
    25          compilation error will be excluded
    26          """
    27          if False == compilation_errors:
    28              #exclude all unconditionaly
    29              self.ignore = True
    30              map( lambda decl: decl.exclude(), self.declarations )
    31          else:
    32              if filter( lambda msg: isinstance( msg, messages.compilation_error )
    33                         , self.readme() ):
    34                  self.exclude()
    35              else:
    36                  map( lambda decl: decl.exclude(compilation_errors=True)
    37                       , self.declarations )
    38
    39 -    def include( self, already_exposed=False  ):
    40          """Include "self" and child declarations to be exposed."""
    41          self.ignore = False
    42          self.already_exposed = already_exposed
    43          map( lambda decl: decl.include(already_exposed), self.declarations )
    44