Compare commits
2 Commits
e29dbcc00c
...
8524113fcd
Author | SHA1 | Date | |
---|---|---|---|
8524113fcd | |||
2bda7b4b1f |
@ -1,10 +1,10 @@
|
|||||||
# Bitmask
|
# Bitmask
|
||||||
|
|
||||||
Implementation of a Bitmask class in Python, allowing easy manipulation of EnumFlag values.
|
Implementation of a Bitmask class in Python, allowing easy manipulation of IntFlag values.
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
* create bitmasks from any EnumFlag type
|
* create bitmasks from any IntFlag type
|
||||||
|
|
||||||
* simple "flag in Bitmask" syntax
|
* simple "flag in Bitmask" syntax
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ class Bitmask:
|
|||||||
"""Generic bitmask, which represents multiple Enum values.
|
"""Generic bitmask, which represents multiple Enum values.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
AllFlags (Enum): Enum of values with corresponding bitmasks.
|
|
||||||
flags: Variable length list of flags to enable.
|
flags: Variable length list of flags to enable.
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
@ -57,7 +56,12 @@ class Bitmask:
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def AllFlags(self):
|
def AllFlags(self):
|
||||||
"""Enum defining all flags used in the bitmask, and their values."""
|
"""Enum defining all flags used in the bitmask, and their values.
|
||||||
|
|
||||||
|
This is automatically set after operations with flags, and can not be
|
||||||
|
changed later. The attribute can also be manually set, if the mask is
|
||||||
|
undefined.
|
||||||
|
"""
|
||||||
return self._AllFlags
|
return self._AllFlags
|
||||||
|
|
||||||
@AllFlags.setter
|
@AllFlags.setter
|
||||||
@ -81,8 +85,8 @@ class Bitmask:
|
|||||||
"""Format the acceptable types for use in operations.
|
"""Format the acceptable types for use in operations.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
String of format "[self's type] or [self's Enum type]". If we do
|
String of format "[self's type] or [self's Enum type]". If AllFlags
|
||||||
not have an Enum assigned yet, only self's type will be returned.
|
isn't defined, only self's type will be returned.
|
||||||
"""
|
"""
|
||||||
types = []
|
types = []
|
||||||
types.append(type_name(self))
|
types.append(type_name(self))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user