Chromium Code Reviews| 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" |
|
brettw
2011/01/14 19:09:51
I think we can remove this dependency and move it
tfarina
2011/01/14 23:16:10
It's possible to forward this struct and UBiDiLeve
| |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 | 14 |
| 15 // A simple wrapper class for the bidirectional iterator of ICU. | 15 // A simple wrapper class for the bidirectional iterator of ICU. |
| 16 // This class uses the bidirectional iterator of ICU to split a line of | 16 // This class uses the bidirectional iterator of ICU to split a line of |
| 17 // bidirectional texts into visual runs in its display order. | 17 // bidirectional texts into visual runs in its display order. |
| 18 class BiDiLineIterator { | 18 class BiDiLineIterator { |
|
brettw
2011/01/14 19:09:51
Can we put this in the base::i18n namespace?
tfarina
2011/01/14 23:16:10
Done.
| |
| 19 public: | 19 public: |
| 20 BiDiLineIterator() : bidi_(NULL) { } | 20 BiDiLineIterator() : bidi_(NULL) { } |
| 21 ~BiDiLineIterator(); | 21 ~BiDiLineIterator(); |
| 22 | 22 |
| 23 // Initializes the bidirectional iterator with the specified text. Returns | 23 // Initializes the bidirectional iterator with the specified text. Returns |
| 24 // whether initialization succeeded. | 24 // whether initialization succeeded. |
| 25 UBool Open(const std::wstring& text, bool right_to_left, bool url); | 25 UBool Open(const std::wstring& text, bool right_to_left, bool url); |
| 26 | 26 |
| 27 // Returns the number of visual runs in the text, or zero on error. | 27 // Returns the number of visual runs in the text, or zero on error. |
| 28 int CountRuns(); | 28 int CountRuns(); |
| 29 | 29 |
| 30 // Gets the logical offset, length, and direction of the specified visual run. | 30 // Gets the logical offset, length, and direction of the specified visual run. |
| 31 UBiDiDirection GetVisualRun(int index, int* start, int* length); | 31 UBiDiDirection GetVisualRun(int index, int* start, int* length); |
| 32 | 32 |
| 33 // Given a start position, figure out where the run ends (and the BiDiLevel). | 33 // Given a start position, figure out where the run ends (and the BiDiLevel). |
| 34 void GetLogicalRun(int start, int* end, UBiDiLevel* level); | 34 void GetLogicalRun(int start, int* end, UBiDiLevel* level); |
| 35 | 35 |
| 36 private: | 36 private: |
| 37 UBiDi* bidi_; | 37 UBiDi* bidi_; |
| 38 | 38 |
| 39 DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); | 39 DISALLOW_COPY_AND_ASSIGN(BiDiLineIterator); |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 #endif // APP_BIDI_LINE_ITERATOR_H_ | 42 #endif // BASE_I18N_BIDI_LINE_ITERATOR_H_ |
| OLD | NEW |