dolor.types.numeric¶
Types for numbers.
- class Boolean[source]¶
Bases:
dolor.types.misc.StructTypeA boolean that corresponds to a single byte.
- fmt = '?'¶
- class Byte[source]¶
Bases:
dolor.types.misc.StructTypeA signed 8-bit integer.
- fmt = 'b'¶
- class UnsignedByte[source]¶
Bases:
dolor.types.misc.StructTypeAn unsigned 8-bit integer.
- fmt = 'B'¶
- class Short[source]¶
Bases:
dolor.types.misc.StructTypeA signed 16-bit integer.
- fmt = 'h'¶
- class UnsignedShort[source]¶
Bases:
dolor.types.misc.StructTypeAn unsigned 8-bit integer.
- fmt = 'H'¶
- class Int[source]¶
Bases:
dolor.types.misc.StructTypeA signed 32-bit integer.
- fmt = 'i'¶
- class UnsignedInt[source]¶
Bases:
dolor.types.misc.StructTypeAn unsigned 32-bit integer.
- fmt = 'I'¶
- class Long[source]¶
Bases:
dolor.types.misc.StructTypeA signed 64-bit integer.
- fmt = 'q'¶
- class UnsignedLong[source]¶
Bases:
dolor.types.misc.StructTypeAn unsigned 64-bit integer.
- fmt = 'Q'¶
- class Float[source]¶
Bases:
dolor.types.misc.StructTypeA 32-bit floating point value.
- fmt = 'f'¶
- class Double[source]¶
Bases:
dolor.types.misc.StructTypeA 64-bit floating point value.
- fmt = 'd'¶
- class VarNum[source]¶
Bases:
dolor.types.type.TypeA signed, variable-length integer.
To read the value, a byte is read, where the bottom 7 bits are a portion of the value, and the top bit indicates whether to read another byte and repeat the process.
If the bytes read would exceed the number of bytes needed to get the necessary bits (as specified with the
bitsattribute), then aValueErrorwill be raised. This is done to prevent a DOS attack that sends bytes that always have the top bit set, leading to an infinite amount of bytes being read.- bits¶
The maximum amount of bits before a
ValueErroris raised.- Type
int
- class VarInt[source]¶
Bases:
dolor.types.numeric.VarNumA signed, variable-length 32-bit integer.
- class VarLong[source]¶
Bases:
dolor.types.numeric.VarNumA signed, variable-length 64-bit integer.
- class Angle[source]¶
Bases:
dolor.types.type.TypeRepresents an angle.
The value is in radians.