pyplusplus.module_creator.fake_constructors_manager

Package pyplusplus :: Package module_creator :: Module fake_constructors_manager |

# Source Code for Module pyplusplus.module_creator.fake_constructors_manager

     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 class, which manages "fake constructors" """
     7
     8 -class manager_t( object ):
     9 -    def __init__( self, global_ns ):
    10          self.__global_ns = global_ns
    11          self.__fc_all = set()
    12          self.__fc_exposed = set()
    13
    14          for cls in global_ns.classes(recursive=True, allow_empty=True):
    15              for fc in cls.fake_constructors:
    16                  self.__fc_all.add( fc )
    17                  if fc.ignore:
    18                      continue
    19                  if not fc.exportable:
    20                      continue
    21                  if not isinstance( fc, cls.FAKE_CONSTRUCTOR_TYPES ):
    22                      continue
    23                  self.__fc_exposed.add( fc )
    24
    25 -    def is_fake_constructor( self, fc ):
    26          return fc in self.__fc_all
    27
    28 -    def should_generate_code( self, fc ):
    29          return fc in self.__fc_exposed
    30