| 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 BASE_I18N_RTL_H_ | 5 #ifndef BASE_I18N_RTL_H_ |
| 6 #define BASE_I18N_RTL_H_ | 6 #define BASE_I18N_RTL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // Returns whether the text direction for the default ICU locale is RTL. This | 57 // Returns whether the text direction for the default ICU locale is RTL. This |
| 58 // assumes that SetICUDefaultLocale has been called to set the default locale to | 58 // assumes that SetICUDefaultLocale has been called to set the default locale to |
| 59 // the UI locale of Chrome. | 59 // the UI locale of Chrome. |
| 60 // NOTE: Generally, you should call IsRTL() instead of this. | 60 // NOTE: Generally, you should call IsRTL() instead of this. |
| 61 BASE_I18N_EXPORT bool ICUIsRTL(); | 61 BASE_I18N_EXPORT bool ICUIsRTL(); |
| 62 | 62 |
| 63 // Returns the text direction for |locale_name|. | 63 // Returns the text direction for |locale_name|. |
| 64 BASE_I18N_EXPORT TextDirection GetTextDirectionForLocale( | 64 BASE_I18N_EXPORT TextDirection GetTextDirectionForLocale( |
| 65 const char* locale_name); | 65 const char* locale_name); |
| 66 | 66 |
| 67 // Given the string in |text|, returns the directionality of the first | 67 // Given the string in |text|, returns the directionality of the first or last |
| 68 // character with strong directionality in the string. If no character in the | 68 // character with strong directionality in the string. If no character in the |
| 69 // text has strong directionality, LEFT_TO_RIGHT is returned. The Bidi | 69 // text has strong directionality, LEFT_TO_RIGHT is returned. The Bidi |
| 70 // character types L, LRE, LRO, R, AL, RLE, and RLO are considered as strong | 70 // character types L, LRE, LRO, R, AL, RLE, and RLO are considered as strong |
| 71 // directionality characters. Please refer to http://unicode.org/reports/tr9/ | 71 // directionality characters. Please refer to http://unicode.org/reports/tr9/ |
| 72 // for more information. | 72 // for more information. |
| 73 BASE_I18N_EXPORT TextDirection GetFirstStrongCharacterDirection( | 73 BASE_I18N_EXPORT TextDirection GetFirstStrongCharacterDirection( |
| 74 const string16& text); | 74 const string16& text); |
| 75 BASE_I18N_EXPORT TextDirection GetLastStrongCharacterDirection( |
| 76 const string16& text); |
| 75 | 77 |
| 76 // Given the string in |text|, returns LEFT_TO_RIGHT or RIGHT_TO_LEFT if all the | 78 // Given the string in |text|, returns LEFT_TO_RIGHT or RIGHT_TO_LEFT if all the |
| 77 // strong directionality characters in the string are of the same | 79 // strong directionality characters in the string are of the same |
| 78 // directionality. It returns UNKNOWN_DIRECTION if the string contains a mix of | 80 // directionality. It returns UNKNOWN_DIRECTION if the string contains a mix of |
| 79 // LTR and RTL strong directionality characters. Defaults to LEFT_TO_RIGHT if | 81 // LTR and RTL strong directionality characters. Defaults to LEFT_TO_RIGHT if |
| 80 // the string does not contain directionality characters. Please refer to | 82 // the string does not contain directionality characters. Please refer to |
| 81 // http://unicode.org/reports/tr9/ for more information. | 83 // http://unicode.org/reports/tr9/ for more information. |
| 82 BASE_I18N_EXPORT TextDirection GetStringDirection(const string16& text); | 84 BASE_I18N_EXPORT TextDirection GetStringDirection(const string16& text); |
| 83 | 85 |
| 84 // Given the string in |text|, this function modifies the string in place with | 86 // Given the string in |text|, this function modifies the string in place with |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // return the text itself. Explicit bidi control characters display and have | 140 // return the text itself. Explicit bidi control characters display and have |
| 139 // semantic effect. They can be deleted so they might not always appear in a | 141 // semantic effect. They can be deleted so they might not always appear in a |
| 140 // pair. | 142 // pair. |
| 141 BASE_I18N_EXPORT string16 StripWrappingBidiControlCharacters( | 143 BASE_I18N_EXPORT string16 StripWrappingBidiControlCharacters( |
| 142 const string16& text) WARN_UNUSED_RESULT; | 144 const string16& text) WARN_UNUSED_RESULT; |
| 143 | 145 |
| 144 } // namespace i18n | 146 } // namespace i18n |
| 145 } // namespace base | 147 } // namespace base |
| 146 | 148 |
| 147 #endif // BASE_I18N_RTL_H_ | 149 #endif // BASE_I18N_RTL_H_ |
| OLD | NEW |