The encoding consists of the byte-length of the string minus minimum
plus 1 as an 8-bit fixed-length unsigned integer followed by the UTF-8 encoding of the input value.
More...
Public Attributes | |
const std::uint64_t | minimum |
The inclusive minimum string UTF-8 byte-length. | |
const std::uint64_t | maximum |
The inclusive maximum string UTF-8 byte-length. | |
The encoding consists of the byte-length of the string minus minimum
plus 1 as an 8-bit fixed-length unsigned integer followed by the UTF-8 encoding of the input value.
Optionally, if the input string has already been encoded to the buffer using UTF-8, the encoding may consist of the byte constant 0x00
followed by the byte-length of the string minus minimum
plus 1 as an 8-bit fixed-length unsigned integer, followed by the current offset minus the offset to the start of the UTF-8 string value in the buffer encoded as a Base-128 64-bit Little Endian variable-length unsigned integer.
The byte-length of the string is encoded even if maximum
equals minimum
in order to disambiguate between shared and non-shared fixed strings.
Option | Type | Description |
---|---|---|
minimum | uint | The inclusive minimum string UTF-8 byte-length |
maximum | uint | The inclusive maximum string UTF-8 byte-length |
Condition | Description |
---|---|
len(value) >= minimum | The input string byte-length is equal to or greater than the minimum |
len(value) <= maximum | The input string byte-length is equal to or less than the maximum |
maximum - minimum < 2 ** 8 - 1 | The range minus 1 must be representable in 8 bits |
Given the input string foo
with a minimum 3 and a maximum 5 where the string has not been previously encoded, the encoding results in:
Given the encoding of foo
with a minimum of 0 and a maximum of 6 followed by the encoding of foo
with a minimum of 3 and a maximum of 100, the encoding may result in: