/proc/self/cwd/test/fuzz/mutable_visitor.h
Line | Count | Source |
1 | | #pragma once |
2 | | |
3 | | #include "envoy/common/pure.h" |
4 | | |
5 | | #include "source/common/protobuf/protobuf.h" |
6 | | |
7 | | #include "absl/types/span.h" |
8 | | |
9 | | namespace Envoy { |
10 | | namespace ProtobufMessage { |
11 | | |
12 | | class ProtoVisitor { |
13 | | public: |
14 | 8.13k | virtual ~ProtoVisitor() = default; |
15 | | |
16 | | // Invoked when a field is visited, with the message, and field descriptor. |
17 | | virtual void onField(Protobuf::Message&, const Protobuf::FieldDescriptor&, |
18 | | const absl::Span<const Protobuf::Message* const>) PURE; |
19 | | |
20 | | // Invoked when a message is visited, with the message and visited parents. |
21 | | // @param was_any_or_top_level supplies whether the message was either the top level message or an |
22 | | // Any before being unpacked for further recursion. The latter can |
23 | | // only be achieved by using recurse_into_any. |
24 | | virtual void onEnterMessage(Protobuf::Message&, absl::Span<const Protobuf::Message* const>, |
25 | | bool was_any_or_top_level, absl::string_view field_name) PURE; |
26 | | virtual void onLeaveMessage(Protobuf::Message&, absl::Span<const Protobuf::Message* const>, |
27 | | bool was_any_or_top_level, absl::string_view field_name) PURE; |
28 | | }; |
29 | | |
30 | | void traverseMessage(ProtoVisitor& visitor, Protobuf::Message& message, bool recurse_into_any); |
31 | | |
32 | | } // namespace ProtobufMessage |
33 | | } // namespace Envoy |