diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-28 19:43:48 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-28 19:43:48 +0000 |
commit | e0425ec4ef9ffc52bfdc6d2b810d252f3b60f9a2 (patch) | |
tree | 4aa2df38f93e318b9b8fb67e6a47d540b8a3ee15 /ui/gfx/rect.cc | |
parent | 5d6920cfd4067d4c70db3e28c398951f6a40cd72 (diff) | |
download | chromium_src-e0425ec4ef9ffc52bfdc6d2b810d252f3b60f9a2.zip chromium_src-e0425ec4ef9ffc52bfdc6d2b810d252f3b60f9a2.tar.gz chromium_src-e0425ec4ef9ffc52bfdc6d2b810d252f3b60f9a2.tar.bz2 |
ui/gfx: Add ToString() function to Rect class.
So we don't need to override operator<< for Rect class.
R=sky@chromium.org
Review URL: http://codereview.chromium.org/8066006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103158 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/rect.cc')
-rw-r--r-- | ui/gfx/rect.cc | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/ui/gfx/rect.cc b/ui/gfx/rect.cc index db5ff8a..bc0a8a9 100644 --- a/ui/gfx/rect.cc +++ b/ui/gfx/rect.cc @@ -15,8 +15,7 @@ #include <cairo.h> #endif -#include <ostream> - +#include "base/stringprintf.h" #include "ui/gfx/insets.h" namespace { @@ -54,6 +53,8 @@ Rect::Rect(const gfx::Point& origin, const gfx::Size& size) : origin_(origin), size_(size) { } +Rect::~Rect() {} + #if defined(OS_WIN) Rect::Rect(const RECT& r) : origin_(r.left, r.top) { @@ -109,7 +110,6 @@ Rect& Rect::operator=(const cairo_rectangle_int_t& r) { } #endif - void Rect::SetRect(int x, int y, int width, int height) { origin_.SetPoint(x, y); set_width(width); @@ -273,8 +273,10 @@ bool Rect::SharesEdgeWith(const gfx::Rect& rect) const { (y() == rect.bottom() || bottom() == rect.y())); } -std::ostream& operator<<(std::ostream& out, const gfx::Rect& r) { - return out << r.origin().ToString() << " " << r.size().ToString(); +std::string Rect::ToString() const { + return base::StringPrintf("%s %s", + origin_.ToString().c_str(), + size_.ToString().c_str()); } } // namespace gfx |