sdlss 0.3.4
SDLang struct serialize
To use this package, run the following command in your project's root directory:
Manual usage
Put the following dependency into your project's dependences section:
SDLang struct serialize
Rules
- use bool, string, int, double, Date, DateTimeFrac, Duration, ubyte[], structs and they arrays for fields type
- enum converts to strings
- byte, ubyte, short, ushort converts to int
- float and real converts to double
- attributes not used (see TODO)
- no value in sdl set default struct field value
- empty value in sdl for arrays set struct field to []
- structs arrays define as duplicate tags
- simple type arrays space separated values (ex "foo 1 2 3" -> int[] foo = [1,2,3])
- if multiple tag defined for settings fields used last
Example
app.d
struct Settings
{
struct Com
{
string dev = "/dev/ttyUSB0";
int baudrate = 19200;
string mode = "8N1";
}
Com com;
struct Data
{
string name;
int[] signal;
}
Data[] data = [Data("first", [1, 1, 2, 3, 5])];
}
auto sets = readStruct!Settings("settings.sdl");
settings.sdl
com {
dev "/dev/ttyUSB0"
baudrate 19200
mode "8N1"
}
data {
name "first"
signal 1 1 2 3 5
}
data {
name "second"
signal 1 4 8
}
see example
- Registered by Oleg
- 0.3.4 released 5 years ago
- deviator/sdlss
- MIT
- Copyright © 2018, Oleg Butko
- Authors:
- Dependencies:
- sdlang-d
- Versions:
-
0.3.4 2019-May-31 0.3.3 2018-May-03 0.3.2 2018-Apr-21 0.3.1 2018-Apr-21 0.3.0 2018-Apr-21 - Download Stats:
-
-
0 downloads today
-
0 downloads this week
-
0 downloads this month
-
134 downloads total
-
- Score:
- 0.1
- Short URL:
- sdlss.dub.pm