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

Method CheckMapIndex

extensions/protobuf/internal/qualify.cc:331–350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

329}
330
331absl::StatusOr<google::protobuf::MapValueConstRef> ProtoQualifyState::CheckMapIndex(
332 const cel::AttributeQualifier& qualifier) const {
333 const auto* key_desc =
334 repeated_field_desc_->message_type()->FindFieldByNumber(kKeyTag);
335
336 CEL_ASSIGN_OR_RETURN(
337 absl::optional<google::protobuf::MapValueConstRef> value_ref,
338 LookupMapValue(message_, reflection_, repeated_field_desc_, key_desc,
339 qualifier));
340
341 if (!value_ref.has_value()) {
342 std::string key_string;
343 absl::StatusOr<std::string> key_string_or = qualifier.AsString();
344 if (key_string_or.ok()) {
345 key_string = *key_string_or;
346 }
347 return runtime_internal::CreateNoSuchKeyError(key_string);
348 }
349 return std::move(value_ref).value();
350}
351
352absl::Status ProtoQualifyState::ApplyAttributeQualifierMap(
353 const cel::AttributeQualifier& qualifier, MemoryManagerRef memory_manager) {

Callers

nothing calls this directly

Calls 7

LookupMapValueFunction · 0.70
CEL_ASSIGN_OR_RETURNFunction · 0.50
CreateNoSuchKeyErrorFunction · 0.50
has_valueMethod · 0.45
AsStringMethod · 0.45
okMethod · 0.45
valueMethod · 0.45

Tested by

no test coverage detected