|
|
|
@ -762,10 +762,10 @@ class PROTOBUF_EXPORT MapValueConstRef { |
|
|
|
|
TYPE_CHECK(FieldDescriptor::CPPTYPE_ENUM, "MapValueConstRef::GetEnumValue"); |
|
|
|
|
return *reinterpret_cast<int*>(data_); |
|
|
|
|
} |
|
|
|
|
const std::string& GetStringValue() const { |
|
|
|
|
absl::string_view GetStringValue() const { |
|
|
|
|
TYPE_CHECK(FieldDescriptor::CPPTYPE_STRING, |
|
|
|
|
"MapValueConstRef::GetStringValue"); |
|
|
|
|
return *reinterpret_cast<std::string*>(data_); |
|
|
|
|
return absl::string_view(*reinterpret_cast<std::string*>(data_)); |
|
|
|
|
} |
|
|
|
|
float GetFloatValue() const { |
|
|
|
|
TYPE_CHECK(FieldDescriptor::CPPTYPE_FLOAT, |
|
|
|
@ -855,9 +855,9 @@ class PROTOBUF_EXPORT MapValueRef final : public MapValueConstRef { |
|
|
|
|
TYPE_CHECK(FieldDescriptor::CPPTYPE_ENUM, "MapValueRef::SetEnumValue"); |
|
|
|
|
*reinterpret_cast<int*>(data_) = value; |
|
|
|
|
} |
|
|
|
|
void SetStringValue(const std::string& value) { |
|
|
|
|
void SetStringValue(absl::string_view value) { |
|
|
|
|
TYPE_CHECK(FieldDescriptor::CPPTYPE_STRING, "MapValueRef::SetStringValue"); |
|
|
|
|
*reinterpret_cast<std::string*>(data_) = value; |
|
|
|
|
reinterpret_cast<std::string*>(data_)->assign(value.data(), value.size()); |
|
|
|
|
} |
|
|
|
|
void SetFloatValue(float value) { |
|
|
|
|
TYPE_CHECK(FieldDescriptor::CPPTYPE_FLOAT, "MapValueRef::SetFloatValue"); |
|
|
|
|