dissect.cstruct.types.flag
¶
Module Contents¶
Classes¶
Flag type supercharged with cstruct functionality. |
- class dissect.cstruct.types.flag.Flag¶
Bases:
dissect.cstruct.types.base.BaseType
,enum.IntFlag
Flag type supercharged with cstruct functionality.
- Flags are (mostly) compatible with the Python 3 standard library
IntFlag
with some notable differences: Flag members are only considered equal if the flag class is the same
Flags can be made using any integer type.
Example
When using the default C-style parser, the following syntax is supported:
flag <name> [: <type>] { <values> };
For example, a flag that has A=1, B=4 and C=8 could be written like so:
flag Test : uint16 { A, B=4, C };
- __repr__() str ¶
Return repr(self).
- __str__() str ¶
Return str(self).
- __hash__() int ¶
Return hash(self).
- Flags are (mostly) compatible with the Python 3 standard library