53 class StringEnumeration;
195 static const Locale &U_EXPORT2 getRoot(
void);
197 static const Locale &U_EXPORT2 getEnglish(
void);
199 static const Locale &U_EXPORT2 getFrench(
void);
201 static const Locale &U_EXPORT2 getGerman(
void);
203 static const Locale &U_EXPORT2 getItalian(
void);
205 static const Locale &U_EXPORT2 getJapanese(
void);
207 static const Locale &U_EXPORT2 getKorean(
void);
209 static const Locale &U_EXPORT2 getChinese(
void);
211 static const Locale &U_EXPORT2 getSimplifiedChinese(
void);
213 static const Locale &U_EXPORT2 getTraditionalChinese(
void);
216 static const Locale &U_EXPORT2 getFrance(
void);
218 static const Locale &U_EXPORT2 getGermany(
void);
220 static const Locale &U_EXPORT2 getItaly(
void);
222 static const Locale &U_EXPORT2 getJapan(
void);
224 static const Locale &U_EXPORT2 getKorea(
void);
226 static const Locale &U_EXPORT2 getChina(
void);
228 static const Locale &U_EXPORT2 getPRC(
void);
230 static const Locale &U_EXPORT2 getTaiwan(
void);
232 static const Locale &U_EXPORT2 getUK(
void);
234 static const Locale &U_EXPORT2 getUS(
void);
236 static const Locale &U_EXPORT2 getCanada(
void);
238 static const Locale &U_EXPORT2 getCanadaFrench(
void);
274 Locale(
const char * language,
275 const char * country = 0,
276 const char * variant = 0,
277 const char * keywordsAndValues = 0);
287 #ifndef U_HIDE_DRAFT_API 296 #endif // U_HIDE_DRAFT_API 313 #ifndef U_HIDE_DRAFT_API 324 #endif // U_HIDE_DRAFT_API 358 #ifndef U_HIDE_SYSTEM_API 374 static const Locale& U_EXPORT2 getDefault(
void);
388 static void U_EXPORT2 setDefault(
const Locale& newLocale,
392 #ifndef U_HIDE_DRAFT_API 437 template<
typename StringClass>
438 inline StringClass toLanguageTag(
UErrorCode& status)
const;
439 #endif // U_HIDE_DRAFT_API 450 static Locale U_EXPORT2 createFromName(
const char *name);
460 static Locale U_EXPORT2 createCanonical(
const char* name);
467 inline const char * getLanguage( )
const;
476 inline const char * getScript( )
const;
483 inline const char * getCountry( )
const;
490 inline const char * getVariant( )
const;
500 inline const char * getName()
const;
509 const char * getBaseName()
const;
511 #ifndef U_HIDE_DRAFT_API 573 #endif // U_HIDE_DRAFT_API 586 #ifndef U_HIDE_DRAFT_API 610 template<
typename StringClass,
typename OutputIterator>
611 inline void getKeywords(OutputIterator iterator,
UErrorCode& status)
const;
624 template<
typename StringClass,
typename OutputIterator>
625 inline void getUnicodeKeywords(OutputIterator iterator,
UErrorCode& status)
const;
627 #endif // U_HIDE_DRAFT_API 645 int32_t getKeywordValue(
const char* keywordName,
char *buffer, int32_t bufferCapacity,
UErrorCode &status)
const;
647 #ifndef U_HIDE_DRAFT_API 676 template<
typename StringClass>
707 template<
typename StringClass>
709 #endif // U_HIDE_DRAFT_API 730 void setKeywordValue(
const char* keywordName,
const char* keywordValue,
UErrorCode &status);
732 #ifndef U_HIDE_DRAFT_API 772 #endif // U_HIDE_DRAFT_API 780 const char * getISO3Language()
const;
787 const char * getISO3Country()
const;
796 uint32_t getLCID(
void)
const;
811 UBool isRightToLeft()
const;
948 int32_t hashCode(
void)
const;
965 inline UBool isBogus(
void)
const;
975 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
985 static const char*
const* U_EXPORT2 getISOCountries();
995 static const char*
const* U_EXPORT2 getISOLanguages();
1002 static UClassID U_EXPORT2 getStaticClassID();
1012 #ifndef U_HIDE_INTERNAL_API 1017 void setFromPOSIXID(
const char *posixID);
1028 Locale& init(
const char* cLocaleID,
UBool canonicalize);
1043 static Locale *getLocaleCache(
void);
1048 int32_t variantBegin;
1057 static const Locale &getLocale(
int locid);
1063 friend Locale *locale_set_default_internal(
const char *,
UErrorCode& status);
1077 #ifndef U_HIDE_DRAFT_API 1078 template<
typename StringClass>
inline StringClass
1083 toLanguageTag(sink, status);
1086 #endif // U_HIDE_DRAFT_API 1109 return &baseName[variantBegin];
1118 #ifndef U_HIDE_DRAFT_API 1120 template<
typename StringClass,
typename OutputIterator>
inline void 1128 int32_t resultLength;
1129 const char* buffer = keys->next(&resultLength, status);
1130 if (
U_FAILURE(status) || buffer ==
nullptr) {
1133 *iterator++ = StringClass(buffer, resultLength);
1137 template<
typename StringClass,
typename OutputIterator>
inline void 1145 int32_t resultLength;
1146 const char* buffer = keys->next(&resultLength, status);
1147 if (
U_FAILURE(status) || buffer ==
nullptr) {
1150 *iterator++ = StringClass(buffer, resultLength);
1154 template<
typename StringClass>
inline StringClass
1159 getKeywordValue(keywordName, sink, status);
1163 template<
typename StringClass>
inline StringClass
1168 getUnicodeKeywordValue(keywordName, sink, status);
1172 #endif // U_HIDE_DRAFT_API const char * getLanguage() const
Returns the locale's ISO-639 language code.
#define U_FAILURE(x)
Does the error code indicate a failure?
#define ULOC_LANG_CAPACITY
Useful constant for the maximum size of the language part of a locale ID.
"Smart pointer" class, deletes objects via the standard C++ delete operator.
const char * getScript() const
Returns the locale's ISO-15924 abbreviation script code.
U_EXPORT UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
#define ULOC_COUNTRY_CAPACITY
Useful constant for the maximum size of the country part of a locale ID (including the terminating NU...
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
const char * getName() const
Returns the programmatic name of the entire locale, with the language, country and variant separated ...
#define ULOC_FULLNAME_CAPACITY
Useful constant for the maximum size of the whole locale ID (including the terminating NULL and all k...
Base class for 'pure' C++ implementations of uenum api.
#define ULOC_SCRIPT_CAPACITY
Useful constant for the maximum size of the script part of a locale ID (including the terminating NUL...
A ByteSink can be filled with bytes.
const char * getCountry() const
Returns the locale's ISO-3166 country code.
void locale_available_init()
const char * getVariant() const
Returns the locale's variant code.
C++ API: StringPiece: Read-only byte string wrapper class.
#define U_NAMESPACE_BEGIN
This is used to begin a declaration of a public ICU C++ API.
void getUnicodeKeywords(OutputIterator iterator, UErrorCode &status) const
Gets the set of Unicode keywords for this Locale.
C++ API: Interface for writing bytes, and implementation classes.
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
UBool isBogus(void) const
Gets the bogus state.
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
C API: Platform Utilities.
void getUnicodeKeywordValue(StringPiece keywordName, ByteSink &sink, UErrorCode &status) const
Gets the Unicode value for a Unicode keyword.
UBool operator!=(const Locale &other) const
Checks if two locale keys are not the same.
C++ API: Common ICU base class UObject.
#define U_NAMESPACE_END
This is used to end a declaration of a public ICU C++ API.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
C++ API: String Enumeration.
Basic definitions for ICU, for both C and C++ APIs.
void getKeywords(OutputIterator iterator, UErrorCode &status) const
Gets the set of keywords for this Locale.
Implementation of ByteSink that writes to a "string".
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside...
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
void toLanguageTag(ByteSink &sink, UErrorCode &status) const
Returns a well-formed language tag for this Locale.
A string-like object that points to a sized piece of memory.
UObject is the common ICU "boilerplate" class.
int8_t UBool
The ICU boolean type.
int32_t getKeywordValue(const char *keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const
Gets the value for a keyword.
A Locale object represents a specific geographical, political, or cultural region.