36 #if U_SHOW_CPLUSPLUS_API 56 class StringEnumeration;
198 static const Locale &U_EXPORT2 getRoot(
void);
200 static const Locale &U_EXPORT2 getEnglish(
void);
202 static const Locale &U_EXPORT2 getFrench(
void);
204 static const Locale &U_EXPORT2 getGerman(
void);
206 static const Locale &U_EXPORT2 getItalian(
void);
208 static const Locale &U_EXPORT2 getJapanese(
void);
210 static const Locale &U_EXPORT2 getKorean(
void);
212 static const Locale &U_EXPORT2 getChinese(
void);
214 static const Locale &U_EXPORT2 getSimplifiedChinese(
void);
216 static const Locale &U_EXPORT2 getTraditionalChinese(
void);
219 static const Locale &U_EXPORT2 getFrance(
void);
221 static const Locale &U_EXPORT2 getGermany(
void);
223 static const Locale &U_EXPORT2 getItaly(
void);
225 static const Locale &U_EXPORT2 getJapan(
void);
227 static const Locale &U_EXPORT2 getKorea(
void);
229 static const Locale &U_EXPORT2 getChina(
void);
231 static const Locale &U_EXPORT2 getPRC(
void);
233 static const Locale &U_EXPORT2 getTaiwan(
void);
235 static const Locale &U_EXPORT2 getUK(
void);
237 static const Locale &U_EXPORT2 getUS(
void);
239 static const Locale &U_EXPORT2 getCanada(
void);
241 static const Locale &U_EXPORT2 getCanadaFrench(
void);
277 Locale(
const char * language,
278 const char * country = 0,
279 const char * variant = 0,
280 const char * keywordsAndValues = 0);
357 #ifndef U_HIDE_SYSTEM_API 373 static const Locale& U_EXPORT2 getDefault(
void);
387 static void U_EXPORT2 setDefault(
const Locale& newLocale,
435 template<
typename StringClass>
436 inline StringClass toLanguageTag(
UErrorCode& status)
const;
447 static Locale U_EXPORT2 createFromName(
const char *name);
457 static Locale U_EXPORT2 createCanonical(
const char* name);
464 inline const char * getLanguage( )
const;
473 inline const char * getScript( )
const;
480 inline const char * getCountry( )
const;
487 inline const char * getVariant( )
const;
497 inline const char * getName()
const;
506 const char * getBaseName()
const;
603 template<
typename StringClass,
typename OutputIterator>
604 inline void getKeywords(OutputIterator iterator,
UErrorCode& status)
const;
617 template<
typename StringClass,
typename OutputIterator>
618 inline void getUnicodeKeywords(OutputIterator iterator,
UErrorCode& status)
const;
636 int32_t getKeywordValue(
const char* keywordName,
char *buffer, int32_t bufferCapacity,
UErrorCode &status)
const;
666 template<
typename StringClass>
697 template<
typename StringClass>
719 void setKeywordValue(
const char* keywordName,
const char* keywordValue,
UErrorCode &status);
767 const char * getISO3Language()
const;
774 const char * getISO3Country()
const;
783 uint32_t getLCID(
void)
const;
798 UBool isRightToLeft()
const;
935 int32_t hashCode(
void)
const;
952 inline UBool isBogus(
void)
const;
962 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
972 static const char*
const* U_EXPORT2 getISOCountries();
982 static const char*
const* U_EXPORT2 getISOLanguages();
989 static UClassID U_EXPORT2 getStaticClassID();
998 #ifndef U_HIDE_DRAFT_API 1012 virtual UBool hasNext()
const = 0;
1018 virtual const Locale &next() = 0;
1025 template<
typename Iter>
1061 template<
typename Iter,
typename Conv>
1075 it_(begin), end_(end), converter_(converter) {}
1094 #endif // U_HIDE_DRAFT_API 1097 #ifndef U_HIDE_INTERNAL_API 1102 void setFromPOSIXID(
const char *posixID);
1113 Locale& init(
const char* cLocaleID,
UBool canonicalize);
1128 static Locale *getLocaleCache(
void);
1133 int32_t variantBegin;
1142 static const Locale &getLocale(
int locid);
1148 friend Locale *locale_set_default_internal(
const char *,
UErrorCode& status);
1162 template<
typename StringClass>
inline StringClass
1167 toLanguageTag(sink, status);
1172 Locale::getCountry()
const 1178 Locale::getLanguage()
const 1184 Locale::getScript()
const 1190 Locale::getVariant()
const 1192 return &baseName[variantBegin];
1196 Locale::getName()
const 1201 template<
typename StringClass,
typename OutputIterator>
inline void 1202 Locale::getKeywords(OutputIterator iterator,
UErrorCode& status)
const 1209 int32_t resultLength;
1210 const char* buffer = keys->next(&resultLength, status);
1211 if (
U_FAILURE(status) || buffer ==
nullptr) {
1214 *iterator++ = StringClass(buffer, resultLength);
1218 template<
typename StringClass,
typename OutputIterator>
inline void 1219 Locale::getUnicodeKeywords(OutputIterator iterator,
UErrorCode& status)
const 1226 int32_t resultLength;
1227 const char* buffer = keys->next(&resultLength, status);
1228 if (
U_FAILURE(status) || buffer ==
nullptr) {
1231 *iterator++ = StringClass(buffer, resultLength);
1235 template<
typename StringClass>
inline StringClass
1240 getKeywordValue(keywordName, sink, status);
1244 template<
typename StringClass>
inline StringClass
1249 getUnicodeKeywordValue(keywordName, sink, status);
1254 Locale::isBogus(
void)
const {
const Locale & next() override
#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.
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...
UBool hasNext() const override
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
#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.
A Locale iterator interface similar to a Java Iterator<Locale>.
void locale_available_init()
C++ API: StringPiece: Read-only byte string wrapper class.
C++ API: Interface for writing bytes, and implementation classes.
A generic Locale iterator implementation over Locale input iterators.
UBool isNull() const
NULL check.
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
C API: Platform Utilities.
RangeIterator(Iter begin, Iter end)
Constructs an iterator from a begin/end range.
C++ API: Common ICU base class UObject.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
C++ API: String Enumeration.
Basic definitions for ICU, for both C and C++ APIs.
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...
A generic Locale iterator implementation over Locale input iterators.
A string-like object that points to a sized piece of memory.
UObject is the common ICU "boilerplate" class.
UMemory is the common ICU base class.
const Locale & next() override
ConvertingIterator(Iter begin, Iter end, Conv converter)
Constructs an iterator from a begin/end range.
UBool hasNext() const override
int8_t UBool
The ICU boolean type.
A Locale object represents a specific geographical, political, or cultural region.