This class emulates a C-like enum for python. More...
Public Member Functions | |
| def | __init__ (self, keys, offset=0) |
| Canonical constructor. More... | |
| def | contains (self, key) |
| Return true if this enumerate contains the specified key string. More... | |
| def | isValid (self, value) |
| Returns true if the specified integer value is defined as an identifier in this enumerate. More... | |
| def | listkeys (self) |
| Returns the list of keys in this enumerate. More... | |
| def | listvalues (self) |
| Returns the list of values specified to initiate this enumerate. More... | |
| def | keyOf (self, value) |
| Returns the symbolic key string associated to the specified identifier value. More... | |
Private Attributes | |
| _dict_keynumbers | |
| _dict_numberkeys | |
This class emulates a C-like enum for python.
It is initialized with a list of strings to be used as the enum symbolic keys. The enum values are automatically generated as sequencing integer starting at the specified offset value.
This class emulates a C-like enum for python. It is initialized with a list of strings to be used as the enum symbolic keys. The enum values are automatically generated as sequencing integer starting at the specified offset value.
| def KERNEL_PY.kernel.enumerate.Enumerate.__init__ | ( | self, | |
| keys, | |||
offset = 0 |
|||
| ) |
Canonical constructor.
| keys | a list of string to be used as the enum symbolic keys. The enum values are automatically generated as a sequence of integers starting at the specified offset value. |
Canonical constructor @keys a list of string to be used as the enum symbolic keys. The enum values are automatically generated as a sequence of integers starting at the specified offset value.
| def KERNEL_PY.kernel.enumerate.Enumerate.contains | ( | self, | |
| key | |||
| ) |
Return true if this enumerate contains the specified key string.
| key | a key string to test |
Return true if this enumerate contains the specified key string @key a key string to test
References enumerate.Enumerate._dict_keynumbers, and KERNEL_PY.kernel.enumerate.Enumerate._dict_keynumbers.
| def KERNEL_PY.kernel.enumerate.Enumerate.isValid | ( | self, | |
| value | |||
| ) |
Returns true if the specified integer value is defined as an identifier in this enumerate.
| value | a value to test |
Returns true if the specified integer value is defined as an identifier in this enumerate. @value a value to test
References enumerate.Enumerate._dict_numberkeys, and KERNEL_PY.kernel.enumerate.Enumerate._dict_numberkeys.
Referenced by enumerate.Enumerate.keyOf(), and KERNEL_PY.kernel.enumerate.Enumerate.keyOf().
| def KERNEL_PY.kernel.enumerate.Enumerate.keyOf | ( | self, | |
| value | |||
| ) |
Returns the symbolic key string associated to the specified identifier value.
| value | an integer value whose associated key string is requested. |
Returns the symbolic key string associated to the specified identifier value. @param value : an integer value whose associated key string is requested.
References enumerate.Enumerate._dict_numberkeys, KERNEL_PY.kernel.enumerate.Enumerate._dict_numberkeys, enumerate.Enumerate.isValid(), and KERNEL_PY.kernel.enumerate.Enumerate.isValid().
| def KERNEL_PY.kernel.enumerate.Enumerate.listkeys | ( | self | ) |
Returns the list of keys in this enumerate.
Returns the list of keys in this enumerate.
References enumerate.Enumerate._dict_keynumbers, and KERNEL_PY.kernel.enumerate.Enumerate._dict_keynumbers.
| def KERNEL_PY.kernel.enumerate.Enumerate.listvalues | ( | self | ) |
Returns the list of values specified to initiate this enumerate.
Returns the list of values specified to initiate this enumerate.
References enumerate.Enumerate._dict_numberkeys, and KERNEL_PY.kernel.enumerate.Enumerate._dict_numberkeys.
|
private |
|
private |