Soletta™ Framework
Framework for making IoT devices

Full online documentation | C API Index
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Fields
sol_memdesc_serialize_options Struct Reference

Options on how to serialize a memory given its description. More...

#include <sol-memdesc.h>

Data Fields

uint16_t api_version
 API version, must match SOL_MEMDESC_SERIALIZE_OPTIONS_API_VERSION at runtime. More...
 
struct {
   struct {
      const struct sol_str_slice   end
 Used when finishing a array. More...
 
      const struct sol_str_slice   indent
 Used to indent a new array. More...
 
      const struct sol_str_slice   start
 Used when starting a new array. More...
 
   }   container
 
   struct {
      const struct sol_str_slice   end
 Used when finishing a array item. More...
 
      const struct sol_str_slice   indent
 Used to indent a new index. More...
 
      const struct sol_str_slice   start
 Used when starting a new array item. More...
 
   }   index
 
   struct sol_str_slice   separator
 Used if multiple items exist. More...
 
   bool   show_index
 Controls whenever the index is to be serialized. More...
 
   struct {
      const struct sol_str_slice   end
 Used when finishing array item value. More...
 
      const struct sol_str_slice   indent
 Used to indent a new value. More...
 
      const struct sol_str_slice   start
 Used when starting a new array item value. More...
 
   }   value
 
array
 options used by serialize_array_item More...
 
int(* serialize_array_item )(const struct sol_memdesc *desc, size_t idx, const void *memory, struct sol_buffer *buffer, const struct sol_memdesc_serialize_options *opts, struct sol_buffer *prefix)
 function used to format an array item. More...
 
int(* serialize_bool )(const struct sol_memdesc *desc, bool value, struct sol_buffer *buffer)
 function used to format a boolean. More...
 
int(* serialize_double )(const struct sol_memdesc *desc, double value, struct sol_buffer *buffer)
 function used to format a double precision floating point number. More...
 
int(* serialize_enumeration )(const struct sol_memdesc *desc, const void *memory, struct sol_buffer *buffer)
 function used to format an enumeration. More...
 
int(* serialize_int64 )(const struct sol_memdesc *desc, int64_t value, struct sol_buffer *buffer)
 function used to format a signed integer. More...
 
int(* serialize_pointer )(const struct sol_memdesc *desc, const void *value, struct sol_buffer *buffer)
 function used to format a pointer. More...
 
int(* serialize_string )(const struct sol_memdesc *desc, const char *value, struct sol_buffer *buffer)
 function used to format a string. More...
 
int(* serialize_structure_member )(const struct sol_memdesc *structure, const struct sol_memdesc_structure_member *member, const void *memory, struct sol_buffer *buffer, const struct sol_memdesc_serialize_options *opts, struct sol_buffer *prefix, bool is_first)
 function used to format a struct member. More...
 
int(* serialize_uint64 )(const struct sol_memdesc *desc, uint64_t value, struct sol_buffer *buffer)
 function used to format an unsigned integer. More...
 
struct {
   struct {
      const struct sol_str_slice   end
 Used when finishing a structure. More...
 
      const struct sol_str_slice   indent
 Used to indent a new container. More...
 
      const struct sol_str_slice   start
 Used when starting a new structure. More...
 
   }   container
 
   bool   detailed
 Controls whenever struct sol_memdesc_structure_member::detail is to be printed. More...
 
   struct {
      const struct sol_str_slice   end
 Used when finishing a structure member. More...
 
      const struct sol_str_slice   indent
 Used to indent a new key. More...
 
      const struct sol_str_slice   start
 Used when starting a new structure member. More...
 
   }   key
 
   struct sol_str_slice   separator
 Used if multiple members exist. More...
 
   bool   show_key
 Controls whenever the key is to be serialized. More...
 
   struct {
      const struct sol_str_slice   end
 Used when finishing structure value. More...
 
      const struct sol_str_slice   indent
 Used to indent a new value. More...
 
      const struct sol_str_slice   start
 Used when starting a new structure value. More...
 
   }   value
 
structure
 options used by serialize_structure_member. More...
 

Detailed Description

Options on how to serialize a memory given its description.

Field Documentation

uint16_t sol_memdesc_serialize_options::api_version

API version, must match SOL_MEMDESC_SERIALIZE_OPTIONS_API_VERSION at runtime.

struct { ... } sol_memdesc_serialize_options::array

options used by serialize_array_item

These options control the behavior of struct sol_memdesc_serialize_options::serialize_array_item.

struct { ... } sol_memdesc_serialize_options::container
struct { ... } sol_memdesc_serialize_options::container
bool sol_memdesc_serialize_options::detailed

Controls whenever struct sol_memdesc_structure_member::detail is to be printed.

If true, detail members will be printed. If false, only non-detail members will.

const struct sol_str_slice sol_memdesc_serialize_options::end

Used when finishing a structure.

Used when finishing array item value.

Used when finishing a array item.

Used when finishing a array.

Used when finishing structure value.

Used when finishing a structure member.

This is only to be used if struct sol_memdesc_serialize_options::structure::show_key.

This is only to be used if struct sol_memdesc_serialize_options::array::show_index.

const struct sol_str_slice sol_memdesc_serialize_options::indent

Used to indent a new container.

Used to indent a new index.

Used to indent a new array.

Used to indent a new value.

Used to indent a new key.

struct { ... } sol_memdesc_serialize_options::index
struct { ... } sol_memdesc_serialize_options::key
struct sol_str_slice sol_memdesc_serialize_options::separator

Used if multiple members exist.

Used if multiple items exist.

int(* sol_memdesc_serialize_options::serialize_array_item)(const struct sol_memdesc *desc, size_t idx, const void *memory, struct sol_buffer *buffer, const struct sol_memdesc_serialize_options *opts, struct sol_buffer *prefix)

function used to format an array item.

If not provided the function will print use the struct sol_str_slice under struct sol_memdesc_serialize_options::array. If struct sol_memdesc_serialize_options::array::show_index, then struct sol_memdesc_serialize_options::array::index::start and struct sol_memdesc_serialize_options::array::index::end are used around the idx.

If multiple items exist, they will be separated with struct sol_memdesc_serialize_options::array::separator.

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_bool)(const struct sol_memdesc *desc, bool value, struct sol_buffer *buffer)

function used to format a boolean.

If not provided "true" or "false" will be used.

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_double)(const struct sol_memdesc *desc, double value, struct sol_buffer *buffer)

function used to format a double precision floating point number.

If not provided printf() with "%g" will be used using the current locale.

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_enumeration)(const struct sol_memdesc *desc, const void *memory, struct sol_buffer *buffer)

function used to format an enumeration.

If not provided will place the enumeration as string (if available) or integer if not.

For ease of use one can use sol_memdesc_enumeration_to_str() and sol_memdesc_get_as_int64() on memory.

Note
the given value may be NULL!

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_int64)(const struct sol_memdesc *desc, int64_t value, struct sol_buffer *buffer)

function used to format a signed integer.

If not provided printf() will be used using the current locale.

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_pointer)(const struct sol_memdesc *desc, const void *value, struct sol_buffer *buffer)

function used to format a pointer.

If not provided printf() with "%p" will be used using the current locale.

Often this is used for NULL or when the desc->children is empty, otherwise the code will handle SOL_MEMDESC_TYPE_PTR as a structure, accessing the pointed memory.

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_string)(const struct sol_memdesc *desc, const char *value, struct sol_buffer *buffer)

function used to format a string.

If not provided will place the string inside double-quotes and inner quotes and non-printable chars will be escaped.

Note
the given value may be NULL!

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_structure_member)(const struct sol_memdesc *structure, const struct sol_memdesc_structure_member *member, const void *memory, struct sol_buffer *buffer, const struct sol_memdesc_serialize_options *opts, struct sol_buffer *prefix, bool is_first)

function used to format a struct member.

If not provided the function will print use the struct sol_str_slice under struct sol_memdesc_serialize_options::structure. If struct sol_memdesc_serialize_options::structure::show_key, then struct sol_memdesc_serialize_options::structure::key::start and struct sol_memdesc_serialize_options::structure::key::end are used around the struct sol_memdesc::name that is dumped as-is. If SOL_MEMDESC_DESCRIPTION is enabled, then struct sol_memdesc_serialize_options::structure::show_description is true, then the description is printed after value surrounded by struct sol_memdesc_serialize_options::structure::description::start and struct sol_memdesc_serialize_options::structure::description::end.

If multiple members exist, they will be separated with struct sol_memdesc_serialize_options::structure::separator.

Should return 0 on success, negative errno on failure.

int(* sol_memdesc_serialize_options::serialize_uint64)(const struct sol_memdesc *desc, uint64_t value, struct sol_buffer *buffer)

function used to format an unsigned integer.

If not provided printf() will be used using the current locale.

Should return 0 on success, negative errno on failure.

bool sol_memdesc_serialize_options::show_index

Controls whenever the index is to be serialized.

bool sol_memdesc_serialize_options::show_key

Controls whenever the key is to be serialized.

const struct sol_str_slice sol_memdesc_serialize_options::start

Used when starting a new structure.

Used when starting a new array item value.

Used when starting a new array item.

Used when starting a new array.

Used when starting a new structure value.

Used when starting a new structure member.

This is only to be used if struct sol_memdesc_serialize_options::structure::show_key.

This is only to be used if struct sol_memdesc_serialize_options::array::show_index.

struct { ... } sol_memdesc_serialize_options::structure

options used by serialize_structure_member.

These options control the behavior of struct sol_memdesc_serialize_options::serialize_structure_member.

struct { ... } sol_memdesc_serialize_options::value
struct { ... } sol_memdesc_serialize_options::value

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