Coverage Report

Created: 2024-09-19 09:45

/proc/self/cwd/source/common/protobuf/visitor.h
Line
Count
Source (jump to first uncovered line)
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 ConstProtoVisitor {
13
public:
14
0
  virtual ~ConstProtoVisitor() = default;
15
16
  // Invoked when a field is visited, with the message, and field descriptor.
17
  virtual void onField(const Protobuf::Message&, const Protobuf::FieldDescriptor&) PURE;
18
19
  // Invoked when a message is visited, with the message and visited parents.
20
  // @param was_any_or_top_level supplies whether the message was either the top level message or an
21
  //                             Any before being unpacked for further recursion. The latter can
22
  //                             only be achieved by using recurse_into_any.
23
  virtual void onMessage(const Protobuf::Message&, absl::Span<const Protobuf::Message* const>,
24
                         bool was_any_or_top_level) PURE;
25
};
26
27
absl::Status traverseMessage(ConstProtoVisitor& visitor, const Protobuf::Message& message,
28
                             bool recurse_into_any);
29
30
} // namespace ProtobufMessage
31
} // namespace Envoy