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

Method Find

common/values/parsed_json_map_value.cc:226–256  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

224}
225
226absl::StatusOr<bool> ParsedJsonMapValue::Find(
227 const Value& key,
228 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool,
229 google::protobuf::MessageFactory* absl_nonnull message_factory,
230 google::protobuf::Arena* absl_nonnull arena, Value* absl_nonnull result) const {
231 if (key.IsError() || key.IsUnknown()) {
232 *result = key;
233 return false;
234 }
235 if (value_ != nullptr) {
236 if (auto string_key = key.AsString(); string_key) {
237 if (ABSL_PREDICT_FALSE(value_ == nullptr)) {
238 *result = NullValue();
239 return false;
240 }
241 std::string key_scratch;
242 if (const auto* value =
243 well_known_types::GetStructReflectionOrDie(
244 value_->GetDescriptor())
245 .FindField(*value_, string_key->NativeString(key_scratch));
246 value != nullptr) {
247 *result = common_internal::ParsedJsonValue(value, arena);
248 return true;
249 }
250 *result = NullValue();
251 return false;
252 }
253 }
254 *result = NullValue();
255 return false;
256}
257
258absl::Status ParsedJsonMapValue::Has(
259 const Value& key,

Callers

nothing calls this directly

Calls 8

GetStructReflectionOrDieFunction · 0.85
ParsedJsonValueFunction · 0.85
NullValueClass · 0.70
IsErrorMethod · 0.45
IsUnknownMethod · 0.45
AsStringMethod · 0.45
FindFieldMethod · 0.45
GetDescriptorMethod · 0.45

Tested by

no test coverage detected