OLD | NEW |
---|---|
1 // Copyright (c) 2010 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 APP_BIDI_LINE_ITERATOR_H_ | 5 #ifndef BASE_I18N_BIDI_LINE_ITERATOR_H_ |
6 #define APP_BIDI_LINE_ITERATOR_H_ | 6 #define BASE_I18N_BIDI_LINE_ITERATOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "unicode/ubidi.h" | 11 #include "unicode/ubidi.h" |
tony
2011/01/18 19:24:29
What happened when you tried to move this include
tfarina
2011/01/18 19:34:47
As I told to Brett:
"It's possible to forward this
| |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/string16.h" | 14 #include "base/string16.h" |
15 | 15 |
16 namespace base { | |
17 namespace i18n { | |
18 | |
16 // A simple wrapper class for the bidirectional iterator of ICU. | 19 // A simple wrapper class for the bidirectional iterator of ICU. |
17 // This class uses the bidirectional iterator of ICU to split a line of | 20 // This class uses the bidirectional iterator of ICU to split a line of |
18 // bidirectional texts into visual runs in its display order. | 21 // bidirectional texts into visual runs in its display order. |
19 class BiDiLineIterator { | 22 class BiDiLineIterator { |
20 public: | 23 public: |
21 BiDiLineIterator() : bidi_(NULL) { } | 24 BiDiLineIterator(); |
22 ~BiDiLineIterator(); | 25 ~BiDiLineIterator(); |
23 | 26 |
24 // Initializes the bidirectional iterator with the specified text. Returns | 27 // Initializes the bidirectional iterator with the specified text. Returns |
25 // whether initialization succeeded. | 28 // whether initialization succeeded. |
26 UBool Open(const string16& text, bool right_to_left, bool url); | 29 bool Open(const string16& text, bool right_to_left, bool url); |
27 | 30 |
28 // Returns the number of visual runs in the text, or zero on error. | 31 // Returns the number of visual runs in the text, or zero on error. |
29 int CountRuns(); | 32 int CountRuns(); |
30 | 33 |
31 // Gets the logical offset, length, and direction of the specified visual run. | 34 // Gets the logical offset, length, and direction of the specified visual run. |
32 UBiDiDirection GetVisualRun(int index, int* start, int* length); | 35 UBiDiDirection GetVisualRun(int index, int* start, int* length); |
33 | 36 |
34 // Given a start position, figure out where the run ends (and the BiDiLevel). | 37 // Given a start position, figure out where the run ends (and the BiDiLevel). |
35 void GetLogicalRun(int start, int* end, UBiDiLevel* level); | 38 void GetLogicalRun(int start, int* end, UBiDiLevel* level); |
36 | 39 |
37 private: | 40 private: |
38 UBiDi* bidi_; | 41 UBiDi* bidi_; |
39 | 42 |
40 DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); | 43 DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); |
41 }; | 44 }; |
42 | 45 |
43 #endif // APP_BIDI_LINE_ITERATOR_H_ | 46 } // namespace i18n |
47 } // namespace base | |
48 | |
49 #endif // BASE_I18N_BIDI_LINE_ITERATOR_H_ | |
OLD | NEW |