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

Function WrapMapFieldValueImpl

common/value.cc:1752–1829  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1750
1751template <typename Unsafe>
1752Value WrapMapFieldValueImpl(
1753 const google::protobuf::MapValueConstRef& value,
1754 const google::protobuf::Message* absl_nonnull message ABSL_ATTRIBUTE_LIFETIME_BOUND,
1755 const google::protobuf::FieldDescriptor* absl_nonnull field
1756 ABSL_ATTRIBUTE_LIFETIME_BOUND,
1757 const google::protobuf::DescriptorPool* absl_nonnull descriptor_pool
1758 ABSL_ATTRIBUTE_LIFETIME_BOUND,
1759 google::protobuf::MessageFactory* absl_nonnull message_factory
1760 ABSL_ATTRIBUTE_LIFETIME_BOUND,
1761 google::protobuf::Arena* absl_nonnull arena ABSL_ATTRIBUTE_LIFETIME_BOUND) {
1762 ABSL_DCHECK(field != nullptr);
1763 ABSL_DCHECK_EQ(field->containing_type()->containing_type(),
1764 message->GetDescriptor());
1765 ABSL_DCHECK(!field->is_map() && !field->is_repeated());
1766 ABSL_DCHECK_EQ(value.type(), field->cpp_type());
1767 ABSL_DCHECK(message != nullptr);
1768 ABSL_DCHECK(descriptor_pool != nullptr);
1769 ABSL_DCHECK(message_factory != nullptr);
1770 ABSL_DCHECK(arena != nullptr);
1771
1772 switch (field->type()) {
1773 case google::protobuf::FieldDescriptor::TYPE_DOUBLE:
1774 return DoubleValue(value.GetDoubleValue());
1775 case google::protobuf::FieldDescriptor::TYPE_FLOAT:
1776 return DoubleValue(value.GetFloatValue());
1777 case google::protobuf::FieldDescriptor::TYPE_SFIXED64:
1778 ABSL_FALLTHROUGH_INTENDED;
1779 case google::protobuf::FieldDescriptor::TYPE_SINT64:
1780 ABSL_FALLTHROUGH_INTENDED;
1781 case google::protobuf::FieldDescriptor::TYPE_INT64:
1782 return IntValue(value.GetInt64Value());
1783 case google::protobuf::FieldDescriptor::TYPE_FIXED64:
1784 ABSL_FALLTHROUGH_INTENDED;
1785 case google::protobuf::FieldDescriptor::TYPE_UINT64:
1786 return UintValue(value.GetUInt64Value());
1787 case google::protobuf::FieldDescriptor::TYPE_SFIXED32:
1788 ABSL_FALLTHROUGH_INTENDED;
1789 case google::protobuf::FieldDescriptor::TYPE_SINT32:
1790 ABSL_FALLTHROUGH_INTENDED;
1791 case google::protobuf::FieldDescriptor::TYPE_INT32:
1792 return IntValue(value.GetInt32Value());
1793 case google::protobuf::FieldDescriptor::TYPE_BOOL:
1794 return BoolValue(value.GetBoolValue());
1795 case google::protobuf::FieldDescriptor::TYPE_STRING:
1796 if constexpr (Unsafe::value) {
1797 return StringValue::WrapUnsafe(value.GetStringValue());
1798 } else {
1799 return StringValue(Borrower::Arena(MessageArenaOr(message, arena)),
1800 value.GetStringValue());
1801 }
1802 case google::protobuf::FieldDescriptor::TYPE_GROUP:
1803 ABSL_FALLTHROUGH_INTENDED;
1804 case google::protobuf::FieldDescriptor::TYPE_MESSAGE:
1805 if constexpr (Unsafe::value) {
1806 return Value::WrapMessageUnsafe(
1807 &value.GetMessageValue(), descriptor_pool, message_factory, arena);
1808 } else {
1809 return Value::WrapMessage(&value.GetMessageValue(), descriptor_pool,

Callers

nothing calls this directly

Calls 13

ArenaFunction · 0.85
ErrorValueFunction · 0.85
typeMethod · 0.80
DoubleValueClass · 0.50
IntValueClass · 0.50
UintValueClass · 0.50
BoolValueClass · 0.50
StringValueClass · 0.50
BytesValueClass · 0.50
GetDescriptorMethod · 0.45
GetBoolValueMethod · 0.45
GetStringValueMethod · 0.45

Tested by

no test coverage detected