diff options
author | Scott James Remnant <keybuk@google.com> | 2022-03-17 16:51:33 -0700 |
---|---|---|
committer | CQ Bot Account <pigweed-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-03-25 21:02:22 +0000 |
commit | 75c7684dd24b4de1d2dab20ea6d920023b10dff4 (patch) | |
tree | c1e59ec2c0d09b2ec9beb88e80a97fd6639a1652 /pw_protobuf/CMakeLists.txt | |
parent | b894ed693733c9a24fd14f926e395717769e788f (diff) | |
download | pigweed-75c7684dd24b4de1d2dab20ea6d920023b10dff4.tar.gz |
pw_protobuf: Read repeated fields using pw::Vector
Correct handling of protobuf repeated fields is surprisingly complex.
In order to read a field of e.g. 'repeated uint32 foo = 1;' the caller
must be able to handle two potential wire formats:
1. multiple single fields, each containing a value;
2. one or more delimited fields containing multiple packed values.
The wire format in particular allows the encoder to, even when using
packed values, break into multiple delimited fields.
Provide StreamDecoder ReadRepeatedInt32 etc. methods that handle all of
these cases by using pw::Vector as the output argument. For the codegen
StreamDecoder, field-checked ReadFoo etc. wrappers are provided.
Change-Id: Ifff92bfa894a8f70a1f58b4edffef155866f7151
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/88470
Reviewed-by: Armando Montanez <amontanez@google.com>
Reviewed-by: Austin Foxley <afoxley@google.com>
Pigweed-Auto-Submit: Scott James Remnant <keybuk@google.com>
Commit-Queue: Auto-Submit <auto-submit@pigweed.google.com.iam.gserviceaccount.com>
Diffstat (limited to 'pw_protobuf/CMakeLists.txt')
-rw-r--r-- | pw_protobuf/CMakeLists.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pw_protobuf/CMakeLists.txt b/pw_protobuf/CMakeLists.txt index 861aafc77..73987db21 100644 --- a/pw_protobuf/CMakeLists.txt +++ b/pw_protobuf/CMakeLists.txt @@ -42,6 +42,7 @@ pw_add_module_library(pw_protobuf PUBLIC_DEPS pw_assert pw_bytes + pw_containers.vector pw_protobuf.config pw_polyfill.span pw_polyfill.cstddef |