aboutsummaryrefslogtreecommitdiff
path: root/pw_protobuf/public/pw_protobuf/internal/codegen.h
diff options
context:
space:
mode:
Diffstat (limited to 'pw_protobuf/public/pw_protobuf/internal/codegen.h')
-rw-r--r--pw_protobuf/public/pw_protobuf/internal/codegen.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/pw_protobuf/public/pw_protobuf/internal/codegen.h b/pw_protobuf/public/pw_protobuf/internal/codegen.h
index 39e6ccc5c..d3e13c578 100644
--- a/pw_protobuf/public/pw_protobuf/internal/codegen.h
+++ b/pw_protobuf/public/pw_protobuf/internal/codegen.h
@@ -21,7 +21,8 @@
#include "pw_span/span.h"
#include "pw_status/status.h"
-// TODO(b/259746255): Remove this manual application of -Wconversion when all of
+// TODO: b/259746255 - Remove this manual application of -Wconversion when all
+// of
// Pigweed builds with it.
PW_MODIFY_DIAGNOSTICS_PUSH();
PW_MODIFY_DIAGNOSTIC(error, "-Wconversion");
@@ -165,7 +166,7 @@ class MessageField {
uint32_t field_number_;
uint32_t field_info_;
size_t field_offset_;
- // TODO(b/234875722): Could be replaced by a class MessageDescriptor*
+ // TODO: b/234875722 - Could be replaced by a class MessageDescriptor*
const span<const MessageField>* nested_message_fields_;
};
static_assert(sizeof(MessageField) <= sizeof(size_t) * 4,
@@ -205,6 +206,9 @@ union Callback {
return *this;
}
+ // Evaluate to true if the encoder or decoder callback is set.
+ explicit operator bool() const { return encode_ || decode_; }
+
private:
friend StreamDecoder;
friend StreamEncoder;