:py:mod:`dissect.cstruct.types.structure` ========================================= .. py:module:: dissect.cstruct.types.structure Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: dissect.cstruct.types.structure.Field dissect.cstruct.types.structure.Structure dissect.cstruct.types.structure.Union .. py:class:: Field(name: str, type_: dissect.cstruct.types.BaseType, bits: int = None, offset: int = None) Holds a structure field. .. py:method:: __repr__() Return repr(self). .. py:class:: Structure(cstruct: Structure.__init__.cstruct, name: str, fields: List[Field] = None, align: bool = False, anonymous: bool = False) Bases: :py:obj:`dissect.cstruct.types.BaseType` Type class for structures. .. py:method:: __len__() -> int .. py:method:: __repr__() -> str Return repr(self). .. py:method:: add_field(name: str, type_: dissect.cstruct.types.BaseType, bits: int = None, offset: int = None) -> None Add a field to this structure. :param name: The field name. :param type_: The field type. :param bits: The bit of the field. :param offset: The field offset. .. py:method:: default() -> dissect.cstruct.types.Instance Create and return an empty Instance from this structure. :returns: An empty Instance from this structure. .. py:method:: show(indent: int = 0) -> None Pretty print this structure. .. py:class:: Union(cstruct: Structure.__init__.cstruct, name: str, fields: List[Field] = None, align: bool = False, anonymous: bool = False) Bases: :py:obj:`Structure` Type class for unions .. py:method:: __repr__() -> str Return repr(self). .. py:method:: show(indent: int = 0) -> None :abstractmethod: Pretty print this structure.