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

Method MapEnumFieldToValue

internal/json.cc:536–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534 }
535
536 absl::Status MapEnumFieldToValue(
537 const google::protobuf::MapValueConstRef& value,
538 const google::protobuf::FieldDescriptor* absl_nonnull field,
539 google::protobuf::MessageLite* absl_nonnull result) {
540 ABSL_DCHECK_EQ(value.type(), field->cpp_type());
541 ABSL_DCHECK(!field->is_repeated());
542 ABSL_DCHECK_EQ(field->cpp_type(), FieldDescriptor::CPPTYPE_ENUM);
543 ABSL_DCHECK_NE(field->enum_type()->full_name(),
544 "google.protobuf.NullValue");
545 if (const auto* value_descriptor =
546 field->enum_type()->FindValueByNumber(value.GetEnumValue());
547 value_descriptor != nullptr) {
548 SetStringValue(result, value_descriptor->name());
549 } else {
550 SetNumberValue(result, value.GetEnumValue());
551 }
552 return absl::OkStatus();
553 }
554
555 absl::Status MapNullFieldToValue(
556 const google::protobuf::MapValueConstRef& value,

Callers

nothing calls this directly

Calls 3

typeMethod · 0.80
GetEnumValueMethod · 0.45
nameMethod · 0.45

Tested by

no test coverage detected