23 bool (*writeBool)(_Inout_
SerWriter* w,
bool v);
26 bool (*writeReal)(_Inout_
SerWriter* w, float64 v,
stype declared);
27 bool (*writeStr)(_Inout_
SerWriter* w, _In_opt_ strref v);
28 bool (*writeBytes)(_Inout_
SerWriter* w, _In_reads_bytes_(n)
const void* p,
size_t n);
35 bool (*mapKey)(_Inout_
SerWriter* w, _In_opt_ strref key);
109#define serWriterCaps(w) ((w)->caps)
123#define serWriterCan(w, capname) (((w)->caps & SER_Cap_##capname) != 0)
126_meta_inline
bool serWriteNull(_Inout_
SerWriter* w) {
return w->ops->writeNull(w); }
127_meta_inline
bool serWriteBool(_Inout_
SerWriter* w,
bool v) {
return w->ops->writeBool(w, v); }
128_meta_inline
bool serWriteInt(_Inout_
SerWriter* w, int64 v,
stype declared)
130 return w->ops->writeInt(w, v, declared);
132_meta_inline
bool serWriteUint(_Inout_
SerWriter* w, uint64 v,
stype declared)
134 return w->ops->writeUint(w, v, declared);
136_meta_inline
bool serWriteReal(_Inout_
SerWriter* w, float64 v,
stype declared)
138 return w->ops->writeReal(w, v, declared);
140_meta_inline
bool serWriteStr(_Inout_
SerWriter* w, _In_opt_ strref v)
142 return w->ops->writeStr(w, v);
144_meta_inline
bool serWriteBytes(_Inout_
SerWriter* w, _In_reads_bytes_(n)
const void* p,
size_t n)
146 return w->ops->writeBytes(w, p, n);
148_meta_inline
bool serArrBegin(_Inout_
SerWriter* w, int32 count)
150 return w->ops->arrBegin(w, count);
152_meta_inline
bool serArrEnd(_Inout_
SerWriter* w) {
return w->ops->arrEnd(w); }
153_meta_inline
bool serMapBegin(_Inout_
SerWriter* w, int32 count)
155 return w->ops->mapBegin(w, count);
157_meta_inline
bool serMapKey(_Inout_
SerWriter* w, _In_opt_ strref key)
159 return w->ops->mapKey(w, key);
161_meta_inline
bool serMapEnd(_Inout_
SerWriter* w) {
return w->ops->mapEnd(w); }
188#define serWrite(w, type, val) _serWrite(w, stExt(type), stArg(type, val))
bool serWriterFinish(SerWriter *w)
SerWriter * _serWriterAlloc(size_t size, const SerWriterOps *ops, flags_t caps, flags_t flags)
bool serWriterFail(SerWriter *w, int32 code, strref msg)
void serWriterDestroy(SerWriter **w)
Hash table container with type-safe generic key-value storage.
The abstract data model, type resolution, and serialization errors.
bool(* mapBegin)(SerWriter *w, int32 count)
void(* destroy)(SerWriter *w)
frees private state and the struct
bool(* arrBegin)(SerWriter *w, int32 count)
bool(* refDef)(SerWriter *w, uint32 id)
bool(* finish)(SerWriter *w)
last chance to fail; optional
bool(* refUse)(SerWriter *w, uint32 id)
Stands in for the whole value, which was already written under id.
bool(* mapKeyTyped)(SerWriter *w, const STypeInfoExt *kt, stgeneric key)
flags_t caps
SerCapabilitiesEnum – what this backend can represent.
flags_t flags
SerFlagsEnum – per-document options.