|
|
class | internal::RawFinder |
| |
◆ Decoder()
| constexpr pw::protobuf::Decoder::Decoder |
( |
span< const std::byte > |
proto | ) |
|
|
inlineconstexpr |
Constructs a Decoder operating on an in-memory protobuf buffer.
- Parameters
-
| [in] | proto | Span containing the raw serialized protobuf message. |
◆ FieldNumber()
| uint32_t pw::protobuf::Decoder::FieldNumber |
( |
| ) |
const |
Returns the field number of the field at the current cursor position.
A return value of 0 indicates that the field number is invalid. An invalid field number terminates the decode operation; any subsequent calls to Next() or Read*() will return \ref pw::Status::DataLoss() "DATA_LOSS".
◆ GetFieldKey()
Gets the field key of the field at the current cursor position if valid.
- Note
- Avoid using this function unless you need to examine the field wire format properties.
FieldNumber() is sufficient for manual decoding in most cases.
- Returns
- A Result containing the
FieldKey of the current field on success or one of the following error codes on failure:
◆ Next()
| Status pw::protobuf::Decoder::Next |
( |
| ) |
|
Advances to the next field in the proto.
If Next() returns \ref pw::OkStatus() "OK", there is guaranteed to be a valid protobuf field at the current cursor position.
- Returns
- OK: Advanced to a valid proto field.
- OUT_OF_RANGE: Reached the end of the proto message.
- DATA_LOSS: Invalid protobuf wire data.
◆ ReadBool()
| Status pw::protobuf::Decoder::ReadBool |
( |
bool * |
out | ) |
|
Reads a proto bool value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read bool value. |
◆ ReadBytes()
| Status pw::protobuf::Decoder::ReadBytes |
( |
span< const std::byte > * |
out | ) |
|
|
inline |
Reads a proto bytes value from the current cursor position as a view.
- Note
- The raw protobuf data must outlive
out. If the bytes field is invalid, out is not modified.
- Parameters
-
| [out] | out | Pointer to store the byte span view (span<const std::byte>). |
◆ ReadDouble()
| Status pw::protobuf::Decoder::ReadDouble |
( |
double * |
out | ) |
|
|
inline |
Reads a proto double value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read double value. |
◆ ReadFixed32()
| Status pw::protobuf::Decoder::ReadFixed32 |
( |
uint32_t * |
out | ) |
|
|
inline |
Reads a proto fixed32 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read fixed32 value. |
◆ ReadFixed64()
| Status pw::protobuf::Decoder::ReadFixed64 |
( |
uint64_t * |
out | ) |
|
|
inline |
Reads a proto fixed64 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read fixed64 value. |
◆ ReadFloat()
| Status pw::protobuf::Decoder::ReadFloat |
( |
float * |
out | ) |
|
|
inline |
Reads a proto float value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read float value. |
◆ ReadInt32()
| Status pw::protobuf::Decoder::ReadInt32 |
( |
int32_t * |
out | ) |
|
|
inline |
Reads a proto int32 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read int32 value. |
◆ ReadInt64()
| Status pw::protobuf::Decoder::ReadInt64 |
( |
int64_t * |
out | ) |
|
|
inline |
Reads a proto int64 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read int64 value. |
◆ ReadSfixed32()
| Status pw::protobuf::Decoder::ReadSfixed32 |
( |
int32_t * |
out | ) |
|
|
inline |
Reads a proto sfixed32 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read sfixed32 value. |
◆ ReadSfixed64()
| Status pw::protobuf::Decoder::ReadSfixed64 |
( |
int64_t * |
out | ) |
|
|
inline |
Reads a proto sfixed64 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read sfixed64 value. |
◆ ReadSint32()
| Status pw::protobuf::Decoder::ReadSint32 |
( |
int32_t * |
out | ) |
|
Reads a proto sint32 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read sint32 value. |
◆ ReadSint64()
| Status pw::protobuf::Decoder::ReadSint64 |
( |
int64_t * |
out | ) |
|
Reads a proto sint64 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read sint64 value. |
◆ ReadString()
| Status pw::protobuf::Decoder::ReadString |
( |
std::string_view * |
out | ) |
|
Reads a proto string value from the current cursor position as a view.
- Note
- The raw protobuf data must outlive
out. If the string field is invalid, out is not modified.
- Parameters
-
| [out] | out | Pointer to store the std::string_view of the string. |
◆ ReadUint32()
| Status pw::protobuf::Decoder::ReadUint32 |
( |
uint32_t * |
out | ) |
|
Reads a proto uint32 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read uint32 value. |
◆ ReadUint64()
| Status pw::protobuf::Decoder::ReadUint64 |
( |
uint64_t * |
out | ) |
|
|
inline |
Reads a proto uint64 value from the current cursor position.
- Parameters
-
| [out] | out | Pointer to store the read uint64 value. |
◆ Reset()
| void pw::protobuf::Decoder::Reset |
( |
span< const std::byte > |
proto | ) |
|
|
inline |
Resets the decoder to start reading a new proto message.
- Parameters
-
| [in] | proto | Span containing the new raw serialized protobuf message. |
The documentation for this class was generated from the following file:
- pw_protobuf/public/pw_protobuf/decoder.h