| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 const char16 kPopDirectionalFormatting = 0x202C; | 24 const char16 kPopDirectionalFormatting = 0x202C; |
| 25 const char16 kLeftToRightOverride = 0x202D; | 25 const char16 kLeftToRightOverride = 0x202D; |
| 26 const char16 kRightToLeftOverride = 0x202E; | 26 const char16 kRightToLeftOverride = 0x202E; |
| 27 | 27 |
| 28 enum TextDirection { | 28 enum TextDirection { |
| 29 UNKNOWN_DIRECTION, | 29 UNKNOWN_DIRECTION, |
| 30 RIGHT_TO_LEFT, | 30 RIGHT_TO_LEFT, |
| 31 LEFT_TO_RIGHT, | 31 LEFT_TO_RIGHT, |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // A string along with the text direction it should be displayed in. | |
| 35 // Conceptually this is a struct; we just use 'class' to make it easier for | |
| 36 // others to forward-declare us with 'class String16WithDirection'. | |
| 37 class String16WithDirection { | |
| 38 public: | |
| 39 String16WithDirection() : direction_(UNKNOWN_DIRECTION) { } | |
| 40 String16WithDirection(const string16& str, TextDirection dir) | |
| 41 : string_(str), direction_(dir) { } | |
| 42 | |
| 43 const string16& string() const { return string_; } | |
| 44 TextDirection direction() const { return direction_; } | |
| 45 | |
| 46 bool is_empty() const { return string_.empty(); } | |
| 47 bool operator==(const String16WithDirection& other) const { | |
| 48 return string_ == other.string_ && direction_ == other.direction_; | |
| 49 } | |
| 50 | |
| 51 private: | |
| 52 string16 string_; | |
| 53 TextDirection direction_; | |
| 54 }; | |
| 55 | |
| 56 // Get the locale that the currently running process has been configured to use. | 34 // Get the locale that the currently running process has been configured to use. |
| 57 // The return value is of the form language[-country] (e.g., en-US) where the | 35 // The return value is of the form language[-country] (e.g., en-US) where the |
| 58 // language is the 2 or 3 letter code from ISO-639. | 36 // language is the 2 or 3 letter code from ISO-639. |
| 59 std::string GetConfiguredLocale(); | 37 std::string GetConfiguredLocale(); |
| 60 | 38 |
| 61 // Canonicalize a string (eg. a POSIX locale string) to a Chrome locale name. | 39 // Canonicalize a string (eg. a POSIX locale string) to a Chrome locale name. |
| 62 std::string GetCanonicalLocale(const char* locale); | 40 std::string GetCanonicalLocale(const char* locale); |
| 63 | 41 |
| 64 // Sets the default locale of ICU. | 42 // Sets the default locale of ICU. |
| 65 // Once the application locale of Chrome in GetApplicationLocale is determined, | 43 // Once the application locale of Chrome in GetApplicationLocale is determined, |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // return the text itself. Explicit bidi control characters display and have | 140 // return the text itself. Explicit bidi control characters display and have |
| 163 // 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 |
| 164 // pair. | 142 // pair. |
| 165 const string16 StripWrappingBidiControlCharacters(const string16& text) | 143 const string16 StripWrappingBidiControlCharacters(const string16& text) |
| 166 WARN_UNUSED_RESULT; | 144 WARN_UNUSED_RESULT; |
| 167 | 145 |
| 168 } // namespace i18n | 146 } // namespace i18n |
| 169 } // namespace base | 147 } // namespace base |
| 170 | 148 |
| 171 #endif // BASE_I18N_RTL_H_ | 149 #endif // BASE_I18N_RTL_H_ |
| OLD | NEW |