|
CX Framework
Cross-platform C utility framework
|
#include <serwriter.h>
Data Fields | |
| bool(* | arrBegin )(SerWriter *w, int32 count) |
| bool(* | mapBegin )(SerWriter *w, int32 count) |
| bool(* | mapKeyTyped )(SerWriter *w, const STypeInfoExt *kt, stgeneric key) |
| bool(* | refDef )(SerWriter *w, uint32 id) |
| bool(* | refUse )(SerWriter *w, uint32 id) |
Stands in for the whole value, which was already written under id. | |
| bool(* | finish )(SerWriter *w) |
| last chance to fail; optional | |
| void(* | destroy )(SerWriter *w) |
| frees private state and the struct | |
A serialization format, defined as a set of operations for writing each kind of value.
Implement this once to add a new backend (JSON, binary, etc.). Every operation returns false on failure and leaves a description in w->err.
Definition at line 21 of file serwriter.h.
| bool(* SerWriterOps::arrBegin) (SerWriter *w, int32 count) |
| count | number of elements, or < 0 if not known in advance |
Definition at line 31 of file serwriter.h.
| bool(* SerWriterOps::mapBegin) (SerWriter *w, int32 count) |
| count | number of entries, or < 0 if not known in advance |
Definition at line 34 of file serwriter.h.
| bool(* SerWriterOps::mapKeyTyped) (SerWriter *w, const STypeInfoExt *kt, stgeneric key) |
Only reached when the backend advertises SER_Cap_NonStringKeys; otherwise the traverser projects the map to an array of key/value pairs instead.
Definition at line 38 of file serwriter.h.
| bool(* SerWriterOps::refDef) (SerWriter *w, uint32 id) |
Marks the value that follows as the definition of id.
Only reached when the backend advertises SER_Cap_Refs and the document enabled SER_Refs. Ids are assigned by the traverser, sequentially from zero in the order the definitions are emitted; a backend encodes the number it is given and does not invent its own.
Definition at line 49 of file serwriter.h.