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,
439 template<
typename StringClass>
440 inline StringClass toLanguageTag(
UErrorCode& status)
const;
451 static Locale U_EXPORT2 createFromName(
const char *name);
461 static Locale U_EXPORT2 createCanonical(
const char* name);
468 inline const char * getLanguage( )
const;
477 inline const char * getScript( )
const;
484 inline const char * getCountry( )
const;
491 inline const char * getVariant( )
const;
501 inline const char * getName()
const;
510 const char * getBaseName()
const;
615 template<
typename StringClass,
typename OutputIterator>
616 inline void getKeywords(OutputIterator iterator,
UErrorCode& status)
const;
629 template<
typename StringClass,
typename OutputIterator>
630 inline void getUnicodeKeywords(OutputIterator iterator,
UErrorCode& status)
const;
648 int32_t getKeywordValue(
const char* keywordName,
char *buffer, int32_t bufferCapacity,
UErrorCode &status)
const;
678 template<
typename StringClass>
709 template<
typename StringClass>
731 void setKeywordValue(
const char* keywordName,
const char* keywordValue,
UErrorCode &status);
779 const char * getISO3Language()
const;
786 const char * getISO3Country()
const;
795 uint32_t getLCID(
void)
const;
810 UBool isRightToLeft()
const;
947 int32_t hashCode(
void)
const;
964 inline UBool isBogus(
void)
const;
974 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
984 static const char*
const* U_EXPORT2 getISOCountries();
994 static const char*
const* U_EXPORT2 getISOLanguages();
1001 static UClassID U_EXPORT2 getStaticClassID();
1023 virtual UBool hasNext()
const = 0;
1029 virtual const Locale &next() = 0;
1036 template<
typename Iter>
1072 template<
typename Iter,
typename Conv>
1086 it_(begin), end_(end), converter_(converter) {}
1107 #ifndef U_HIDE_INTERNAL_API
1112 void setFromPOSIXID(
const char *posixID);
1123 Locale& init(
const char* cLocaleID,
UBool canonicalize);
1133 Locale(ELocaleType);
1138 static Locale *getLocaleCache(
void);
1143 int32_t variantBegin;
1152 static const Locale &getLocale(
int locid);
1158 friend Locale *locale_set_default_internal(
const char *,
UErrorCode& status);
1172 template<
typename StringClass>
inline StringClass
1177 toLanguageTag(sink, status);
1182 Locale::getCountry()
const
1188 Locale::getLanguage()
const
1194 Locale::getScript()
const
1200 Locale::getVariant()
const
1202 return &baseName[variantBegin];
1206 Locale::getName()
const
1211 template<
typename StringClass,
typename OutputIterator>
inline void
1212 Locale::getKeywords(OutputIterator iterator,
UErrorCode& status)
const
1219 int32_t resultLength;
1220 const char* buffer = keys->next(&resultLength, status);
1221 if (
U_FAILURE(status) || buffer ==
nullptr) {
1224 *iterator++ = StringClass(buffer, resultLength);
1228 template<
typename StringClass,
typename OutputIterator>
inline void
1229 Locale::getUnicodeKeywords(OutputIterator iterator,
UErrorCode& status)
const
1236 int32_t resultLength;
1237 const char* buffer = keys->next(&resultLength, status);
1238 if (
U_FAILURE(status) || buffer ==
nullptr) {
1241 *iterator++ = StringClass(buffer, resultLength);
1245 template<
typename StringClass>
inline StringClass
1250 getKeywordValue(keywordName, sink, status);
1254 template<
typename StringClass>
inline StringClass
1259 getUnicodeKeywordValue(keywordName, sink, status);
1264 Locale::isBogus(
void)
const {
const Locale & next() override
virtual UClassID getDynamicClassID() const
ICU4C "poor man's RTTI", returns a UClassID for the actual ICU class.
#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.
UBool isNull() const
NULL check.
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.
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
UBool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
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 signed-byte integer.
A Locale object represents a specific geographical, political, or cultural region.