A protobuf decoder that iterates over an encoded protobuf, calling a handler for each field it encounters.
Public Member Functions | |
| CallbackDecoder (const CallbackDecoder &other)=delete | |
| CallbackDecoder & | operator= (const CallbackDecoder &other)=delete |
| void | set_handler (DecodeHandler *handler) |
| Status | Decode (span< const std::byte > proto) |
| Status | ReadInt32 (int32_t *out) |
| Status | ReadUint32 (uint32_t *out) |
| Status | ReadInt64 (int64_t *out) |
| Status | ReadUint64 (uint64_t *out) |
| Status | ReadSint32 (int32_t *out) |
| Status | ReadSint64 (int64_t *out) |
| Status | ReadBool (bool *out) |
| Status | ReadFixed32 (uint32_t *out) |
| Status | ReadFixed64 (uint64_t *out) |
| Status | ReadSfixed32 (int32_t *out) |
| Status | ReadSfixed64 (int64_t *out) |
| Status | ReadFloat (float *out) |
| Status | ReadDouble (double *out) |
| Status | ReadString (std::string_view *out) |
| Status | ReadBytes (span< const std::byte > *out) |
| bool | cancelled () const |
Decodes the specified protobuf data.
The registered handler's ProcessField function is called on each field found in the data.
| [in] | proto | Span containing the serialized protobuf data. |
|
inline |
Reads a proto bool value from the current cursor.
| [out] | out | Pointer to store the read bool value. |
Reads a proto bytes value from the current cursor as a view.
out. If the bytes field is invalid, out is not modified.| [out] | out | Pointer to store the byte span view (span<const std::byte>). |
|
inline |
Reads a proto double value from the current cursor.
| [out] | out | Pointer to store the read double value. |
|
inline |
Reads a proto fixed32 value from the current cursor.
| [out] | out | Pointer to store the read fixed32 value. |
|
inline |
Reads a proto fixed64 value from the current cursor.
| [out] | out | Pointer to store the read fixed64 value. |
|
inline |
Reads a proto float value from the current cursor.
| [out] | out | Pointer to store the read float value. |
|
inline |
Reads a proto int32 value from the current cursor.
| [out] | out | Pointer to store the read int32 value. |
|
inline |
Reads a proto int64 value from the current cursor.
| [out] | out | Pointer to store the read int64 value. |
|
inline |
Reads a proto sfixed32 value from the current cursor.
| [out] | out | Pointer to store the read sfixed32 value. |
|
inline |
Reads a proto sfixed64 value from the current cursor.
| [out] | out | Pointer to store the read sfixed64 value. |
|
inline |
Reads a proto sint32 value from the current cursor.
| [out] | out | Pointer to store the read sint32 value. |
|
inline |
Reads a proto sint64 value from the current cursor.
| [out] | out | Pointer to store the read sint64 value. |
|
inline |
Reads a proto string value from the current cursor as a view.
out. If the string field is invalid, out is not modified.| [out] | out | Pointer to store the std::string_view. |
|
inline |
Reads a proto uint32 value from the current cursor.
| [out] | out | Pointer to store the read uint32 value. |
|
inline |
Reads a proto uint64 value from the current cursor.
| [out] | out | Pointer to store the read uint64 value. |
|
inline |
Sets the DecodeHandler to process encountered fields.
| [in] | handler | Pointer to the decode handler instance. |