Trees | Indices | Help |
|
---|
|
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 that configure enumeration declaration exposing""" 7 8 import decl_wrapper 9 from pyplusplus import messages 10 from pygccxml import declarations 1113 """defines a set of properties, that will instruct Py++ how to expose the enumeration 14 15 By default, Py++ will export all enumeration values. 16 """8318 declarations.enumeration_t.__init__(self, *arguments, **keywords ) 19 decl_wrapper.decl_wrapper_t.__init__( self ) 20 21 # A dict with new names for particular enumeration values 22 # Key: Original name as it appears in the C++ source file 23 # Value: New name as it should appear in the Python bindings 24 self._value_aliases = {} 25 26 # A list of enumeration names (C++ names, not aliases!) that should be 27 # exported. 28 # By default, export all values 29 self._export_values = None3034 self._value_aliases = value_aliases35 value_aliases = property( _get_value_aliases, _set_value_aliases, doc= 36 """A translation table from C++ enumeration value names to desired Python names. 37 @type: dict""") 3840 if self._export_values is None: 41 return map(lambda x: x[0], self.values) 42 else: 43 return self._export_values45 self._export_values = export_values46 export_values = property( _get_export_values, _set_export_values, doc= 47 """A list of (C++) enumeration names that should be exported. 48 @type: list""") 4951 all_values = map(lambda x: x[0], self.values) 52 export_values = self.export_values 53 res = [] 54 for name in all_values: 55 if name not in export_values: 56 res.append(name) 57 return res5860 all_values = map(lambda x: x[0], self.values) 61 export_values = [] 62 for name in all_values: 63 if name not in no_export_values: 64 export_values.append(name) 65 self.export_values = export_values66 67 no_export_values = property( _get_no_export_values, _set_export_values, doc= 68 """A list of (C++) enumeration names that should not be exported. 69 @type: list""") 7072 msgs = [] 73 if self.name: 74 name2value = self.get_name2value_dict() 75 if len( set( name2value.keys() ) ) != len( set( name2value.values() ) ): 76 msgs.append( messages.W1032 ) 77 return msgs78
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Oct 20 08:51:43 2008 | http://epydoc.sourceforge.net |