Loading...
Searching...
No Matches
cyaml_schema_value Struct Reference

`#include <cyaml.h>`

Collaboration diagram for cyaml_schema_value:
[legend]

## 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
}; |

## Detailed Description

Schema definition for a value.

Note
  There are convenience macros for each of the types to assist in building a CYAML schema data structure for your YAML documents.

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.

## Field Documentation

## [union]

union { ... } cyaml_schema_value

Anonymous union containing type-specific attributes.

## bitdefs

const struct cyaml_bitdef* cyaml_schema_value::bitdefs

Array of bit definitions for the bit field.

## [struct]

struct { ... } cyaml_schema_value::bitfield

CYAML_BITFIELD type-specific schema data.

## count

uint32_t cyaml_schema_value::count

Entry count for bitdefs array.

Entry count for strings array.

## data_size

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.

## entry

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]

struct { ... } cyaml_schema_value::enumeration

CYAML_ENUM and CYAML_FLAGS type-specific schema data.

## fields

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.

## flags

enum cyaml_flag cyaml_schema_value::flags

Flags indicating value's characteristics.

## [struct]

struct { ... } cyaml_schema_value::mapping

CYAML_MAPPING type-specific schema data.

## max

uint32_t cyaml_schema_value::max

Maximum string length (bytes).

Note
  Excludes trailing NULL, so for character array strings (rather than pointer strings), this must be no more than data_size - 1.

Maximum number of sequence entries.

Note
  min and max must be the same for CYAML_SEQUENCE_FIXED.

## min

uint32_t cyaml_schema_value::min

Minimum string length (bytes).

Note
  Excludes trailing NUL.

Minimum number of sequence entries.

Note
  min and max must be the same for CYAML_SEQUENCE_FIXED.

## [struct]

struct { ... } cyaml_schema_value::sequence

CYAML_SEQUENCE and CYAML_SEQUENCE_FIXED type-specific schema data.

## [struct]

struct { ... } cyaml_schema_value::string

CYAML_STRING type-specific schema data.

## strings

const cyaml_strval_t* cyaml_schema_value::strings

Array of string / value mappings defining enum.

## type

enum cyaml_type cyaml_schema_value::type

The type of the value defined by this schema entry.

The documentation for this struct was generated from the following file:

- include/cyaml/cyaml.h