ludus::content::string_dictionary¶
Ludus Wiki · API overview · Browse API
Namespace
Related declarations¶
- ludus::content::string_dictionary::StringDictionaryDiagnostic
- ludus::content::string_dictionary::StringDictionaryView
- ludus::content::string_dictionary::StringDictionaryWriter
- ludus::content::string_dictionary::StringDictionaryWriterConfig
Enumerations¶
StringDictionaryStatus¶
enum class StringDictionaryStatus : uint8
Result of a dictionary read, lookup or write operation.
Related types: uint8
Ok¶
Ok
The operation succeeded.
InvalidArgument¶
InvalidArgument
A configuration, view or output argument violates the API contract.
Malformed¶
Malformed
The bytes violate the structural or canonical-order rules of the format.
UnsupportedVersion¶
UnsupportedVersion
The header names a format version this reader does not implement.
RevisionMismatch¶
RevisionMismatch
The dictionary belongs to a different content revision than expected.
LimitExceeded¶
LimitExceeded
A count, spelling length or byte size exceeds a format or configured limit.
InvalidUtf8¶
InvalidUtf8
A spelling is not strict UTF-8 under BYTE_POLICY_UTF8.
EmbeddedZero¶
EmbeddedZero
A spelling contains a zero byte.
OutOfMemory¶
OutOfMemory
The allocation domain could not supply working storage.
InvalidHandle¶
InvalidHandle
The dictionary or writer is empty, or an index is out of range.
NotFound¶
NotFound
No entry has exactly the requested spelling.
InvalidState¶
InvalidState
The writer is not in the required lifecycle state, or its table metadata is corrupt.
Aliases¶
RevisionDigest¶
using ludus::content::string_dictionary::RevisionDigest = foundation::StaticArray<uint8, string_dictionary_format::REVISION_DIGEST_BYTES>
Producer-supplied identity of the content revision a dictionary belongs to.
Related types: string_dictionary_format::REVISION_DIGEST_BYTES · foundation::StaticArray · uint8
Functions¶
ReadStringDictionary¶
StringDictionaryStatus ludus::content::string_dictionary::ReadStringDictionary(foundation::BorrowedView< const uint8 > bytes, const RevisionDigest &expectedRevision, StringDictionaryView &outDictionary, StringDictionaryDiagnostic &outDiagnostic)
Validates a LUSTR dictionary and binds a view to the caller's bytes.
Every header field, size, offset, terminator, byte policy and the canonical strictly increasing order are checked before any spelling becomes visible. Unaligned input is supported. No allocation or I/O occurs, and nothing is copied.
| Parameter | Description |
|---|---|
bytes |
The complete dictionary; trailing bytes are rejected. The caller keeps them alive and unmodified while the resulting view is used.
|
expectedRevision |
Revision the caller's records were cooked against; a dictionary from any other revision is rejected rather than remapped.
|
outDictionary |
Receives the view on success; unchanged on failure.
|
outDiagnostic |
Receives the status and, on failure, the first offending byte offset.
|
Returns
Ok, InvalidArgument, Malformed, UnsupportedVersion, RevisionMismatch, LimitExceeded, InvalidUtf8 or EmbeddedZero.
Related types: StringDictionaryView · foundation::BorrowedView · StringDictionaryStatus · RevisionDigest · uint8 · StringDictionaryDiagnostic
CreateStringDictionaryWriter¶
StringDictionaryStatus ludus::content::string_dictionary::CreateStringDictionaryWriter(const StringDictionaryWriterConfig &config, const foundation::AllocationDomain &domain, StringDictionaryWriter &outWriter)
Creates an empty writer holding only the empty entry.
| Parameter | Description |
|---|---|
config |
Limits and byte policy; validated against the format limits.
|
domain |
Allocation domain for all working storage; must outlive the writer.
|
outWriter |
Must be empty. Receives the writer on success; unchanged on failure.
|
Returns
Ok, InvalidArgument, OutOfMemory or LimitExceeded.
Related types: StringDictionaryWriter · foundation::AllocationDomain · StringDictionaryStatus · StringDictionaryWriterConfig