Package pygccxml :: Package declarations :: Module algorithms_cache |

# Source Code for Module pygccxml.declarations.algorithms_cache

      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  """
      7  defines class that will keep results of different calculations.
      8  """
      9
     10
     11 -class declaration_algs_cache_t( object ):
     12 -    def __init__( self ):
     13          object.__init__( self )
     14          self._enabled = True
     15          self._full_name = None
     16          self._full_partial_name = None
     17          self._access_type = None
     18          self._demangled_name = None
     19          self._declaration_path = None
     20          self._partial_declaration_path = None
     21          self._container_key_type = None
     22          self._container_element_type = None
     23
     24 -    def disable( self ):
     25          self._enabled = False
     26
     27 -    def enable( self ):
     28          self._enabled = True
     29
     30      @property
     31 -    def enabled( self ):
     32          return self._enabled
     33
     34 -    def _get_full_name( self ):
     35          return self._full_name
     36 -    def _set_full_name( self, fname ):
     37          if not self.enabled:
     38              fname = None
     39          self._full_name = fname
     40      full_name = property( _get_full_name, _set_full_name )
     41
     42 -    def _get_full_partial_name( self ):
     43          return self._full_partial_name
     44 -    def _set_full_partial_name( self, fname ):
     45          if not self.enabled:
     46              fname = None
     47          self._full_partial_name = fname
     48      full_partial_name = property( _get_full_partial_name, _set_full_partial_name )
     49
     50 -    def _get_access_type( self ):
     51          return self._access_type
     52 -    def _set_access_type( self, access_type ):
     53          if not self.enabled:
     54              access_type = None
     55          self._access_type = access_type
     56      access_type = property( _get_access_type, _set_access_type )
     57
     58 -    def _get_demangled_name( self ):
     59          return self._demangled_name
     60 -    def _set_demangled_name( self, demangled_name ):
     61          if not self.enabled:
     62              demangled_name = None
     63          self._demangled_name = demangled_name
     64      demangled_name = property( _get_demangled_name, _set_demangled_name )
     65
     66 -    def _get_declaration_path( self ):
     67          return self._declaration_path
     68 -    def _set_declaration_path( self, declaration_path ):
     69          if not self.enabled:
     70              declaration_path = None
     71          self._declaration_path = declaration_path
     72      declaration_path = property( _get_declaration_path, _set_declaration_path )
     73
     74 -    def _get_partial_declaration_path( self ):
     75          return self._partial_declaration_path
     76 -    def _set_partial_declaration_path( self, partial_declaration_path ):
     77          if not self.enabled:
     78              partial_declaration_path = None
     79          self._partial_declaration_path = partial_declaration_path
     80      partial_declaration_path = property( _get_partial_declaration_path
     81                                               , _set_partial_declaration_path )
     82
     83 -    def _get_container_element_type( self ):
     84          return self._container_element_type
     85 -    def _set_container_element_type( self, etype ):
     86          if not self.enabled:
     87              etype = None
     88          self._container_element_type = etype
     89      container_element_type = property( _get_container_element_type, _set_container_element_type )
     90
     91 -    def _get_container_key_type( self ):
     92          return self._container_key_type
     93 -    def _set_container_key_type( self, ktype ):
     94          if not self.enabled:
     95              ktype = None
     96          self._container_key_type = ktype
     97      container_key_type = property( _get_container_key_type, _set_container_key_type )
     98
     99 -    def reset( self ):
    100          self.full_name = None
    101          self.full_partial_name = None
    102          self.access_type = None
    103          self.demangled_name = None
    104          self.declaration_path = None
    105          self.partial_declaration_path = None
    106          self.container_key_type = None
    107          self.container_element_type = None
    108
    109 -    def reset_name_based( self ):
    110          self.full_name = None
    111          self.full_partial_name = None
    112          self.demangled_name = None
    113          self.declaration_path = None
    114          self.partial_declaration_path = None
    115          self.container_key_type = None
    116          self.container_element_type = None
    117
    118 -    def reset_access_type( self ):
    119          self.access_type = None
    120
    121 -class type_algs_cache_t( object ):
    122      enabled = True
    123
    124      @staticmethod
    125 -    def disable():
    126          type_algs_cache_t.enabled = False
    127
    128      @staticmethod
    129 -    def enable( self ):
    130          type_algs_cache_t.enabled = True
    131
    132 -    def __init__( self ):
    133          object.__init__( self )
    134          self._remove_alias = None
    135
    136 -    def _get_remove_alias( self ):
    137          return self._remove_alias
    138 -    def _set_remove_alias( self, remove_alias ):
    139          if not type_algs_cache_t.enabled:
    140              remove_alias = None
    141          self._remove_alias = remove_alias
    142
    143      remove_alias = property( _get_remove_alias, _set_remove_alias )
    144
    145 -    def reset(self):
    146          self.remove_alias = None
    147