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 #include "app/bidi_line_iterator.h" | 5 #include "base/i18n/bidi_line_iterator.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/string16.h" | 8 #include "base/string16.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 | 10 |
11 BiDiLineIterator::~BiDiLineIterator() { | 11 BiDiLineIterator::~BiDiLineIterator() { |
12 if (bidi_) { | 12 if (bidi_) { |
13 ubidi_close(bidi_); | 13 ubidi_close(bidi_); |
14 bidi_ = NULL; | 14 bidi_ = NULL; |
15 } | 15 } |
16 } | 16 } |
17 | 17 |
18 UBool BiDiLineIterator::Open(const std::wstring& text, | 18 UBool BiDiLineIterator::Open(const std::wstring& text, |
brettw
2011/01/14 19:09:51
Can we replace wstring with string16? Then you can
tfarina
2011/01/14 23:16:10
Done.
| |
19 bool right_to_left, | 19 bool right_to_left, |
20 bool url) { | 20 bool url) { |
21 DCHECK(bidi_ == NULL); | 21 DCHECK(bidi_ == NULL); |
22 UErrorCode error = U_ZERO_ERROR; | 22 UErrorCode error = U_ZERO_ERROR; |
23 bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error); | 23 bidi_ = ubidi_openSized(static_cast<int>(text.length()), 0, &error); |
24 if (U_FAILURE(error)) | 24 if (U_FAILURE(error)) |
25 return false; | 25 return false; |
26 if (right_to_left && url) | 26 if (right_to_left && url) |
27 ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY); | 27 ubidi_setReorderingMode(bidi_, UBIDI_REORDER_RUNS_ONLY); |
28 #if defined(WCHAR_T_IS_UTF32) | 28 #if defined(WCHAR_T_IS_UTF32) |
(...skipping 20 matching lines...) Expand all Loading... | |
49 DCHECK(bidi_ != NULL); | 49 DCHECK(bidi_ != NULL); |
50 return ubidi_getVisualRun(bidi_, index, start, length); | 50 return ubidi_getVisualRun(bidi_, index, start, length); |
51 } | 51 } |
52 | 52 |
53 void BiDiLineIterator::GetLogicalRun(int start, | 53 void BiDiLineIterator::GetLogicalRun(int start, |
54 int* end, | 54 int* end, |
55 UBiDiLevel* level) { | 55 UBiDiLevel* level) { |
56 DCHECK(bidi_ != NULL); | 56 DCHECK(bidi_ != NULL); |
57 ubidi_getLogicalRun(bidi_, start, end, level); | 57 ubidi_getLogicalRun(bidi_, start, end, level); |
58 } | 58 } |
OLD | NEW |