Movatterモバイル変換


[0]ホーム

URL:


ICU 78.1  78.1
locid.h
Go to the documentation of this file.
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 *
6 * Copyright (C) 1996-2015, International Business Machines
7 * Corporation and others. All Rights Reserved.
8 *
9 ******************************************************************************
10 *
11 * File locid.h
12 *
13 * Created by: Helena Shih
14 *
15 * Modification History:
16 *
17 * Date Name Description
18 * 02/11/97 aliu Changed gLocPath to fgLocPath and added methods to
19 * get and set it.
20 * 04/02/97 aliu Made operator!= inline; fixed return value of getName().
21 * 04/15/97 aliu Cleanup for AIX/Win32.
22 * 04/24/97 aliu Numerous changes per code review.
23 * 08/18/98 stephen Added tokenizeString(),changed getDisplayName()
24 * 09/08/98 stephen Moved definition of kEmptyString for Mac Port
25 * 11/09/99 weiv Added const char * getName() const;
26 * 04/12/00 srl removing unicodestring api's and cached hash code
27 * 08/10/01 grhoten Change the static Locales to accessor functions
28 ******************************************************************************
29 */
30 
31 #ifndef LOCID_H
32 #define LOCID_H
33 
34 #include "unicode/utypes.h"
35 
36 #if U_SHOW_CPLUSPLUS_API
37 
38 #include <cstdint>
39 #include <string_view>
40 
41 #include "unicode/bytestream.h"
42 #include "unicode/localpointer.h"
43 #include "unicode/strenum.h"
44 #include "unicode/stringpiece.h"
45 #include "unicode/uobject.h"
46 #include "unicode/putil.h"
47 #include "unicode/uloc.h"
48 
54 U_NAMESPACE_BEGIN
55 
56 // Forward Declarations
57 voidU_CALLCONVlocale_available_init();
59 classStringEnumeration;
60 classUnicodeString;
61 
198 classU_COMMON_API_CLASSLocale :publicUObject {
199 public:
201 U_COMMON_APIstaticconstLocale& U_EXPORT2getRoot();
203 U_COMMON_APIstaticconstLocale& U_EXPORT2getEnglish();
205 U_COMMON_APIstaticconstLocale& U_EXPORT2getFrench();
207 U_COMMON_APIstaticconstLocale& U_EXPORT2getGerman();
209 U_COMMON_APIstaticconstLocale& U_EXPORT2getItalian();
211 U_COMMON_APIstaticconstLocale& U_EXPORT2getJapanese();
213 U_COMMON_APIstaticconstLocale& U_EXPORT2getKorean();
215 U_COMMON_APIstaticconstLocale& U_EXPORT2getChinese();
217 U_COMMON_APIstaticconstLocale& U_EXPORT2getSimplifiedChinese();
219 U_COMMON_APIstaticconstLocale& U_EXPORT2getTraditionalChinese();
220 
222 U_COMMON_APIstaticconstLocale& U_EXPORT2getFrance();
224 U_COMMON_APIstaticconstLocale& U_EXPORT2getGermany();
226 U_COMMON_APIstaticconstLocale& U_EXPORT2getItaly();
228 U_COMMON_APIstaticconstLocale& U_EXPORT2getJapan();
230 U_COMMON_APIstaticconstLocale& U_EXPORT2getKorea();
232 U_COMMON_APIstaticconstLocale& U_EXPORT2getChina();
234 U_COMMON_APIstaticconstLocale& U_EXPORT2getPRC();
236 U_COMMON_APIstaticconstLocale& U_EXPORT2getTaiwan();
238 U_COMMON_APIstaticconstLocale& U_EXPORT2getUK();
240 U_COMMON_APIstaticconstLocale& U_EXPORT2getUS();
242 U_COMMON_APIstaticconstLocale& U_EXPORT2getCanada();
244 U_COMMON_APIstaticconstLocale& U_EXPORT2getCanadaFrench();
245 
253 U_COMMON_APILocale();
254 
279 U_COMMON_APILocale(constchar* language,
280 constchar* country =nullptr,
281 constchar* variant =nullptr,
282 constchar* keywordsAndValues =nullptr);
283 
290 U_COMMON_APILocale(constLocale& other);
291 
299 U_COMMON_APILocale(Locale&& other) noexcept;
300 
305 U_COMMON_APIvirtual~Locale();
306 
314 U_COMMON_APILocale&operator=(constLocale& other);
315 
325 U_COMMON_APILocale&operator=(Locale&& other) noexcept;
326 
334 U_COMMON_APIbooloperator==(constLocale& other)const;
335 
344 U_COMMON_APIinlinebooloperator!=(constLocale& other)const;
345 
357 U_COMMON_APILocale*clone()const;
358 
359 #ifndef U_HIDE_SYSTEM_API
375 U_COMMON_APIstaticconstLocale& U_EXPORT2getDefault();
376 
389 U_COMMON_APIstaticvoid U_EXPORT2setDefault(constLocale& newLocale,UErrorCode& success);
390 #endif/* U_HIDE_SYSTEM_API */
391 
413 U_COMMON_APIstaticLocale U_EXPORT2forLanguageTag(StringPiece tag,UErrorCode& status);
414 
428 U_COMMON_APIvoidtoLanguageTag(ByteSink& sink,UErrorCode& status)const;
429 
440 template<typename StringClass>
441 inline StringClass toLanguageTag(UErrorCode& status)const;
442 
452 U_COMMON_APIstaticLocale U_EXPORT2createFromName(constchar* name);
453 
454 #ifndef U_HIDE_INTERNAL_API
456 U_COMMON_APIstaticLocale U_EXPORT2createFromName(StringPiece name);
457 #endif/* U_HIDE_INTERNAL_API */
458 
467 U_COMMON_APIstaticLocale U_EXPORT2createCanonical(constchar* name);
468 
474 U_COMMON_APIconstchar*getLanguage()const;
475 
483 U_COMMON_APIconstchar*getScript()const;
484 
490 U_COMMON_APIconstchar*getCountry()const;
491 
497 U_COMMON_APIconstchar*getVariant()const;
498 
507 U_COMMON_APIconstchar*getName()const;
508 
516 U_COMMON_APIconstchar*getBaseName()const;
517 
547 U_COMMON_APIvoidaddLikelySubtags(UErrorCode& status);
548 
578 U_COMMON_APIvoidminimizeSubtags(UErrorCode& status);
579 
586 U_COMMON_APIvoidcanonicalize(UErrorCode& status);
587 
597 U_COMMON_APIStringEnumeration*createKeywords(UErrorCode& status)const;
598 
608 U_COMMON_APIStringEnumeration*createUnicodeKeywords(UErrorCode& status)const;
609 
621 template<typename StringClass,typename OutputIterator>
622 inlinevoid getKeywords(OutputIterator iterator,UErrorCode& status)const;
623 
635 template<typename StringClass,typename OutputIterator>
636 inlinevoid getUnicodeKeywords(OutputIterator iterator,UErrorCode& status)const;
637 
654 U_COMMON_API int32_tgetKeywordValue(constchar* keywordName,
655 char* buffer,
656  int32_t bufferCapacity,
657 UErrorCode& status)const;
658 
672 U_COMMON_APIvoidgetKeywordValue(StringPiece keywordName,ByteSink& sink,UErrorCode& status)const;
673 
687 template<typename StringClass>
688 inline StringClass getKeywordValue(StringPiece keywordName,UErrorCode& status)const;
689 
703 U_COMMON_APIvoidgetUnicodeKeywordValue(StringPiece keywordName,
704 ByteSink& sink,
705 UErrorCode& status)const;
706 
720 template<typename StringClass>
721 inline StringClass getUnicodeKeywordValue(StringPiece keywordName,UErrorCode& status)const;
722 
742 U_COMMON_APIvoidsetKeywordValue(constchar* keywordName,
743 constchar* keywordValue,
744 UErrorCode& status) {
745  setKeywordValue(StringPiece{keywordName},StringPiece{keywordValue}, status);
746  }
747 
766 U_COMMON_APIvoidsetKeywordValue(StringPiece keywordName,
767 StringPiece keywordValue,
768 UErrorCode& status);
769 
788 U_COMMON_APIvoidsetUnicodeKeywordValue(StringPiece keywordName,
789 StringPiece keywordValue,
790 UErrorCode& status);
791 
798 U_COMMON_APIconstchar*getISO3Language()const;
799 
805 U_COMMON_APIconstchar*getISO3Country()const;
806 
814 U_COMMON_API uint32_tgetLCID()const;
815 
829 U_COMMON_APIUBoolisRightToLeft()const;
830 
840 U_COMMON_APIUnicodeString&getDisplayLanguage(UnicodeString& dispLang)const;
841 
855 U_COMMON_APIUnicodeString&getDisplayLanguage(constLocale& displayLocale,
856 UnicodeString& dispLang)const;
857 
867 U_COMMON_APIUnicodeString&getDisplayScript(UnicodeString& dispScript)const;
868 
883 U_COMMON_APIUnicodeString&getDisplayScript(constLocale& displayLocale,
884 UnicodeString& dispScript)const;
885 
895 U_COMMON_APIUnicodeString&getDisplayCountry(UnicodeString& dispCountry)const;
896 
911 U_COMMON_APIUnicodeString&getDisplayCountry(constLocale& displayLocale,
912 UnicodeString& dispCountry)const;
913 
921 U_COMMON_APIUnicodeString&getDisplayVariant(UnicodeString& dispVar)const;
922 
931 U_COMMON_APIUnicodeString&getDisplayVariant(constLocale& displayLocale,
932 UnicodeString& dispVar)const;
933 
945 U_COMMON_APIUnicodeString&getDisplayName(UnicodeString& name)const;
946 
959 U_COMMON_APIUnicodeString&getDisplayName(constLocale& displayLocale,UnicodeString& name)const;
960 
965 U_COMMON_API int32_thashCode()const;
966 
975 U_COMMON_APIvoidsetToBogus();
976 
982 U_COMMON_APIinlineUBool isBogus()const;
983 
992 U_COMMON_APIstaticconstLocale* U_EXPORT2getAvailableLocales(int32_t& count);
993 
1002 U_COMMON_APIstaticconstchar*const* U_EXPORT2getISOCountries();
1003 
1015 U_COMMON_APIstaticconstchar*const* U_EXPORT2getISOLanguages();
1016 
1022 U_COMMON_APIstaticUClassID U_EXPORT2getStaticClassID();
1023 
1029 U_COMMON_APIvirtualUClassIDgetDynamicClassID()const override;
1030 
1035 classU_COMMON_APIIterator/* not : public UObject because this is an interface/mixin class */ {
1036 public:
1038 virtual~Iterator();
1039 
1044 virtualUBoolhasNext()const = 0;
1045 
1050 virtualconstLocale &next() = 0;
1051  };
1052 
1057 template<typename Iter>
1058 classRangeIterator :publicIterator,publicUMemory {
1059 public:
1069 RangeIterator(Iter begin, Iter end) : it_(begin), end_(end) {}
1070 
1075 UBoolhasNext() const override{return it_ != end_; }
1076 
1081 constLocale &next() override{return *it_++; }
1082 
1083 private:
1084  Iter it_;
1085 const Iter end_;
1086  };
1087 
1093 template<typename Iter,typename Conv>
1094 classConvertingIterator :publicIterator,publicUMemory {
1095 public:
1106 ConvertingIterator(Iter begin, Iter end, Conv converter) :
1107  it_(begin), end_(end), converter_(converter) {}
1108 
1113 UBoolhasNext() const override{return it_ != end_; }
1114 
1119 constLocale &next() override{return converter_(*it_++); }
1120 
1121 private:
1122  Iter it_;
1123 const Iter end_;
1124  Conv converter_;
1125  };
1126 
1127 protected:/* only protected for testing purposes. DO NOT USE. */
1128 #ifndef U_HIDE_INTERNAL_API
1133 U_COMMON_APIvoidsetFromPOSIXID(constchar* posixID);
1142 U_COMMON_APIvoidminimizeSubtags(bool favorScript,UErrorCode& status);
1143 #endif/* U_HIDE_INTERNAL_API */
1144 
1145 private:
1153 Locale& init(constchar* localeID,UBool canonicalize);
1154 Locale& init(StringPiece localeID,UBool canonicalize);
1155 
1156 /*
1157  * Internal constructor to allow construction of a locale object with
1158  * NO side effects. (Default constructor tries to get
1159  * the default locale.)
1160  */
1161 enum ELocaleType : uint8_t {
1162  eBOGUS,
1163  eNEST,
1164  eHEAP,
1165  };
1166 Locale(ELocaleType);
1167 
1171 staticLocale* getLocaleCache();
1172 
1173 unionPayload;
1174 structNest;
1175 structHeap;
1176 
1180 structNest {
1181 static constexprsize_t SIZE = 32;
1182 
1183  ELocaleType type = eNEST;
1184 char language[4];
1185 char script[5];
1186 char region[4];
1187  uint8_t variantBegin;
1188 char baseName[SIZE -
1189 sizeof type -
1190 sizeof language -
1191 sizeof script -
1192 sizeof region -
1193 sizeof variantBegin];
1194 
1195 constchar* getLanguage() const{return language; }
1196 constchar* getScript() const{return script; }
1197 constchar* getRegion() const{return region; }
1198 constchar* getVariant() const{return variantBegin == 0 ?"" : getBaseName() + variantBegin; }
1199 constchar* getBaseName() const{return baseName; }
1200 
1201 // Doesn't inherit from UMemory, shouldn't be heap allocated.
1202 staticvoid* U_EXPORT2operatornew(size_t) noexcept =delete;
1203 staticvoid* U_EXPORT2operatornew[](size_t) noexcept =delete;
1204 
1205  Nest() : language{'\0'}, script{'\0'}, region{'\0'}, variantBegin{0}, baseName{'\0'} {}
1206 
1207 void init(std::string_view language,
1208  std::string_view script,
1209  std::string_view region,
1210  uint8_t variantBegin);
1211 
1212 staticbool fits(int32_t length,
1213  std::string_view language,
1214  std::string_view script,
1215  std::string_view region) {
1216 return length < static_cast<int32_t>(sizeof Nest::baseName) &&
1217  language.size() <sizeof Nest::language &&
1218  script.size() <sizeof Nest::script &&
1219  region.size() <sizeof Nest::region;
1220  }
1221 
1222 private:
1223 friendunionPayload;
1224  Nest(Heap&& heap, uint8_t variantBegin);
1225  };
1226  static_assert(sizeof(Nest) == Nest::SIZE);
1227 
1231 structHeap {
1232 structAlloc;
1233 
1234  ELocaleType type;
1235 char language[ULOC_LANG_CAPACITY];
1236 char script[ULOC_SCRIPT_CAPACITY];
1237 char region[ULOC_COUNTRY_CAPACITY];
1238  Alloc* ptr;
1239 
1240 constchar* getLanguage() const{return language; }
1241 constchar* getScript() const{return script; }
1242 constchar* getRegion() const{return region; }
1243 constchar* getVariant()const;
1244 constchar* getFullName()const;
1245 constchar* getBaseName()const;
1246 
1247 // Doesn't inherit from UMemory, shouldn't be heap allocated.
1248 staticvoid* U_EXPORT2operatornew(size_t) noexcept =delete;
1249 staticvoid* U_EXPORT2operatornew[](size_t) noexcept =delete;
1250 
1251  Heap(std::string_view language,
1252  std::string_view script,
1253  std::string_view region,
1254  int32_t variantBegin);
1255  ~Heap();
1256 
1257  Heap& operator=(const Heap& other);
1258  Heap& operator=(Heap&& other) noexcept;
1259  };
1260  static_assert(sizeof(Heap) <=sizeof(Nest));
1261 
1266 unionPayload {
1267 private:
1268  Nest nest;
1269  Heap heap;
1270  ELocaleType type;
1271 
1272 void copy(const Payload& other);
1273 void move(Payload&& other) noexcept;
1274 
1275 public:
1276 // Doesn't inherit from UMemory, shouldn't be heap allocated.
1277 staticvoid* U_EXPORT2operatornew(size_t) noexcept =delete;
1278 staticvoid* U_EXPORT2operatornew[](size_t) noexcept =delete;
1279 
1280  Payload() : type{eBOGUS} {}
1281  ~Payload();
1282 
1283  Payload(const Payload& other);
1284  Payload(Payload&& other) noexcept;
1285 
1286  Payload& operator=(const Payload& other);
1287  Payload& operator=(Payload&& other) noexcept;
1288 
1289 void setToBogus();
1290 bool isBogus() const{return type == eBOGUS; }
1291 
1292 template <typename T,typename... Args> T& emplace(Args&&... args);
1293 
1294 template <typename T> T* get();
1295 
1296 template <typename BogusFn,typename NestFn,typename HeapFn,typename... Args>
1297 auto visit(BogusFn bogusFn, NestFn nestFn, HeapFn heapFn, Args... args)const;
1298  } payload;
1299 
1308 template <constchar* (Nest::*const NEST)() const,
1309  constchar* (Heap::*const HEAP)() const>
1310  constchar* getField() const;
1311 
1312  static const Locale &getLocale(int locid);
1313 
1317  friendLocale *locale_set_default_internal(constchar *,UErrorCode& status);
1318 
1321  friendvoidU_CALLCONVlocale_available_init();
1322 };
1323 
1324 U_COMMON_API inlinebool
1325 Locale::operator!=(constLocale& other) const
1326 {
1327 return !operator==(other);
1328 }
1329 
1330 template<typename StringClass>inline StringClass
1331 Locale::toLanguageTag(UErrorCode& status) const
1332 {
1333 if (U_FAILURE(status)) {return {}; }
1334  StringClass result;
1335 StringByteSink<StringClass> sink(&result);
1336  toLanguageTag(sink, status);
1337 return result;
1338 }
1339 
1340 template<typename StringClass,typename OutputIterator>inlinevoid
1341 Locale::getKeywords(OutputIterator iterator,UErrorCode& status) const
1342 {
1343 if (U_FAILURE(status)) {return; }
1344 LocalPointer<StringEnumeration> keys(createKeywords(status));
1345 if (U_FAILURE(status) || keys.isNull()) {
1346 return;
1347  }
1348 for (;;) {
1349  int32_t resultLength;
1350 constchar* buffer = keys->next(&resultLength, status);
1351 if (U_FAILURE(status) || buffer ==nullptr) {
1352 return;
1353  }
1354  *iterator++ = StringClass(buffer, resultLength);
1355  }
1356 }
1357 
1358 template<typename StringClass,typename OutputIterator>inlinevoid
1359 Locale::getUnicodeKeywords(OutputIterator iterator,UErrorCode& status) const
1360 {
1361 if (U_FAILURE(status)) {return; }
1362 LocalPointer<StringEnumeration> keys(createUnicodeKeywords(status));
1363 if (U_FAILURE(status) || keys.isNull()) {
1364 return;
1365  }
1366 for (;;) {
1367  int32_t resultLength;
1368 constchar* buffer = keys->next(&resultLength, status);
1369 if (U_FAILURE(status) || buffer ==nullptr) {
1370 return;
1371  }
1372  *iterator++ = StringClass(buffer, resultLength);
1373  }
1374 }
1375 
1376 template<typename StringClass>inline StringClass
1377 Locale::getKeywordValue(StringPiece keywordName,UErrorCode& status) const
1378 {
1379 if (U_FAILURE(status)) {return {}; }
1380  StringClass result;
1381 StringByteSink<StringClass> sink(&result);
1382  getKeywordValue(keywordName, sink, status);
1383 return result;
1384 }
1385 
1386 template<typename StringClass>inline StringClass
1387 Locale::getUnicodeKeywordValue(StringPiece keywordName,UErrorCode& status) const
1388 {
1389 if (U_FAILURE(status)) {return {}; }
1390  StringClass result;
1391 StringByteSink<StringClass> sink(&result);
1392  getUnicodeKeywordValue(keywordName, sink, status);
1393 return result;
1394 }
1395 
1396 U_COMMON_APIinlineUBool
1397 Locale::isBogus() const{
1398 return payload.isBogus();
1399 }
1400 
1401 U_NAMESPACE_END
1402 
1403 #endif/* U_SHOW_CPLUSPLUS_API */
1404 
1405 #endif
bytestream.h
C++ API: Interface for writing bytes, and implementation classes.
icu::ByteSink
A ByteSink can be filled with bytes.
Definition:bytestream.h:55
icu::LocalPointerBase::isNull
UBool isNull() const
nullptr check.
Definition:localpointer.h:92
icu::LocalPointer
"Smart pointer" class, deletes objects via the standard C++ delete operator.
Definition:localpointer.h:189
icu::Locale::ConvertingIterator
A generic Locale iterator implementation over Locale input iterators.
Definition:locid.h:1094
icu::Locale::ConvertingIterator::hasNext
UBool hasNext() const override
Definition:locid.h:1113
icu::Locale::ConvertingIterator::ConvertingIterator
ConvertingIterator(Iter begin, Iter end, Conv converter)
Constructs an iterator from a begin/end range.
Definition:locid.h:1106
icu::Locale::ConvertingIterator::next
const Locale & next() override
Definition:locid.h:1119
icu::Locale::Iterator
A Locale iterator interface similar to a Java Iterator<Locale>.
Definition:locid.h:1035
icu::Locale::Iterator::hasNext
virtual UBool hasNext() const =0
icu::Locale::Iterator::~Iterator
virtual ~Iterator()
icu::Locale::Iterator::next
virtual const Locale & next()=0
icu::Locale::RangeIterator
A generic Locale iterator implementation over Locale input iterators.
Definition:locid.h:1058
icu::Locale::RangeIterator::RangeIterator
RangeIterator(Iter begin, Iter end)
Constructs an iterator from a begin/end range.
Definition:locid.h:1069
icu::Locale::RangeIterator::hasNext
UBool hasNext() const override
Definition:locid.h:1075
icu::Locale::RangeIterator::next
const Locale & next() override
Definition:locid.h:1081
icu::Locale
A Locale object represents a specific geographical, political, or cultural region.
Definition:locid.h:198
icu::Locale::getJapan
static U_COMMON_API const Locale & getJapan()
Useful constant for this country/region.
icu::Locale::getLanguage
U_COMMON_API const char * getLanguage() const
Returns the locale's ISO-639 language code.
icu::Locale::forLanguageTag
static U_COMMON_API Locale forLanguageTag(StringPiece tag, UErrorCode &status)
Returns a Locale for the specified BCP47 language tag string.
icu::Locale::isBogus
U_COMMON_API UBool isBogus() const
Gets the bogus state.
Definition:locid.h:1397
icu::Locale::getUS
static U_COMMON_API const Locale & getUS()
Useful constant for this country/region.
icu::Locale::getKeywordValue
U_COMMON_API int32_t getKeywordValue(const char *keywordName, char *buffer, int32_t bufferCapacity, UErrorCode &status) const
Gets the value for a keyword.
icu::Locale::getUnicodeKeywordValue
U_COMMON_API void getUnicodeKeywordValue(StringPiece keywordName, ByteSink &sink, UErrorCode &status) const
Gets the Unicode value for a Unicode keyword.
icu::Locale::getDisplayName
U_COMMON_API UnicodeString & getDisplayName(UnicodeString &name) const
Fills in "name" with the name of this locale in a format suitable for user display in the default loc...
icu::Locale::minimizeSubtags
U_COMMON_API void minimizeSubtags(bool favorScript, UErrorCode &status)
Minimize the subtags for this Locale, per the algorithm described.
icu::Locale::clone
U_COMMON_API Locale * clone() const
Clone this object.
icu::Locale::getCanadaFrench
static U_COMMON_API const Locale & getCanadaFrench()
Useful constant for this country/region.
icu::Locale::createFromName
static U_COMMON_API Locale createFromName(StringPiece name)
icu::Locale::toLanguageTag
U_COMMON_API void toLanguageTag(ByteSink &sink, UErrorCode &status) const
Returns a well-formed language tag for this Locale.
icu::Locale::getISOCountries
static U_COMMON_API const char *const * getISOCountries()
Gets a list of all available 2-letter country codes defined in ISO 3166.
icu::Locale::getJapanese
static U_COMMON_API const Locale & getJapanese()
Useful constant for this language.
icu::Locale::getItalian
static U_COMMON_API const Locale & getItalian()
Useful constant for this language.
icu::Locale::getDisplayVariant
U_COMMON_API UnicodeString & getDisplayVariant(UnicodeString &dispVar) const
Fills in "dispVar" with the name of this locale's variant code in a format suitable for user display ...
icu::Locale::createUnicodeKeywords
U_COMMON_API StringEnumeration * createUnicodeKeywords(UErrorCode &status) const
Gets the list of Unicode keywords for the specified locale.
icu::Locale::getItaly
static U_COMMON_API const Locale & getItaly()
Useful constant for this country/region.
icu::Locale::getPRC
static U_COMMON_API const Locale & getPRC()
Useful constant for this country/region.
icu::Locale::getISO3Language
U_COMMON_API const char * getISO3Language() const
returns the locale's three-letter language code, as specified in ISO draft standard ISO-639-2.
icu::Locale::getISOLanguages
static U_COMMON_API const char *const * getISOLanguages()
Returns a list of all unique language codes defined in ISO 639.
icu::Locale::createCanonical
static U_COMMON_API Locale createCanonical(const char *name)
Creates a locale from the given string after canonicalizing the string according to CLDR by calling u...
icu::Locale::getChinese
static U_COMMON_API const Locale & getChinese()
Useful constant for this language.
icu::Locale::hashCode
U_COMMON_API int32_t hashCode() const
Generates a hash code for the locale.
icu::Locale::Locale
U_COMMON_API Locale(const char *language, const char *country=nullptr, const char *variant=nullptr, const char *keywordsAndValues=nullptr)
Construct a locale from language, country, variant.
icu::Locale::minimizeSubtags
U_COMMON_API void minimizeSubtags(UErrorCode &status)
Minimize the subtags for this Locale, per the algorithm described in the following CLDR technical rep...
icu::Locale::getFrance
static U_COMMON_API const Locale & getFrance()
Useful constant for this country/region.
icu::Locale::getGerman
static U_COMMON_API const Locale & getGerman()
Useful constant for this language.
icu::Locale::getAvailableLocales
static U_COMMON_API const Locale * getAvailableLocales(int32_t &count)
Returns a list of all installed locales.
icu::Locale::Locale
U_COMMON_API Locale()
Construct a default locale object, a Locale for the default locale ID.
icu::Locale::getStaticClassID
static U_COMMON_API UClassID getStaticClassID()
ICU "poor man's RTTI", returns a UClassID for this class.
icu::Locale::getDisplayCountry
U_COMMON_API UnicodeString & getDisplayCountry(const Locale &displayLocale, UnicodeString &dispCountry) const
Fills in "dispCountry" with the name of this locale's country in a format suitable for user display i...
icu::Locale::getISO3Country
U_COMMON_API const char * getISO3Country() const
Fills in "name" with the locale's three-letter ISO-3166 country code.
icu::Locale::getDisplayScript
U_COMMON_API UnicodeString & getDisplayScript(UnicodeString &dispScript) const
Fills in "dispScript" with the name of this locale's script in a format suitable for user display in ...
icu::Locale::getFrench
static U_COMMON_API const Locale & getFrench()
Useful constant for this language.
icu::Locale::getDisplayLanguage
U_COMMON_API UnicodeString & getDisplayLanguage(UnicodeString &dispLang) const
Fills in "dispLang" with the name of this locale's language in a format suitable for user display in ...
icu::Locale::setFromPOSIXID
U_COMMON_API void setFromPOSIXID(const char *posixID)
Set this from a single POSIX style locale string.
icu::Locale::getKeywordValue
U_COMMON_API void getKeywordValue(StringPiece keywordName, ByteSink &sink, UErrorCode &status) const
Gets the value for a keyword.
icu::Locale::operator==
U_COMMON_API bool operator==(const Locale &other) const
Checks if two locale keys are the same.
icu::Locale::getName
U_COMMON_API const char * getName() const
Returns the programmatic name of the entire locale, with the language, country and variant separated ...
icu::Locale::getUnicodeKeywords
void getUnicodeKeywords(OutputIterator iterator, UErrorCode &status) const
Gets the set of Unicode keywords for this Locale.
Definition:locid.h:1359
icu::Locale::operator=
U_COMMON_API Locale & operator=(const Locale &other)
Replaces the entire contents of *this with the specified value.
icu::Locale::getEnglish
static U_COMMON_API const Locale & getEnglish()
Useful constant for this language.
icu::Locale::getRoot
static U_COMMON_API const Locale & getRoot()
Useful constant for the Root locale.
icu::Locale::getUK
static U_COMMON_API const Locale & getUK()
Useful constant for this country/region.
icu::Locale::getLCID
U_COMMON_API uint32_t getLCID() const
Returns the Windows LCID value corresponding to this locale.
icu::Locale::createKeywords
U_COMMON_API StringEnumeration * createKeywords(UErrorCode &status) const
Gets the list of keywords for the specified locale.
icu::Locale::getDisplayScript
U_COMMON_API UnicodeString & getDisplayScript(const Locale &displayLocale, UnicodeString &dispScript) const
Fills in "dispScript" with the name of this locale's country in a format suitable for user display in...
icu::Locale::Locale
U_COMMON_API Locale(Locale &&other) noexcept
Move constructor; might leave source in bogus state.
icu::Locale::getCanada
static U_COMMON_API const Locale & getCanada()
Useful constant for this country/region.
icu::Locale::getDisplayCountry
U_COMMON_API UnicodeString & getDisplayCountry(UnicodeString &dispCountry) const
Fills in "dispCountry" with the name of this locale's country in a format suitable for user display i...
icu::Locale::getGermany
static U_COMMON_API const Locale & getGermany()
Useful constant for this country/region.
icu::Locale::getDisplayVariant
U_COMMON_API UnicodeString & getDisplayVariant(const Locale &displayLocale, UnicodeString &dispVar) const
Fills in "dispVar" with the name of this locale's variant code in a format suitable for user display ...
icu::Locale::setKeywordValue
U_COMMON_API void setKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode &status)
Sets or removes the value for a keyword.
icu::Locale::getDefault
static U_COMMON_API const Locale & getDefault()
Common methods of getting the current default Locale.
icu::Locale::getDisplayLanguage
U_COMMON_API UnicodeString & getDisplayLanguage(const Locale &displayLocale, UnicodeString &dispLang) const
Fills in "dispLang" with the name of this locale's language in a format suitable for user display in ...
icu::Locale::getTraditionalChinese
static U_COMMON_API const Locale & getTraditionalChinese()
Useful constant for this language.
icu::Locale::getBaseName
U_COMMON_API const char * getBaseName() const
Returns the programmatic name of the entire locale as getName() would return, but without keywords.
icu::Locale::operator=
U_COMMON_API Locale & operator=(Locale &&other) noexcept
Move assignment operator; might leave source in bogus state.
icu::Locale::canonicalize
U_COMMON_API void canonicalize(UErrorCode &status)
Canonicalize the locale ID of this object according to CLDR.
icu::Locale::getKeywords
void getKeywords(OutputIterator iterator, UErrorCode &status) const
Gets the set of keywords for this Locale.
Definition:locid.h:1341
icu::Locale::setToBogus
U_COMMON_API void setToBogus()
Sets the locale to bogus A bogus locale represents a non-existing locale associated with services tha...
icu::Locale::getChina
static U_COMMON_API const Locale & getChina()
Useful constant for this country/region.
icu::Locale::getSimplifiedChinese
static U_COMMON_API const Locale & getSimplifiedChinese()
Useful constant for this language.
icu::Locale::Locale
U_COMMON_API Locale(const Locale &other)
Initializes a Locale object from another Locale object.
icu::Locale::setDefault
static U_COMMON_API void setDefault(const Locale &newLocale, UErrorCode &success)
Sets the default.
icu::Locale::getKorea
static U_COMMON_API const Locale & getKorea()
Useful constant for this country/region.
icu::Locale::getTaiwan
static U_COMMON_API const Locale & getTaiwan()
Useful constant for this country/region.
icu::Locale::isRightToLeft
U_COMMON_API UBool isRightToLeft() const
Returns whether this locale's script is written right-to-left.
icu::Locale::getDynamicClassID
virtual U_COMMON_API UClassID getDynamicClassID() const override
ICU "poor man's RTTI", returns a UClassID for the actual class.
icu::Locale::addLikelySubtags
U_COMMON_API void addLikelySubtags(UErrorCode &status)
Add the likely subtags for this Locale, per the algorithm described in the following CLDR technical r...
icu::Locale::setKeywordValue
U_COMMON_API void setKeywordValue(const char *keywordName, const char *keywordValue, UErrorCode &status)
Sets or removes the value for a keyword.
Definition:locid.h:742
icu::Locale::getDisplayName
U_COMMON_API UnicodeString & getDisplayName(const Locale &displayLocale, UnicodeString &name) const
Fills in "name" with the name of this locale in a format suitable for user display in the locale spec...
icu::Locale::~Locale
virtual U_COMMON_API ~Locale()
Destructor.
icu::Locale::setUnicodeKeywordValue
U_COMMON_API void setUnicodeKeywordValue(StringPiece keywordName, StringPiece keywordValue, UErrorCode &status)
Sets or removes the Unicode value for a Unicode keyword.
icu::Locale::getCountry
U_COMMON_API const char * getCountry() const
Returns the locale's ISO-3166 country code.
icu::Locale::getScript
U_COMMON_API const char * getScript() const
Returns the locale's ISO-15924 abbreviation script code.
icu::Locale::createFromName
static U_COMMON_API Locale createFromName(const char *name)
Creates a locale which has had minimal canonicalization as per uloc_getName().
icu::Locale::getVariant
U_COMMON_API const char * getVariant() const
Returns the locale's variant code.
icu::Locale::getKorean
static U_COMMON_API const Locale & getKorean()
Useful constant for this language.
icu::StringByteSink
Implementation of ByteSink that writes to a "string".
Definition:bytestream.h:291
icu::StringEnumeration
Base class for 'pure' C++ implementations of uenum api.
Definition:strenum.h:61
icu::StringPiece
A string-like object that points to a sized piece of memory.
Definition:stringpiece.h:61
icu::UMemory
UMemory is the common ICU base class.
Definition:uobject.h:115
icu::UObject
UObject is the common ICU "boilerplate" class.
Definition:uobject.h:222
icu::UnicodeString
UnicodeString is a string class that stores Unicode characters directly and provides similar function...
Definition:unistr.h:303
localpointer.h
C++ API: "Smart pointers" for use with and in ICU4C C++ code.
icu::operator==
U_COMMON_API UBool operator==(const StringPiece &x, const StringPiece &y)
Global operator == for StringPiece.
icu::locale_available_init
void locale_available_init()
icu::operator!=
bool operator!=(const StringPiece &x, const StringPiece &y)
Global operator != for StringPiece.
Definition:stringpiece.h:346
U_CALLCONV
#define U_CALLCONV
Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary in callback function typedefs to ma...
Definition:platform.h:837
putil.h
C API: Platform Utilities.
strenum.h
C++ API: String Enumeration.
stringpiece.h
C++ API: StringPiece: Read-only byte string wrapper class.
uloc.h
C API: Locale ID functionality similar to C++ class Locale.
ULOC_SCRIPT_CAPACITY
#define ULOC_SCRIPT_CAPACITY
Useful constant for the maximum size of the script part of a locale ID (including the terminating NUL...
Definition:uloc.h:271
ULOC_COUNTRY_CAPACITY
#define ULOC_COUNTRY_CAPACITY
Useful constant for the maximum size of the country part of a locale ID (including the terminating NU...
Definition:uloc.h:258
ULOC_LANG_CAPACITY
#define ULOC_LANG_CAPACITY
Useful constant for the maximum size of the language part of a locale ID.
Definition:uloc.h:251
UBool
int8_t UBool
The ICU boolean type, a signed-byte integer.
Definition:umachine.h:269
uobject.h
C++ API: Common ICU base class UObject.
UClassID
void * UClassID
UClassID is used to identify classes without using the compiler's RTTI.
Definition:uobject.h:96
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
UErrorCode
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
Definition:utypes.h:509
U_FAILURE
#define U_FAILURE(x)
Does the error code indicate a failure?
Definition:utypes.h:827
U_COMMON_API
#define U_COMMON_API
Set to export library symbols from inside the common library, and to import them from outside.
Definition:utypes.h:315
U_COMMON_API_CLASS
#define U_COMMON_API_CLASS
Set to export library symbols from inside the common library, and to import them from outside,...
Definition:utypes.h:456

Generated by doxygen 1.9.1
[8]ページ先頭

©2009-2025 Movatter.jp