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

Method ConvertToJson

common/values/string_value.cc:100–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100absl::Status StringValue::ConvertToJson(
101 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
102 google::protobuf::MessageFactory* absl_nonnull message_factory,
103 google::protobuf::Message* absl_nonnull json) const {
104 ABSL_DCHECK(descriptor_pool != nullptr);
105 ABSL_DCHECK(message_factory != nullptr);
106 ABSL_DCHECK(json != nullptr);
107 ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
108 google::protobuf::Descriptor::WELLKNOWNTYPE_VALUE);
109
110 ValueReflection value_reflection;
111 CEL_RETURN_IF_ERROR(value_reflection.Initialize(json->GetDescriptor()));
112 NativeValue(
113 [&](const auto& value) { value_reflection.SetStringValue(json, value); });
114
115 return absl::OkStatus();
116}
117
118absl::Status StringValue::Equal(
119 const Value& other,

Callers

nothing calls this directly

Calls 4

NativeValueFunction · 0.70
GetDescriptorMethod · 0.45
InitializeMethod · 0.45
SetStringValueMethod · 0.45

Tested by

no test coverage detected