123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171 |
- #ifndef BASE_I18N_RTL_H_
- #define BASE_I18N_RTL_H_
- #include <string>
- #include "base/compiler_specific.h"
- #include "base/i18n/base_i18n_export.h"
- #include "base/strings/string16.h"
- #include "build/build_config.h"
- namespace base {
- class FilePath;
- namespace i18n {
- const char16 kRightToLeftMark = 0x200F;
- const char16 kLeftToRightMark = 0x200E;
- const char16 kLeftToRightEmbeddingMark = 0x202A;
- const char16 kRightToLeftEmbeddingMark = 0x202B;
- const char16 kPopDirectionalFormatting = 0x202C;
- const char16 kLeftToRightOverride = 0x202D;
- const char16 kRightToLeftOverride = 0x202E;
- enum TextDirection {
- UNKNOWN_DIRECTION = 0,
- RIGHT_TO_LEFT = 1,
- LEFT_TO_RIGHT = 2,
- TEXT_DIRECTION_MAX = LEFT_TO_RIGHT,
- };
- BASE_I18N_EXPORT std::string GetConfiguredLocale();
- BASE_I18N_EXPORT std::string GetCanonicalLocale(const std::string& locale);
- BASE_I18N_EXPORT void SetICUDefaultLocale(const std::string& locale_string);
- BASE_I18N_EXPORT bool IsRTL();
- BASE_I18N_EXPORT void SetRTLForTesting(bool rtl);
- BASE_I18N_EXPORT bool ICUIsRTL();
- BASE_I18N_EXPORT TextDirection GetForcedTextDirection();
- BASE_I18N_EXPORT TextDirection
- GetTextDirectionForLocaleInStartUp(const char* locale_name);
- BASE_I18N_EXPORT TextDirection GetTextDirectionForLocale(
- const char* locale_name);
- BASE_I18N_EXPORT TextDirection GetFirstStrongCharacterDirection(
- const string16& text);
- BASE_I18N_EXPORT TextDirection GetLastStrongCharacterDirection(
- const string16& text);
- BASE_I18N_EXPORT TextDirection GetStringDirection(const string16& text);
- BASE_I18N_EXPORT bool AdjustStringForLocaleDirection(string16* text);
- BASE_I18N_EXPORT bool UnadjustStringForLocaleDirection(string16* text);
- BASE_I18N_EXPORT void EnsureTerminatedDirectionalFormatting(string16* text);
- BASE_I18N_EXPORT void SanitizeUserSuppliedString(string16* text);
- BASE_I18N_EXPORT bool StringContainsStrongRTLChars(const string16& text);
- BASE_I18N_EXPORT void WrapStringWithLTRFormatting(string16* text);
- BASE_I18N_EXPORT void WrapStringWithRTLFormatting(string16* text);
- BASE_I18N_EXPORT void WrapPathWithLTRFormatting(const FilePath& path,
- string16* rtl_safe_path);
- BASE_I18N_EXPORT string16 GetDisplayStringInLTRDirectionality(
- const string16& text) WARN_UNUSED_RESULT;
- BASE_I18N_EXPORT string16 StripWrappingBidiControlCharacters(
- const string16& text) WARN_UNUSED_RESULT;
- }
- }
- #endif
|