| 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" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool operator!=(const Range& other) const; | 80 bool operator!=(const Range& other) const; |
| 81 bool EqualsIgnoringDirection(const Range& other) const; | 81 bool EqualsIgnoringDirection(const Range& other) const; |
| 82 | 82 |
| 83 // Returns true if this range intersects the specified |range|. | 83 // Returns true if this range intersects the specified |range|. |
| 84 bool Intersects(const Range& range) const; | 84 bool Intersects(const Range& range) const; |
| 85 | 85 |
| 86 // Returns true if this range contains the specified |range|. | 86 // Returns true if this range contains the specified |range|. |
| 87 bool Contains(const Range& range) const; | 87 bool Contains(const Range& range) const; |
| 88 | 88 |
| 89 // Computes the intersection of this range with the given |range|. | 89 // Computes the intersection of this range with the given |range|. |
| 90 // If they don't intersects, it returns an InvalidRange(). | 90 // If they don't intersect, it returns an InvalidRange(). |
| 91 // The returned range is always empty or forward (never reversed). |
| 91 Range Intersect(const Range& range) const; | 92 Range Intersect(const Range& range) const; |
| 92 | 93 |
| 93 #if defined(OS_MACOSX) | 94 #if defined(OS_MACOSX) |
| 94 Range& operator=(const NSRange& range); | 95 Range& operator=(const NSRange& range); |
| 95 | 96 |
| 96 // NSRange does not store the directionality of a range, so if this | 97 // NSRange does not store the directionality of a range, so if this |
| 97 // is_reversed(), the range will get flipped when converted to an NSRange. | 98 // is_reversed(), the range will get flipped when converted to an NSRange. |
| 98 NSRange ToNSRange() const; | 99 NSRange ToNSRange() const; |
| 99 #elif defined(OS_WIN) | 100 #elif defined(OS_WIN) |
| 100 CHARRANGE ToCHARRANGE() const; | 101 CHARRANGE ToCHARRANGE() const; |
| 101 #endif | 102 #endif |
| 102 // GTK+ has no concept of a range. | 103 // GTK+ has no concept of a range. |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 size_t start_; | 106 size_t start_; |
| 106 size_t end_; | 107 size_t end_; |
| 107 }; | 108 }; |
| 108 | 109 |
| 109 UI_EXPORT std::ostream& operator<<(std::ostream& out, const ui::Range& range); | 110 UI_EXPORT std::ostream& operator<<(std::ostream& out, const ui::Range& range); |
| 110 | 111 |
| 111 } // namespace gfx | 112 } // namespace gfx |
| 112 | 113 |
| 113 #endif // UI_GFX_RANGE_H_ | 114 #endif // UI_GFX_RANGE_H_ |
| OLD | NEW |