/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 | 6.78k | ProtobufTypes::MessagePtr cloneProto(ProtoTraits& proto_traits, const Protobuf::Message& rc) { |
7 | 6.78k | auto clone = proto_traits.createEmptyProto(); |
8 | 6.78k | clone->CheckTypeAndMergeFrom(rc); |
9 | 6.78k | return clone; |
10 | 6.78k | } |
11 | | |
12 | 2.70k | std::string resourceName(ProtoTraits& proto_traits, const Protobuf::Message& rc) { |
13 | 2.70k | Protobuf::ReflectableMessage reflectable_message = createReflectableMessage(rc); |
14 | 2.70k | const Protobuf::FieldDescriptor* field = reflectable_message->GetDescriptor()->FindFieldByNumber( |
15 | 2.70k | proto_traits.resourceNameFieldNumber()); |
16 | 2.70k | if (!field) { |
17 | 0 | return {}; |
18 | 0 | } |
19 | 2.70k | const Protobuf::Reflection* reflection = reflectable_message->GetReflection(); |
20 | 2.70k | return reflection->GetString(*reflectable_message, field); |
21 | 2.70k | } |
22 | | |
23 | | } // namespace Rds |
24 | | } // namespace Envoy |