aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/google/protobuf/compiler/cpp/cpp_map_field.cc
diff options
context:
space:
mode:
authorGravatar Adam Cozzette <acozzette@google.com>2016-11-17 16:48:38 -0800
committerGravatar Adam Cozzette <acozzette@google.com>2016-11-17 16:59:59 -0800
commit5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 (patch)
tree0276f81f8848a05d84cd7e287b43d665e30f04e3 /src/google/protobuf/compiler/cpp/cpp_map_field.cc
parente28286fa05d8327fd6c5aa70cfb3be558f0932b8 (diff)
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/compiler/cpp/cpp_map_field.cc')
-rw-r--r--src/google/protobuf/compiler/cpp/cpp_map_field.cc32
1 files changed, 19 insertions, 13 deletions
diff --git a/src/google/protobuf/compiler/cpp/cpp_map_field.cc b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
index 31ac9ca7..c0e172b2 100644
--- a/src/google/protobuf/compiler/cpp/cpp_map_field.cc
+++ b/src/google/protobuf/compiler/cpp/cpp_map_field.cc
@@ -45,10 +45,10 @@ bool IsProto3Field(const FieldDescriptor* field_descriptor) {
}
void SetMessageVariables(const FieldDescriptor* descriptor,
- map<string, string>* variables,
+ std::map<string, string>* variables,
const Options& options) {
SetCommonFieldVariables(descriptor, variables, options);
- (*variables)["type"] = FieldMessageTypeName(descriptor);
+ (*variables)["type"] = ClassName(descriptor->message_type(), false);
(*variables)["stream_writer"] =
(*variables)["declared_type"] +
(HasFastArraySerialization(descriptor->message_type()->file(), options)
@@ -137,7 +137,7 @@ GenerateAccessorDeclarations(io::Printer* printer) const {
void MapFieldGenerator::
GenerateInlineAccessorDefinitions(io::Printer* printer,
bool is_inline) const {
- map<string, string> variables(variables_);
+ std::map<string, string> variables(variables_);
variables["inline"] = is_inline ? "inline" : "";
printer->Print(variables,
"$inline$ const ::google::protobuf::Map< $key_cpp$, $val_cpp$ >&\n"
@@ -154,7 +154,7 @@ GenerateInlineAccessorDefinitions(io::Printer* printer,
void MapFieldGenerator::
GenerateClearingCode(io::Printer* printer) const {
- map<string, string> variables(variables_);
+ std::map<string, string> variables(variables_);
variables["this_message"] = dependent_field_ ? DependentBaseDownCast() : "";
printer->Print(variables, "$this_message$$name$_.Clear();\n");
}
@@ -173,14 +173,20 @@ void MapFieldGenerator::
GenerateConstructorCode(io::Printer* printer) const {
if (HasDescriptorMethods(descriptor_->file(), options_)) {
printer->Print(variables_,
- "$name$_.SetAssignDescriptorCallback(\n"
- " protobuf_AssignDescriptorsOnce);\n"
- "$name$_.SetEntryDescriptor(\n"
- " &$type$_descriptor_);\n");
+ "$name$_.SetAssignDescriptorCallback(\n"
+ " protobuf_AssignDescriptorsOnce);\n"
+ "$name$_.SetEntryDescriptor(\n"
+ " &$type$_descriptor);\n");
}
}
void MapFieldGenerator::
+GenerateCopyConstructorCode(io::Printer* printer) const {
+ GenerateConstructorCode(printer);
+ GenerateMergingCode(printer);
+}
+
+void MapFieldGenerator::
GenerateMergeFromCodedStream(io::Printer* printer) const {
const FieldDescriptor* key_field =
descriptor_->message_type()->FindFieldByName("key");
@@ -252,7 +258,7 @@ GenerateMergeFromCodedStream(io::Printer* printer) const {
}
static void GenerateSerializationLoop(io::Printer* printer,
- const map<string, string>& variables,
+ const std::map<string, string>& variables,
bool supports_arenas,
const string& utf8_check,
const string& loop_header,
@@ -291,17 +297,17 @@ static void GenerateSerializationLoop(io::Printer* printer,
void MapFieldGenerator::
GenerateSerializeWithCachedSizes(io::Printer* printer) const {
- map<string, string> variables(variables_);
+ std::map<string, string> variables(variables_);
variables["write_entry"] = "::google::protobuf::internal::WireFormatLite::Write" +
variables["stream_writer"] + "(\n " +
variables["number"] + ", *entry, output)";
- variables["deterministic"] = "output->IsSerializationDeterminstic()";
+ variables["deterministic"] = "output->IsSerializationDeterministic()";
GenerateSerializeWithCachedSizes(printer, variables);
}
void MapFieldGenerator::
GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
- map<string, string> variables(variables_);
+ std::map<string, string> variables(variables_);
variables["write_entry"] =
"target = ::google::protobuf::internal::WireFormatLite::\n"
" InternalWrite" + variables["declared_type"] +
@@ -312,7 +318,7 @@ GenerateSerializeWithCachedSizesToArray(io::Printer* printer) const {
}
void MapFieldGenerator::GenerateSerializeWithCachedSizes(
- io::Printer* printer, const map<string, string>& variables) const {
+ io::Printer* printer, const std::map<string, string>& variables) const {
printer->Print(variables,
"if (!this->$name$().empty()) {\n");
printer->Indent();