From 0026dff9f6e7fbea541fd293cbf8ebcd254e374d Mon Sep 17 00:00:00 2001 From: Chris Kennelly Date: Tue, 31 Jan 2017 13:10:13 -0800 Subject: Expose rvalue setters for repeated string fields. rvalue setters for scalar string fields were added in #2506. --- src/google/protobuf/compiler/cpp/cpp_string_field.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/google/protobuf/compiler/cpp/cpp_string_field.cc') diff --git a/src/google/protobuf/compiler/cpp/cpp_string_field.cc b/src/google/protobuf/compiler/cpp/cpp_string_field.cc index 359e5e26..9c4a117b 100644 --- a/src/google/protobuf/compiler/cpp/cpp_string_field.cc +++ b/src/google/protobuf/compiler/cpp/cpp_string_field.cc @@ -830,12 +830,18 @@ GenerateAccessorDeclarations(io::Printer* printer) const { "$deprecated_attr$const ::std::string& $name$(int index) const;\n" "$deprecated_attr$::std::string* mutable_$name$(int index);\n" "$deprecated_attr$void set_$name$(int index, const ::std::string& value);\n" + "#if LANG_CXX11\n" + "$deprecated_attr$void set_$name$(int index, ::std::string&& value);\n" + "#endif\n" "$deprecated_attr$void set_$name$(int index, const char* value);\n" "" "$deprecated_attr$void set_$name$(" "int index, const $pointer_type$* value, size_t size);\n" "$deprecated_attr$::std::string* add_$name$();\n" "$deprecated_attr$void add_$name$(const ::std::string& value);\n" + "#if LANG_CXX11\n" + "$deprecated_attr$void add_$name$(::std::string&& value);\n" + "#endif\n" "$deprecated_attr$void add_$name$(const char* value);\n" "$deprecated_attr$void add_$name$(const $pointer_type$* value, size_t size)" ";\n" @@ -869,6 +875,12 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " // @@protoc_insertion_point(field_set:$full_name$)\n" " $name$_.Mutable(index)->assign(value);\n" "}\n" + "#if LANG_CXX11\n" + "$inline$void $classname$::set_$name$(int index, ::std::string&& value) {\n" + " // @@protoc_insertion_point(field_set:$full_name$)\n" + " $name$_.Mutable(index)->assign(std::move(value));\n" + "}\n" + "#endif\n" "$inline$void $classname$::set_$name$(int index, const char* value) {\n" " $name$_.Mutable(index)->assign(value);\n" " // @@protoc_insertion_point(field_set_char:$full_name$)\n" @@ -888,6 +900,12 @@ GenerateInlineAccessorDefinitions(io::Printer* printer, " $name$_.Add()->assign(value);\n" " // @@protoc_insertion_point(field_add:$full_name$)\n" "}\n" + "#if LANG_CXX11\n" + "$inline$void $classname$::add_$name$(::std::string&& value) {\n" + " $name$_.Add()->assign(std::move(value));\n" + " // @@protoc_insertion_point(field_add:$full_name$)\n" + "}\n" + "#endif\n" "$inline$void $classname$::add_$name$(const char* value) {\n" " $name$_.Add()->assign(value);\n" " // @@protoc_insertion_point(field_add_char:$full_name$)\n" -- cgit v1.2.3