16typedef struct SerReader SerReader;
27 bool (*readNull)(_Inout_ SerReader* r);
28 bool (*readBool)(_Inout_ SerReader* r, _Out_
bool* out);
33 bool (*
readInt)(_Inout_ SerReader* r, _Out_ int64* out,
stype declared);
34 bool (*
readUint)(_Inout_ SerReader* r, _Out_ uint64* out,
stype declared);
35 bool (*
readReal)(_Inout_ SerReader* r, _Out_ float64* out,
stype declared);
36 bool (*readStr)(_Inout_ SerReader* r, _Inout_
string* out);
37 bool (*readBytes)(_Inout_ SerReader* r, _Inout_
Buffer* out);
40 bool (*
arrBegin)(_Inout_ SerReader* r, _Out_ int32* count);
42 bool (*arrEnd)(_Inout_ SerReader* r);
44 bool (*
mapBegin)(_Inout_ SerReader* r, _Out_ int32* count);
45 bool (*
mapNext)(_Inout_ SerReader* r, _Inout_
string* key);
46 bool (*mapEnd)(_Inout_ SerReader* r);
48 bool (*readTypeTag)(_Inout_ SerReader* r, _Inout_
string* name);
49 bool (*readRef)(_Inout_ SerReader* r, _Out_ uint32* id);
50 bool (*skip)(_Inout_ SerReader* r);
52 void (*
destroy)(_Inout_ _Post_invalid_ SerReader* r);
55typedef struct SerReader {
61 sa_SerResolverEnt resolvers;
114#define serReaderCaps(r) ((r)->caps)
122#define serReaderCan(r, capname) (((r)->caps & SER_Cap_##capname) != 0)
125_meta_inline
SerNodeKind serPeek(_Inout_ SerReader* r) {
return r->ops->peek(r); }
126_meta_inline
bool serReadNull(_Inout_ SerReader* r) {
return r->ops->readNull(r); }
127_meta_inline
bool serReadBool(_Inout_ SerReader* r, _Out_
bool* out)
129 return r->ops->readBool(r, out);
131_meta_inline
bool serReadInt(_Inout_ SerReader* r, _Out_ int64* out,
stype declared)
133 return r->ops->readInt(r, out, declared);
135_meta_inline
bool serReadUint(_Inout_ SerReader* r, _Out_ uint64* out,
stype declared)
137 return r->ops->readUint(r, out, declared);
139_meta_inline
bool serReadReal(_Inout_ SerReader* r, _Out_ float64* out,
stype declared)
141 return r->ops->readReal(r, out, declared);
143_meta_inline
bool serReadStr(_Inout_ SerReader* r, _Inout_
string* out)
145 return r->ops->readStr(r, out);
147_meta_inline
bool serReadBytes(_Inout_ SerReader* r, _Inout_
Buffer* out)
149 return r->ops->readBytes(r, out);
151_meta_inline
bool serArrBeginR(_Inout_ SerReader* r, _Out_ int32* count)
153 return r->ops->arrBegin(r, count);
155_meta_inline
bool serArrNext(_Inout_ SerReader* r) {
return r->ops->arrNext(r); }
156_meta_inline
bool serArrEndR(_Inout_ SerReader* r) {
return r->ops->arrEnd(r); }
157_meta_inline
bool serMapBeginR(_Inout_ SerReader* r, _Out_ int32* count)
159 return r->ops->mapBegin(r, count);
161_meta_inline
bool serMapNext(_Inout_ SerReader* r, _Inout_
string* key)
163 return r->ops->mapNext(r, key);
165_meta_inline
bool serMapEndR(_Inout_ SerReader* r) {
return r->ops->mapEnd(r); }
166_meta_inline
bool serSkip(_Inout_ SerReader* r) {
return r->ops->skip(r); }
173bool _serRead(_Inout_ SerReader* r, _In_
const STypeInfoExt* schema, _Inout_ stgeneric* val);
192#define serRead(r, type, pval) _serRead(r, stExt(type), stArgPtr(type, pval))
Simple buffer management.
bool(* SerTypeResolver)(SerResolved *out, strref name, void *user)
enum SerNodeKindEnum SerNodeKind
bool serReaderFail(SerReader *r, int32 code, strref msg)
void serReaderAddResolver(SerReader *r, SerTypeResolver fn, void *user)
void serReaderDestroy(SerReader **r)
SerReader * _serReaderAlloc(size_t size, const SerReaderOps *ops, flags_t caps, flags_t flags)
bool serReaderResolve(SerResolved *out, SerReader *r, strref name)
Hash table container with type-safe generic key-value storage.
The abstract data model, type resolution, and serialization errors.
bool(* mapNext)(SerReader *r, string *key)
false at end of map
bool(* arrNext)(SerReader *r)
false once the array is exhausted
bool(* readInt)(SerReader *r, int64 *out, stype declared)
void(* destroy)(SerReader *r)
frees private state and the struct
bool(* readReal)(SerReader *r, float64 *out, stype declared)
bool(* mapBegin)(SerReader *r, int32 *count)
bool(* arrBegin)(SerReader *r, int32 *count)
bool(* readUint)(SerReader *r, uint64 *out, stype declared)