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

Method ConvertToJsonArray

common/value.cc:163–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

161}
162
163absl::Status Value::ConvertToJsonArray(
164 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
165 google::protobuf::MessageFactory* absl_nonnull message_factory,
166 google::protobuf::Message* absl_nonnull json) const {
167 ABSL_DCHECK(descriptor_pool != nullptr);
168 ABSL_DCHECK(message_factory != nullptr);
169 ABSL_DCHECK(json != nullptr);
170 ABSL_DCHECK_EQ(json->GetDescriptor()->well_known_type(),
171 google::protobuf::Descriptor::WELLKNOWNTYPE_LISTVALUE);
172
173 return variant_.Visit(absl::Overload(
174 [](absl::monostate) -> absl::Status {
175 return absl::InternalError("use of invalid Value");
176 },
177 [descriptor_pool, message_factory, json](
178 const common_internal::LegacyListValue& alternative) -> absl::Status {
179 return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
180 json);
181 },
182 [descriptor_pool, message_factory,
183 json](const CustomListValue& alternative) -> absl::Status {
184 return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
185 json);
186 },
187 [descriptor_pool, message_factory,
188 json](const ParsedRepeatedFieldValue& alternative) -> absl::Status {
189 return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
190 json);
191 },
192 [descriptor_pool, message_factory,
193 json](const ParsedJsonListValue& alternative) -> absl::Status {
194 return alternative.ConvertToJsonArray(descriptor_pool, message_factory,
195 json);
196 },
197 [](const auto& alternative) -> absl::Status {
198 return TypeConversionError(alternative.GetTypeName(),
199 "google.protobuf.ListValue")
200 .NativeValue();
201 }));
202}
203
204absl::Status Value::ConvertToJsonObject(
205 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,

Callers

nothing calls this directly

Calls 5

TypeConversionErrorFunction · 0.85
GetDescriptorMethod · 0.45
VisitMethod · 0.45
NativeValueMethod · 0.45
GetTypeNameMethod · 0.45

Tested by

no test coverage detected