OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RANGE_H_ | 5 #ifndef UI_GFX_RANGE_RANGE_H_ |
6 #define UI_GFX_RANGE_RANGE_H_ | 6 #define UI_GFX_RANGE_RANGE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // is_reversed(), the range will get flipped when converted to an NSRange. | 101 // is_reversed(), the range will get flipped when converted to an NSRange. |
102 NSRange ToNSRange() const; | 102 NSRange ToNSRange() const; |
103 #elif defined(OS_WIN) | 103 #elif defined(OS_WIN) |
104 CHARRANGE ToCHARRANGE() const; | 104 CHARRANGE ToCHARRANGE() const; |
105 #endif | 105 #endif |
106 // GTK+ has no concept of a range. | 106 // GTK+ has no concept of a range. |
107 | 107 |
108 std::string ToString() const; | 108 std::string ToString() const; |
109 | 109 |
110 private: | 110 private: |
| 111 // Note: we use uint32_t instead of size_t because this struct is sent over |
| 112 // IPC which could span 32 & 64 bit processes. This is fine since text spans |
| 113 // shouldn't exceed UINT32_MAX even on 64 bit builds. |
111 uint32_t start_; | 114 uint32_t start_; |
112 uint32_t end_; | 115 uint32_t end_; |
113 }; | 116 }; |
114 | 117 |
115 GFX_EXPORT std::ostream& operator<<(std::ostream& os, const Range& range); | 118 GFX_EXPORT std::ostream& operator<<(std::ostream& os, const Range& range); |
116 | 119 |
117 } // namespace gfx | 120 } // namespace gfx |
118 | 121 |
119 #endif // UI_GFX_RANGE_RANGE_H_ | 122 #endif // UI_GFX_RANGE_RANGE_H_ |
OLD | NEW |