| OLD | NEW |
| 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_RANGE_H_ | 5 #ifndef UI_GFX_RANGE_H_ |
| 6 #define UI_GFX_RANGE_H_ | 6 #define UI_GFX_RANGE_H_ |
| 7 | 7 |
| 8 #include <iosfwd> | 8 #include <iosfwd> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "ui/ui_api.h" | 11 #include "ui/base/ui_export.h" |
| 12 | 12 |
| 13 #if defined(OS_MACOSX) | 13 #if defined(OS_MACOSX) |
| 14 #if __OBJC__ | 14 #if __OBJC__ |
| 15 #import <Foundation/Foundation.h> | 15 #import <Foundation/Foundation.h> |
| 16 #else | 16 #else |
| 17 typedef struct _NSRange NSRange; | 17 typedef struct _NSRange NSRange; |
| 18 #endif | 18 #endif |
| 19 #endif // defined(OS_MACOSX) | 19 #endif // defined(OS_MACOSX) |
| 20 | 20 |
| 21 #if defined(OS_WIN) | 21 #if defined(OS_WIN) |
| 22 #include <windows.h> | 22 #include <windows.h> |
| 23 #include <richedit.h> | 23 #include <richedit.h> |
| 24 #endif | 24 #endif |
| 25 | 25 |
| 26 namespace ui { | 26 namespace ui { |
| 27 | 27 |
| 28 // A Range contains two integer values that represent a numeric range, like the | 28 // A Range contains two integer values that represent a numeric range, like the |
| 29 // range of characters in a text selection. A range is made of a start and end | 29 // range of characters in a text selection. A range is made of a start and end |
| 30 // position; when they are the same, the Range is akin to a caret. Note that | 30 // position; when they are the same, the Range is akin to a caret. Note that |
| 31 // |start_| can be greater than |end_| to respect the directionality of the | 31 // |start_| can be greater than |end_| to respect the directionality of the |
| 32 // range. | 32 // range. |
| 33 class UI_API Range { | 33 class UI_EXPORT Range { |
| 34 public: | 34 public: |
| 35 // Creates an empty range {0,0}. | 35 // Creates an empty range {0,0}. |
| 36 Range(); | 36 Range(); |
| 37 | 37 |
| 38 // Initializes the range with a start and end. | 38 // Initializes the range with a start and end. |
| 39 Range(size_t start, size_t end); | 39 Range(size_t start, size_t end); |
| 40 | 40 |
| 41 // Initializes the range with the same start and end positions. | 41 // Initializes the range with the same start and end positions. |
| 42 explicit Range(size_t position); | 42 explicit Range(size_t position); |
| 43 | 43 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 #elif defined(OS_WIN) | 99 #elif defined(OS_WIN) |
| 100 CHARRANGE ToCHARRANGE() const; | 100 CHARRANGE ToCHARRANGE() const; |
| 101 #endif | 101 #endif |
| 102 // GTK+ has no concept of a range. | 102 // GTK+ has no concept of a range. |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 size_t start_; | 105 size_t start_; |
| 106 size_t end_; | 106 size_t end_; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 UI_API std::ostream& operator<<(std::ostream& out, const ui::Range& range); | 109 UI_EXPORT std::ostream& operator<<(std::ostream& out, const ui::Range& range); |
| 110 | 110 |
| 111 } // namespace gfx | 111 } // namespace gfx |
| 112 | 112 |
| 113 #endif // UI_GFX_RANGE_H_ | 113 #endif // UI_GFX_RANGE_H_ |
| OLD | NEW |