]> git.saurik.com Git - apple/icu.git/blob - icuSources/common/ulocimp.h
ICU-62107.0.1.tar.gz
[apple/icu.git] / icuSources / common / ulocimp.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 **********************************************************************
5 * Copyright (C) 2004-2016, International Business Machines
6 * Corporation and others. All Rights Reserved.
7 **********************************************************************
8 */
9
10 #ifndef ULOCIMP_H
11 #define ULOCIMP_H
12
13 #include "unicode/uloc.h"
14
15 /**
16 * Create an iterator over the specified keywords list
17 * @param keywordList double-null terminated list. Will be copied.
18 * @param keywordListSize size in bytes of keywordList
19 * @param status err code
20 * @return enumeration (owned by caller) of the keyword list.
21 * @internal ICU 3.0
22 */
23 U_CAPI UEnumeration* U_EXPORT2
24 uloc_openKeywordList(const char *keywordList, int32_t keywordListSize, UErrorCode* status);
25
26 /**
27 * Look up a resource bundle table item with fallback on the table level.
28 * This is accessible so it can be called by C++ code.
29 */
30 U_CAPI const UChar * U_EXPORT2
31 uloc_getTableStringWithFallback(
32 const char *path,
33 const char *locale,
34 const char *tableKey,
35 const char *subTableKey,
36 const char *itemKey,
37 int32_t *pLength,
38 UErrorCode *pErrorCode);
39
40 /*returns TRUE if a is an ID separator FALSE otherwise*/
41 #define _isIDSeparator(a) (a == '_' || a == '-')
42
43 U_CFUNC const char*
44 uloc_getCurrentCountryID(const char* oldID);
45
46 U_CFUNC const char*
47 uloc_getCurrentLanguageID(const char* oldID);
48
49 U_CFUNC int32_t
50 ulocimp_getLanguage(const char *localeID,
51 char *language, int32_t languageCapacity,
52 const char **pEnd);
53
54 U_CFUNC int32_t
55 ulocimp_getScript(const char *localeID,
56 char *script, int32_t scriptCapacity,
57 const char **pEnd);
58
59 U_CFUNC int32_t
60 ulocimp_getCountry(const char *localeID,
61 char *country, int32_t countryCapacity,
62 const char **pEnd);
63
64 /**
65 * Get the region to use for supplemental data lookup. Uses
66 * (1) any region specified by locale tag "rg"; if none then
67 * (2) any unicode_region_tag in the locale ID; if none then
68 * (3) if inferRegion is TRUE, the region suggested by
69 * getLikelySubtags on the localeID.
70 * If no region is found, returns length 0.
71 *
72 * @param localeID
73 * The complete locale ID (with keywords) from which
74 * to get the region to use for supplemental data.
75 * @param inferRegion
76 * If TRUE, will try to infer region from localeID if
77 * no other region is found.
78 * @param region
79 * Buffer in which to put the region ID found; should
80 * have a capacity at least ULOC_COUNTRY_CAPACITY.
81 * @param regionCapacity
82 * The actual capacity of the region buffer.
83 * @param status
84 * Pointer to in/out UErrorCode value for latest status.
85 * @return
86 * The length of any region code found, or 0 if none.
87 * @internal ICU 57
88 */
89 U_CAPI int32_t U_EXPORT2
90 ulocimp_getRegionForSupplementalData(const char *localeID, UBool inferRegion,
91 char *region, int32_t regionCapacity, UErrorCode* status);
92
93 U_CAPI const char * U_EXPORT2
94 locale_getKeywordsStart(const char *localeID);
95
96
97 U_CFUNC UBool
98 ultag_isUnicodeLocaleKey(const char* s, int32_t len);
99
100 U_CFUNC UBool
101 ultag_isUnicodeLocaleType(const char* s, int32_t len);
102
103 U_CFUNC const char*
104 ulocimp_toBcpKey(const char* key);
105
106 U_CFUNC const char*
107 ulocimp_toLegacyKey(const char* key);
108
109 U_CFUNC const char*
110 ulocimp_toBcpType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType);
111
112 U_CFUNC const char*
113 ulocimp_toLegacyType(const char* key, const char* type, UBool* isKnownKey, UBool* isSpecialType);
114
115 #endif