Domain
source: bluebase/core/domain.py
- class Domain[source]
Bases:
ABCAn abstract base class for domains.
- ENDIAN: ClassVar[str] = '<'
The endian format used by the
structmodule.
- enum: ClassVar[int]
The enum value of the domain.
- classmethod restore(enum: int, size: int | None = None) Domain[source]
Restore a domain from its enum value and size.
The size is required only for
StringDomain.
- classmethod parse(format: str) Domain[source]
Restore a domain from its format.
Remove the endian prefix, if present, and use the default endian.
- abstract property format: strread-only
The format of the domain.
This format is used by the
structmodule.
- property size: intread-only
The size of the domain.
- dataclassclass BoolDomain[source]
Bases:
DomainA domain for
boolvalues.- enum: ClassVar[int] = 0
The enum value of the domain.
- property format: strread-only
The format of the domain.
This format is used by the
structmodule.
- dataclassclass IntDomain[source]
Bases:
DomainA domain for
intvalues.- enum: ClassVar[int] = 1
The enum value of the domain.
- property format: strread-only
The format of the domain.
This format is used by the
structmodule.
- dataclassclass FloatDomain[source]
Bases:
DomainA domain for
floatvalues.- enum: ClassVar[int] = 2
The enum value of the domain.
- property format: strread-only
The format of the domain.
This format is used by the
structmodule.
- dataclassclass StringDomain(length: int)[source]
Bases:
DomainA domain for
strvalues.- Variables:
length (int) – the length of a string
- Raises:
ValueError – if the string length is invalid
- ENCODING: ClassVar[str] = 'utf-8'
The encoding used for strings.
- MAX_LENGTH: ClassVar[int] = 255
The maximum length of a string.
- enum: ClassVar[int] = 3
The enum value of the domain.
- property format: strread-only
The format of the domain.
This format is used by the
structmodule.