dissect.cstruct.types.flag
¶
Module Contents¶
Classes¶
Implements a Flag type. |
|
Implements a value instance of a Flag |
- class dissect.cstruct.types.flag.Flag(cstruct: Enum.__init__.cstruct, name: str, type_: dissect.cstruct.types.BaseType, values: Dict[str, int])¶
Bases:
dissect.cstruct.types.Enum
Implements a Flag type.
Flags can be made using any type. The API for accessing flags and their values is very similar to Python 3 native flags.
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 Testuint16 {
A, B=4, C
};
- __call__(value: int | BinaryIO) FlagInstance ¶
- class dissect.cstruct.types.flag.FlagInstance(enum: Enum, value: int)¶
Bases:
dissect.cstruct.types.EnumInstance
Implements a value instance of a Flag
- property name: str¶
- __nonzero__¶
- __ror__¶
- __rand__¶
- __rxor__¶
- __bool__()¶
- __or__(other: int | FlagInstance) FlagInstance ¶
- __and__(other: int | FlagInstance) FlagInstance ¶
- __xor__(other: int | FlagInstance) FlagInstance ¶
- __invert__() FlagInstance ¶
- __str__() str ¶
Return str(self).
- __repr__() str ¶
Return repr(self).
- decompose() Tuple[List[str], int] ¶