:py:mod:`dissect.cstruct.types.enum` ==================================== .. py:module:: dissect.cstruct.types.enum Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.cstruct.types.enum.Enum dissect.cstruct.types.enum.EnumInstance .. py:class:: Enum(cstruct: Enum.__init__.cstruct, name: str, type_: dissect.cstruct.types.BaseType, values: Dict[str, int]) Bases: :py:obj:`dissect.cstruct.types.RawType` Implements an Enum type. Enums can be made using any type. The API for accessing enums and their values is very similar to Python 3 native enums. .. rubric:: Example When using the default C-style parser, the following syntax is supported: enum [: ] { }; For example, an enum that has A=1, B=5 and C=6 could be written like so: enum Test : uint16 { A, B=5, C }; .. py:method:: __call__(value: Union[int, BinaryIO]) -> EnumInstance .. py:method:: __getitem__(attr: str) -> EnumInstance .. py:method:: __getattr__(attr: str) -> EnumInstance .. py:method:: __contains__(attr: str) -> bool .. py:method:: default() -> EnumInstance Return a default value of this type. .. py:method:: default_array(count: int) -> List[EnumInstance] Return a default array of this type. .. py:class:: EnumInstance(enum: Enum, value: int) Implements a value instance of an Enum .. py:property:: name :type: str .. py:method:: __eq__(value: Union[int, EnumInstance]) -> bool Return self==value. .. py:method:: __ne__(value: Union[int, EnumInstance]) -> bool Return self!=value. .. py:method:: __hash__() -> int Return hash(self). .. py:method:: __str__() -> str Return str(self). .. py:method:: __int__() -> int .. py:method:: __repr__() -> str Return repr(self).