diff options
-rw-r--r-- | base/logging.cc | 19 | ||||
-rw-r--r-- | base/logging.h | 4 | ||||
-rw-r--r-- | base/string_piece.cc | 7 | ||||
-rw-r--r-- | base/time.h | 2 |
4 files changed, 20 insertions, 12 deletions
diff --git a/base/logging.cc b/base/logging.cc index e36a168b..e5c8c8d 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,10 +39,11 @@ typedef FILE* FileHandle; typedef pthread_mutex_t* MutexHandle; #endif +#include <algorithm> +#include <cstring> #include <ctime> #include <iomanip> -#include <cstring> -#include <algorithm> +#include <ostream> #include "base/base_switches.h" #include "base/command_line.h" @@ -815,3 +816,15 @@ void RawLog(int level, const char* message) { std::ostream& operator<<(std::ostream& out, const wchar_t* wstr) { return out << WideToUTF8(std::wstring(wstr)); } + +namespace base { + +// This was defined at the beginnig of this file. +#undef write + +std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { + o.write(piece.data(), static_cast<std::streamsize>(piece.size())); + return o; +} + +} // namespace base diff --git a/base/logging.h b/base/logging.h index 7721a93..0e78e1a 100644 --- a/base/logging.h +++ b/base/logging.h @@ -938,8 +938,8 @@ namespace base { class StringPiece; -// allow StringPiece to be logged (needed for unit testing). -extern std::ostream& operator<<(std::ostream& o, const StringPiece& piece); +// Allows StringPiece to be logged. +BASE_API std::ostream& operator<<(std::ostream& o, const StringPiece& piece); } // namespace base diff --git a/base/string_piece.cc b/base/string_piece.cc index 3ccb4f0..bf6291c 100644 --- a/base/string_piece.cc +++ b/base/string_piece.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // Copied from strings/stringpiece.cc with modifications @@ -12,11 +12,6 @@ namespace base { typedef StringPiece::size_type size_type; -std::ostream& operator<<(std::ostream& o, const StringPiece& piece) { - o.write(piece.data(), static_cast<std::streamsize>(piece.size())); - return o; -} - bool operator==(const StringPiece& x, const StringPiece& y) { if (x.size() != y.size()) return false; diff --git a/base/time.h b/base/time.h index a19a826..cc99faa 100644 --- a/base/time.h +++ b/base/time.h @@ -205,7 +205,7 @@ class BASE_API Time { // Represents an exploded time that can be formatted nicely. This is kind of // like the Win32 SYSTEMTIME structure or the Unix "struct tm" with a few // additions and changes to prevent errors. - struct Exploded { + struct BASE_API Exploded { int year; // Four digit year "2007" int month; // 1-based month (values 1 = January, etc.) int day_of_week; // 0-based day of week (0 = Sunday, etc.) |