36 #if U_SHOW_CPLUSPLUS_API 56 class StringEnumeration;
198 static const Locale& U_EXPORT2 getRoot();
200 static const Locale& U_EXPORT2 getEnglish();
202 static const Locale& U_EXPORT2 getFrench();
204 static const Locale& U_EXPORT2 getGerman();
206 static const Locale& U_EXPORT2 getItalian();
208 static const Locale& U_EXPORT2 getJapanese();
210 static const Locale& U_EXPORT2 getKorean();
212 static const Locale& U_EXPORT2 getChinese();
214 static const Locale& U_EXPORT2 getSimplifiedChinese();
216 static const Locale& U_EXPORT2 getTraditionalChinese();
219 static const Locale& U_EXPORT2 getFrance();
221 static const Locale& U_EXPORT2 getGermany();
223 static const Locale& U_EXPORT2 getItaly();
225 static const Locale& U_EXPORT2 getJapan();
227 static const Locale& U_EXPORT2 getKorea();
229 static const Locale& U_EXPORT2 getChina();
231 static const Locale& U_EXPORT2 getPRC();
233 static const Locale& U_EXPORT2 getTaiwan();
235 static const Locale& U_EXPORT2 getUK();
237 static const Locale& U_EXPORT2 getUS();
239 static const Locale& U_EXPORT2 getCanada();
241 static const Locale& U_EXPORT2 getCanadaFrench();
276 Locale(
const char* language,
277 const char* country =
nullptr,
278 const char* variant =
nullptr,
279 const char* keywordsAndValues =
nullptr);
356 #ifndef U_HIDE_SYSTEM_API 372 static const Locale& U_EXPORT2 getDefault();
386 static void U_EXPORT2 setDefault(
const Locale& newLocale,
438 template<
typename StringClass>
439 inline StringClass toLanguageTag(
UErrorCode& status)
const;
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;
614 template<
typename StringClass,
typename OutputIterator>
615 inline void getKeywords(OutputIterator iterator,
UErrorCode& status)
const;
628 template<
typename StringClass,
typename OutputIterator>
629 inline void getUnicodeKeywords(OutputIterator iterator,
UErrorCode& status)
const;
647 int32_t getKeywordValue(
const char* keywordName,
char *buffer, int32_t bufferCapacity,
UErrorCode &status)
const;
677 template<
typename StringClass>
708 template<
typename StringClass>
780 const char * getISO3Language()
const;
787 const char * getISO3Country()
const;
796 uint32_t getLCID()
const;
811 UBool isRightToLeft()
const;
948 int32_t hashCode()
const;
965 inline UBool isBogus()
const;
975 static const Locale* U_EXPORT2 getAvailableLocales(int32_t& count);
985 static const char*
const* U_EXPORT2 getISOCountries();
998 static const char*
const* U_EXPORT2 getISOLanguages();
1005 static UClassID U_EXPORT2 getStaticClassID();
1027 virtual UBool hasNext()
const = 0;
1033 virtual const Locale &next() = 0;
1040 template<
typename Iter>
1076 template<
typename Iter,
typename Conv>
1090 it_(begin), end_(end), converter_(converter) {}
1111 #ifndef U_HIDE_INTERNAL_API 1116 void setFromPOSIXID(
const char *posixID);
1125 void minimizeSubtags(
bool favorScript,
UErrorCode& status);
1136 Locale& init(
const char* cLocaleID,
UBool canonicalize);
1146 Locale(ELocaleType);
1151 static Locale* getLocaleCache();
1156 int32_t variantBegin;
1165 static const Locale &getLocale(
int locid);
1171 friend Locale *locale_set_default_internal(
const char *,
UErrorCode& status);
1185 template<
typename StringClass>
inline StringClass
1191 toLanguageTag(sink, status);
1196 Locale::getCountry()
const 1202 Locale::getLanguage()
const 1208 Locale::getScript()
const 1214 Locale::getVariant()
const 1216 return fIsBogus ?
"" : &baseName[variantBegin];
1220 Locale::getName()
const 1225 template<
typename StringClass,
typename OutputIterator>
inline void 1226 Locale::getKeywords(OutputIterator iterator,
UErrorCode& status)
const 1234 int32_t resultLength;
1235 const char* buffer = keys->next(&resultLength, status);
1236 if (
U_FAILURE(status) || buffer ==
nullptr) {
1239 *iterator++ = StringClass(buffer, resultLength);
1243 template<
typename StringClass,
typename OutputIterator>
inline void 1244 Locale::getUnicodeKeywords(OutputIterator iterator,
UErrorCode& status)
const 1252 int32_t resultLength;
1253 const char* buffer = keys->next(&resultLength, status);
1254 if (
U_FAILURE(status) || buffer ==
nullptr) {
1257 *iterator++ = StringClass(buffer, resultLength);
1261 template<
typename StringClass>
inline StringClass
1267 getKeywordValue(keywordName, sink, status);
1271 template<
typename StringClass>
inline StringClass
1277 getUnicodeKeywordValue(keywordName, sink, status);
1282 Locale::isBogus()
const {
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
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.
void setKeywordValue(const char *keywordName, const char *keywordValue, UErrorCode &status)
Sets or removes the value for a keyword.
#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
nullptr check.
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
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 signed-byte integer.
C API: Locale ID functionality similar to C++ class Locale.
A Locale object represents a specific geographical, political, or cultural region.