diff options
author | Chris Kennelly <ckennelly@google.com> | 2017-01-31 13:10:13 -0800 |
---|---|---|
committer | Chris Kennelly <ckennelly@google.com> | 2017-02-15 11:35:24 -0800 |
commit | 0026dff9f6e7fbea541fd293cbf8ebcd254e374d (patch) | |
tree | 56c1af9b7e1ca9da51a61bdcf97e18a50d4252f3 /src/google/protobuf/compiler/cpp/cpp_string_field.cc | |
parent | 38b14408c5f58737cfa3a5433ef319e90e891702 (diff) |
Expose rvalue setters for repeated string fields.
rvalue setters for scalar string fields were added in #2506.
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_string_field.cc')
-rw-r--r-- | src/google/protobuf/compiler/cpp/cpp_string_field.cc | 18 |
1 files changed, 18 insertions, 0 deletions
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" |