:py:mod:`dissect.cstruct.types.flag` ==================================== .. py:module:: dissect.cstruct.types.flag Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.cstruct.types.flag.Flag .. py:class:: Flag Bases: :py:obj:`dissect.cstruct.types.base.BaseType`, :py:obj:`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. .. 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:: __repr__() -> str Return repr(self). .. py:method:: __str__() -> str Return str(self). .. py:method:: __eq__(other: int | Flag) -> bool Return self==value. .. py:method:: __ne__(value: int | Flag) -> bool Return self!=value. .. py:method:: __hash__() -> int Return hash(self).