arsd.declarativeloader

A declarative file/stream loader/saver. You define structs with a handful of annotations, this read and writes them to/from files.

Members

Enums

BigEndian
enum BigEndian
LittleEndian
enum LittleEndian
NotSaved
enum NotSaved

The marked field is not in the actual file

VariableLength
enum VariableLength

@VariableLength indicates the value is saved in a MIDI like format

Functions

MustBe
auto MustBe(T t)

Insists the field must be a certain value, like for magic numbers

Tag
auto Tag(T t)

@Tagged!Field indicates a tagged union. Each struct within should have @Tag(X) which is a value of Field

loadFrom
int loadFrom(ref T t, auto ref Range r, bool assumeBigEndian = false)

input range of ubytes...

Structs

NumBytes
struct NumBytes(alias field)
NumElements
struct NumElements(alias field)

@NumBytes!Field or @NumElements!Field controls length of embedded arrays

Tagged
struct Tagged(alias field)

@Tagged!Field indicates a tagged union. Each struct within should have @Tag(X) which is a value of Field

presentIf
struct presentIf

For example @presentIf("version >= 2") int addedInVersion2;

Meta

Suggestion Box / Bug Report