MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / absl_nonnull DynamicParseTextProto

Function absl_nonnull DynamicParseTextProto

internal/parse_text_proto.h:103–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101// descriptor pool, returning the dynamic message.
102template <typename T>
103google::protobuf::Message* absl_nonnull DynamicParseTextProto(
104 google::protobuf::Arena* absl_nonnull arena, absl::string_view text,
105 const google::protobuf::DescriptorPool* absl_nonnull pool =
106 GetTestingDescriptorPool(),
107 google::protobuf::MessageFactory* absl_nonnull factory = GetTestingMessageFactory()) {
108 static_assert(std::is_base_of_v<google::protobuf::MessageLite, T>);
109 const auto* descriptor = ABSL_DIE_IF_NULL( // Crash OK
110 pool->FindMessageTypeByName(MessageTypeNameFor<T>()));
111 const auto* dynamic_message_prototype =
112 ABSL_DIE_IF_NULL(factory->GetPrototype(descriptor)); // Crash OK
113 auto* dynamic_message = dynamic_message_prototype->New(arena);
114 ABSL_CHECK(google::protobuf::TextFormat::ParseFromString( // Crash OK
115 text, cel::to_address(dynamic_message)));
116 return dynamic_message;
117}
118
119} // namespace cel::internal
120

Callers

nothing calls this directly

Calls 2

to_addressFunction · 0.85
NewMethod · 0.45

Tested by

no test coverage detected