CYAML
|
#include <cyaml.h>
Data Fields | |
enum cyaml_type | type |
enum cyaml_flag | flags |
uint32_t | data_size |
union { | |
struct { | |
uint32_t min | |
uint32_t max | |
} string | |
struct { | |
const struct cyaml_schema_field * fields | |
} mapping | |
struct { | |
const struct cyaml_bitdef * bitdefs | |
uint32_t count | |
} bitfield | |
struct { | |
const struct cyaml_schema_value * entry | |
uint32_t min | |
uint32_t max | |
} sequence | |
struct { | |
const cyaml_strval_t * strings | |
uint32_t count | |
} enumeration | |
}; | |
Schema definition for a value.
This is the fundamental building block of CYAML schemas. The load, save and free functions take parameters of this type to explain what the top-level type of the YAML document should be.
Values of type CYAML_SEQUENCE and CYAML_SEQUENCE_FIXED contain a reference to another cyaml_schema_value representing the type of the entries of the sequence. For example, if you want a sequence of integers, you'd have a cyaml_schema_value for the for the sequence value type, and another for the integer value type.
Values of type CYAML_MAPPING contain an array of cyaml_schema_field entries, defining the YAML keys allowed by the mapping. Each field contains a cyaml_schema_value representing the schema for the value.
union { ... } cyaml_schema_value::@1 |
Anonymous union containing type-specific attributes.
const struct cyaml_bitdef* cyaml_schema_value::bitdefs |
Array of bit definitions for the bit field.
struct { ... } cyaml_schema_value::bitfield |
CYAML_BITFIELD type-specific schema data.
uint32_t cyaml_schema_value::count |
Entry count for bitdefs array.
Entry count for strings array.
uint32_t cyaml_schema_value::data_size |
Size of the value's client data type in bytes.
For example, short
int
, long
, int8_t
, etc are all signed integer types, so they would have the type CYAML_INT, however, they have different sizes.
const struct cyaml_schema_value* cyaml_schema_value::entry |
Schema definition for the type of the entries in the sequence.
All of a sequence's entries must be of the same type, and a sequence can not have an entry type of type CYAML_SEQUENCE (although CYAML_SEQUENCE_FIXED is allowed). That is, you can't have a sequence of variable-length sequences.
struct { ... } cyaml_schema_value::enumeration |
CYAML_ENUM and CYAML_FLAGS type-specific schema data.
const struct cyaml_schema_field* cyaml_schema_value::fields |
Array of cyaml mapping field schema definitions.
The array must be terminated by an entry with a NULL key. See cyaml_schema_field_t and CYAML_FIELD_END for more info.
enum cyaml_flag cyaml_schema_value::flags |
Flags indicating value's characteristics.
struct { ... } cyaml_schema_value::mapping |
CYAML_MAPPING type-specific schema data.
uint32_t cyaml_schema_value::max |
Maximum string length (bytes).
data_size - 1
.Maximum number of sequence entries.
uint32_t cyaml_schema_value::min |
Minimum string length (bytes).
Minimum number of sequence entries.
struct { ... } cyaml_schema_value::sequence |
CYAML_SEQUENCE and CYAML_SEQUENCE_FIXED type-specific schema data.
struct { ... } cyaml_schema_value::string |
CYAML_STRING type-specific schema data.
const cyaml_strval_t* cyaml_schema_value::strings |
Array of string / value mappings defining enum.
enum cyaml_type cyaml_schema_value::type |
The type of the value defined by this schema entry.