:py:mod:`dissect.cstruct.types.flag` ==================================== .. py:module:: dissect.cstruct.types.flag Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.cstruct.types.flag.Flag dissect.cstruct.types.flag.FlagInstance .. py:class:: Flag(cstruct: Enum.__init__.cstruct, name: str, type_: dissect.cstruct.types.BaseType, values: Dict[str, int]) Bases: :py:obj:`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. .. rubric:: Example When using the default C-style parser, the following syntax is supported: flag [: ] { }; 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 }; .. py:method:: __call__(value: Union[int, BinaryIO]) -> FlagInstance .. py:class:: FlagInstance(enum: Enum, value: int) Bases: :py:obj:`dissect.cstruct.types.EnumInstance` Implements a value instance of a Flag .. py:property:: name :type: str .. py:attribute:: __nonzero__ .. py:attribute:: __ror__ .. py:attribute:: __rand__ .. py:attribute:: __rxor__ .. py:method:: __bool__() .. py:method:: __or__(other: Union[int, FlagInstance]) -> FlagInstance .. py:method:: __and__(other: Union[int, FlagInstance]) -> FlagInstance .. py:method:: __xor__(other: Union[int, FlagInstance]) -> FlagInstance .. py:method:: __invert__() -> FlagInstance .. py:method:: __str__() -> str Return str(self). .. py:method:: __repr__() -> str Return repr(self). .. py:method:: decompose() -> Tuple[List[str], int]