/proc/self/cwd/source/common/rds/util.cc
Line | Count | Source (jump to first uncovered line) |
1 | | #include "source/common/rds/util.h" |
2 | | |
3 | | namespace Envoy { |
4 | | namespace Rds { |
5 | | |
6 | 9.17k | ProtobufTypes::MessagePtr cloneProto(ProtoTraits& proto_traits, const Protobuf::Message& rc) { |
7 | 9.17k | auto clone = proto_traits.createEmptyProto(); |
8 | 9.17k | clone->CheckTypeAndMergeFrom(rc); |
9 | 9.17k | return clone; |
10 | 9.17k | } |
11 | | |
12 | 72 | std::string resourceName(ProtoTraits& proto_traits, const Protobuf::Message& rc) { |
13 | 72 | Protobuf::ReflectableMessage reflectable_message = createReflectableMessage(rc); |
14 | 72 | const Protobuf::FieldDescriptor* field = reflectable_message->GetDescriptor()->FindFieldByNumber( |
15 | 72 | proto_traits.resourceNameFieldNumber()); |
16 | 72 | if (!field) { |
17 | 0 | return {}; |
18 | 0 | } |
19 | 72 | const Protobuf::Reflection* reflection = reflectable_message->GetReflection(); |
20 | 72 | return reflection->GetString(*reflectable_message, field); |
21 | 72 | } |
22 | | |
23 | | } // namespace Rds |
24 | | } // namespace Envoy |