Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: ui/gfx/size.h

Issue 8038024: ui/gfx: Add ToString() function to Size class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gfx/rect.cc ('k') | ui/gfx/size.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_SIZE_H_ 5 #ifndef UI_GFX_SIZE_H_
6 #define UI_GFX_SIZE_H_ 6 #define UI_GFX_SIZE_H_
7 #pragma once 7 #pragma once
8 8
9 #include <iosfwd> 9 #include <string>
10 10
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "ui/base/ui_export.h" 12 #include "ui/base/ui_export.h"
13 13
14 #if defined(OS_WIN) 14 #if defined(OS_WIN)
15 typedef struct tagSIZE SIZE; 15 typedef struct tagSIZE SIZE;
16 #elif defined(OS_MACOSX) 16 #elif defined(OS_MACOSX)
17 #include <ApplicationServices/ApplicationServices.h> 17 #include <ApplicationServices/ApplicationServices.h>
18 #endif 18 #endif
19 19
20 namespace gfx { 20 namespace gfx {
21 21
22 // A size has width and height values. 22 // A size has width and height values.
23 class UI_EXPORT Size { 23 class UI_EXPORT Size {
24 public: 24 public:
25 Size() : width_(0), height_(0) {} 25 Size();
26 Size(int width, int height); 26 Size(int width, int height);
27 #if defined(OS_MACOSX) 27 #if defined(OS_MACOSX)
28 explicit Size(const CGSize& s); 28 explicit Size(const CGSize& s);
29 #endif 29 #endif
30 30
31 ~Size() {} 31 ~Size() {}
32 32
33 #if defined(OS_MACOSX) 33 #if defined(OS_MACOSX)
34 Size& operator=(const CGSize& s); 34 Size& operator=(const CGSize& s);
35 #endif 35 #endif
(...skipping 28 matching lines...) Expand all
64 // Size doesn't allow negative dimensions, so testing for 0 is enough. 64 // Size doesn't allow negative dimensions, so testing for 0 is enough.
65 return (width_ == 0) || (height_ == 0); 65 return (width_ == 0) || (height_ == 0);
66 } 66 }
67 67
68 #if defined(OS_WIN) 68 #if defined(OS_WIN)
69 SIZE ToSIZE() const; 69 SIZE ToSIZE() const;
70 #elif defined(OS_MACOSX) 70 #elif defined(OS_MACOSX)
71 CGSize ToCGSize() const; 71 CGSize ToCGSize() const;
72 #endif 72 #endif
73 73
74 std::string ToString() const;
75
74 private: 76 private:
75 int width_; 77 int width_;
76 int height_; 78 int height_;
77 }; 79 };
78 80
79 UI_EXPORT std::ostream& operator<<(std::ostream& out, const gfx::Size& s);
80
81 } // namespace gfx 81 } // namespace gfx
82 82
83 #endif // UI_GFX_SIZE_H_ 83 #endif // UI_GFX_SIZE_H_
OLDNEW
« no previous file with comments | « ui/gfx/rect.cc ('k') | ui/gfx/size.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698