Package pike :: Module core :: Class FlagEnum
[hide private]
[frames] | no frames]

Class FlagEnum

source code

object --+        
         |        
      long --+    
             |    
          Enum --+
                 |
                FlagEnum
Known Subclasses:

Flag Enumeration

Subclass this class to define enumerations of flags. For example:

   class SomeFlagEnumClass(Enum):
       FOO = 0x1
       BAR = 0x2
       BAZ = 0x4

Accessing SomeFlagEnumClass.FOO will actually return a SomeFlagEnumClass instance. Instances may be bitwise-ored together. Instances will return the symbolic names of all set flags joined by ' | ' when str() is used.

Nested Classes [hide private]

Inherited from Enum: __metaclass__

Instance Methods [hide private]
 
__and__(self, o)
x&y
source code
 
__or__(self, o)
x|y
source code
 
__str__(self)
str(x)
source code

Inherited from Enum: __repr__

Inherited from long: __abs__, __add__, __cmp__, __coerce__, __div__, __divmod__, __float__, __floordiv__, __format__, __getattribute__, __getnewargs__, __hash__, __hex__, __index__, __int__, __invert__, __long__, __lshift__, __mod__, __mul__, __neg__, __nonzero__, __oct__, __pos__, __pow__, __radd__, __rand__, __rdiv__, __rdivmod__, __rfloordiv__, __rlshift__, __rmod__, __rmul__, __ror__, __rpow__, __rrshift__, __rshift__, __rsub__, __rtruediv__, __rxor__, __sizeof__, __sub__, __truediv__, __trunc__, __xor__, bit_length, conjugate

Inherited from object: __delattr__, __init__, __reduce__, __reduce_ex__, __setattr__, __subclasshook__

Class Methods [hide private]
 
validate(cls, value)
Validate value as valid for enumeration.
source code

Inherited from Enum: import_items, items, names, values

Static Methods [hide private]

Inherited from Enum: __new__

Class Variables [hide private]

Inherited from Enum (private): _nametoval, _valtoname

Properties [hide private]

Inherited from long: denominator, imag, numerator, real

Inherited from object: __class__

Method Details [hide private]

__and__(self, o)
(And operator)

source code 

x&y

Overrides: long.__and__
(inherited documentation)

__or__(self, o)
(Or operator)

source code 

x|y

Overrides: long.__or__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 

str(x)

Overrides: object.__str__
(inherited documentation)

validate(cls, value)
Class Method

source code 

Validate value as valid for enumeration.

This must be implemented in subclasses of Enum (but not ValueEnum or FlagEnum, which provide it). It should raise a ValueError on failure.

Overrides: Enum.validate
(inherited documentation)