diff options
author | Adam Cozzette <acozzette@google.com> | 2016-11-17 16:48:38 -0800 |
---|---|---|
committer | Adam Cozzette <acozzette@google.com> | 2016-11-17 16:59:59 -0800 |
commit | 5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74 (patch) | |
tree | 0276f81f8848a05d84cd7e287b43d665e30f04e3 /src/google/protobuf/io/printer.cc | |
parent | e28286fa05d8327fd6c5aa70cfb3be558f0932b8 (diff) | |
download | protobuf-5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74.tar.gz protobuf-5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74.tar.bz2 protobuf-5a76e633ea9b5adb215e93fdc11e1c0c08b3fc74.zip |
Integrated internal changes from Google
Diffstat (limited to 'src/google/protobuf/io/printer.cc')
-rw-r--r-- | src/google/protobuf/io/printer.cc | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/google/protobuf/io/printer.cc b/src/google/protobuf/io/printer.cc index 7532b098..99e895f5 100644 --- a/src/google/protobuf/io/printer.cc +++ b/src/google/protobuf/io/printer.cc @@ -70,8 +70,8 @@ Printer::~Printer() { } bool Printer::GetSubstitutionRange(const char* varname, - pair<size_t, size_t>* range) { - map<string, pair<size_t, size_t> >::const_iterator iter = + std::pair<size_t, size_t>* range) { + std::map<string, std::pair<size_t, size_t> >::const_iterator iter = substitutions_.find(varname); if (iter == substitutions_.end()) { GOOGLE_LOG(DFATAL) << " Undefined variable in annotation: " << varname; @@ -87,12 +87,12 @@ bool Printer::GetSubstitutionRange(const char* varname, } void Printer::Annotate(const char* begin_varname, const char* end_varname, - const string& file_path, const vector<int>& path) { + const string& file_path, const std::vector<int>& path) { if (annotation_collector_ == NULL) { // Can't generate signatures with this Printer. return; } - pair<size_t, size_t> begin, end; + std::pair<size_t, size_t> begin, end; if (!GetSubstitutionRange(begin_varname, &begin) || !GetSubstitutionRange(end_varname, &end)) { return; @@ -106,7 +106,8 @@ void Printer::Annotate(const char* begin_varname, const char* end_varname, } } -void Printer::Print(const map<string, string>& variables, const char* text) { +void Printer::Print(const std::map<string, string>& variables, + const char* text) { int size = strlen(text); int pos = 0; // The number of bytes we've written so far. substitutions_.clear(); @@ -143,14 +144,15 @@ void Printer::Print(const map<string, string>& variables, const char* text) { WriteRaw(&variable_delimiter_, 1); } else { // Replace with the variable's value. - map<string, string>::const_iterator iter = variables.find(varname); + std::map<string, string>::const_iterator iter = variables.find(varname); if (iter == variables.end()) { GOOGLE_LOG(DFATAL) << " Undefined variable: " << varname; } else { size_t begin = offset_; WriteRaw(iter->second.data(), iter->second.size()); - pair<map<string, pair<size_t, size_t> >::iterator, bool> inserted = - substitutions_.insert( + std::pair<std::map<string, std::pair<size_t, size_t> >::iterator, + bool> + inserted = substitutions_.insert( std::make_pair(varname, std::make_pair(begin, offset_))); if (!inserted.second) { // This variable was used multiple times. Make its span have @@ -172,13 +174,13 @@ void Printer::Print(const map<string, string>& variables, const char* text) { } void Printer::Print(const char* text) { - static map<string, string> empty; + static std::map<string, string> empty; Print(empty, text); } void Printer::Print(const char* text, const char* variable, const string& value) { - map<string, string> vars; + std::map<string, string> vars; vars[variable] = value; Print(vars, text); } @@ -186,7 +188,7 @@ void Printer::Print(const char* text, void Printer::Print(const char* text, const char* variable1, const string& value1, const char* variable2, const string& value2) { - map<string, string> vars; + std::map<string, string> vars; vars[variable1] = value1; vars[variable2] = value2; Print(vars, text); @@ -196,7 +198,7 @@ void Printer::Print(const char* text, const char* variable1, const string& value1, const char* variable2, const string& value2, const char* variable3, const string& value3) { - map<string, string> vars; + std::map<string, string> vars; vars[variable1] = value1; vars[variable2] = value2; vars[variable3] = value3; @@ -208,7 +210,7 @@ void Printer::Print(const char* text, const char* variable2, const string& value2, const char* variable3, const string& value3, const char* variable4, const string& value4) { - map<string, string> vars; + std::map<string, string> vars; vars[variable1] = value1; vars[variable2] = value2; vars[variable3] = value3; @@ -222,7 +224,7 @@ void Printer::Print(const char* text, const char* variable3, const string& value3, const char* variable4, const string& value4, const char* variable5, const string& value5) { - map<string, string> vars; + std::map<string, string> vars; vars[variable1] = value1; vars[variable2] = value2; vars[variable3] = value3; @@ -238,7 +240,7 @@ void Printer::Print(const char* text, const char* variable4, const string& value4, const char* variable5, const string& value5, const char* variable6, const string& value6) { - map<string, string> vars; + std::map<string, string> vars; vars[variable1] = value1; vars[variable2] = value2; vars[variable3] = value3; @@ -256,7 +258,7 @@ void Printer::Print(const char* text, const char* variable5, const string& value5, const char* variable6, const string& value6, const char* variable7, const string& value7) { - map<string, string> vars; + std::map<string, string> vars; vars[variable1] = value1; vars[variable2] = value2; vars[variable3] = value3; @@ -276,7 +278,7 @@ void Printer::Print(const char* text, const char* variable6, const string& value6, const char* variable7, const string& value7, const char* variable8, const string& value8) { - map<string, string> vars; + std::map<string, string> vars; vars[variable1] = value1; vars[variable2] = value2; vars[variable3] = value3; |