| Value | Meaning |
|---|---|
| None0 | Apply no settings. |
| ArrayAsObject1 << 0 | Tells the serialiser that the array field it is attached to, or all array fields in the attached struct should be serialised as a child object. Notes: This only works on arrays of struct types for now. If there are two arrays in the struct that contain the same type then this settings must be used for correct serialisation. Example: Take the given struct. struct Point{int x; int y;}
struct Foo
{
Point[] pointA = [Point(60, 60), Point(120, 120)];
@Setting(Serialiser.Settings.ArrayAsObject)
Point[] pointB = [Point(60, 60), Point(200, 200)];
}Using the SDLang archive, this would generate. Foo {
// The ones embedded inside this scope are from 'pointA'
Point {
x 60
y 60
}
Point {
x 120
y 120
}
pointB {
Point {
x 60
y 60
}
Point {
x 200
y 200
}
}
} |
| EnumAsValue1 << 1 | Tells the serialiser that the enum's value (instead of it's name) should be used as the serialised output. Notes: This setting only affects fields that are of an enum type. For enum types that are to be ORed together (such as an enum representing a set of flags), this is the only way to correctly serialise the data. Example: Take the given code: enum Flags
{
Flag1 = 1 // 0b01
Flag2 = 2 // 0b10
}
struct Foo
{
@Setting(Serialiser.Settings.EnumAsValue)
Flags firstFlag = Flags.Flag1 | Flags.Flag2;
Flags secondFlag = Flags.Flag1;
}Using the SDLang archive, this would generate the following: Foo {
firstFlag 3
secondFlag "Flag1"
} |
See the UDA called Settings.