diff options
author | Feng Xiao <xfxyjwf@gmail.com> | 2015-06-17 13:12:11 -0700 |
---|---|---|
committer | Feng Xiao <xfxyjwf@gmail.com> | 2015-06-17 13:12:11 -0700 |
commit | e9a122eb19ec54dbca15da80355ed0c17cada9b1 (patch) | |
tree | fac37489873ccf47777b2e652db580f9315d7bc7 /src/google/protobuf/stubs/common.cc | |
parent | b36395b2bac88f70070544c325bc09234cb1f1a6 (diff) | |
parent | 818c5eee08840355d70d2f3bdf1a2f17986a5e70 (diff) |
Merge pull request #501 from xfxyjwf/down
Down-integrate from internal code base.
Diffstat (limited to 'src/google/protobuf/stubs/common.cc')
-rw-r--r-- | src/google/protobuf/stubs/common.cc | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/src/google/protobuf/stubs/common.cc b/src/google/protobuf/stubs/common.cc index 22cc5aa1..d470fc72 100644 --- a/src/google/protobuf/stubs/common.cc +++ b/src/google/protobuf/stubs/common.cc @@ -32,6 +32,9 @@ #include <google/protobuf/stubs/common.h> #include <google/protobuf/stubs/once.h> +#include <google/protobuf/stubs/status.h> +#include <google/protobuf/stubs/stringpiece.h> +#include <google/protobuf/stubs/strutil.h> #include <stdio.h> #include <errno.h> #include <vector> @@ -146,6 +149,27 @@ LogMessage& LogMessage::operator<<(const char* value) { return *this; } +LogMessage& LogMessage::operator<<(const StringPiece& value) { + message_ += value.ToString(); + return *this; +} + +LogMessage& LogMessage::operator<<(long long value) { + message_ += SimpleItoa(value); + return *this; +} + +LogMessage& LogMessage::operator<<(unsigned long long value) { + message_ += SimpleItoa(value); + return *this; +} + +LogMessage& LogMessage::operator<<( + const ::google::protobuf::util::Status& status) { + message_ += status.ToString(); + return *this; +} + // Since this is just for logging, we don't care if the current locale changes // the results -- in fact, we probably prefer that. So we use snprintf() // instead of Simple*toa(). @@ -165,7 +189,7 @@ LogMessage& LogMessage::operator<<(const char* value) { DECLARE_STREAM_OPERATOR(char , "%c" ) DECLARE_STREAM_OPERATOR(int , "%d" ) -DECLARE_STREAM_OPERATOR(uint , "%u" ) +DECLARE_STREAM_OPERATOR(unsigned int , "%u" ) DECLARE_STREAM_OPERATOR(long , "%ld") DECLARE_STREAM_OPERATOR(unsigned long, "%lu") DECLARE_STREAM_OPERATOR(double , "%g" ) |