]>
Commit | Line | Data |
---|---|---|
bd5b749c | 1 | /* |
d8b101a4 | 2 | * Copyright (c) 2014 Apple Inc. All rights reserved. |
bd5b749c A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
d7384798 | 5 | * |
bd5b749c A |
6 | * This file contains Original Code and/or Modifications of Original Code |
7 | * as defined in and that are subject to the Apple Public Source License | |
8 | * Version 2.0 (the 'License'). You may not use this file except in | |
9 | * compliance with the License. Please obtain a copy of the License at | |
10 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
11 | * file. | |
d7384798 | 12 | * |
bd5b749c A |
13 | * The Original Code and all software distributed under the License are |
14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
18 | * Please see the License for the specific language governing rights and | |
19 | * limitations under the License. | |
d7384798 | 20 | * |
bd5b749c A |
21 | * @APPLE_LICENSE_HEADER_END@ |
22 | */ | |
f64f9b69 | 23 | |
bd5b749c | 24 | /* CFLocale.h |
d7384798 | 25 | Copyright (c) 2002-2014, Apple Inc. All rights reserved. |
bd5b749c A |
26 | */ |
27 | ||
28 | #if !defined(__COREFOUNDATION_CFLOCALE__) | |
29 | #define __COREFOUNDATION_CFLOCALE__ 1 | |
30 | ||
31 | #include <CoreFoundation/CFBase.h> | |
32 | #include <CoreFoundation/CFArray.h> | |
33 | #include <CoreFoundation/CFDictionary.h> | |
34 | ||
856091c5 | 35 | CF_IMPLICIT_BRIDGING_ENABLED |
bd5b749c A |
36 | CF_EXTERN_C_BEGIN |
37 | ||
d7384798 | 38 | typedef const struct CF_BRIDGED_TYPE(NSLocale) __CFLocale *CFLocaleRef; |
bd5b749c A |
39 | |
40 | CF_EXPORT | |
8ca704e1 | 41 | CFTypeID CFLocaleGetTypeID(void); |
bd5b749c A |
42 | |
43 | CF_EXPORT | |
8ca704e1 | 44 | CFLocaleRef CFLocaleGetSystem(void); |
bd5b749c A |
45 | // Returns the "root", canonical locale. Contains fixed "backstop" settings. |
46 | ||
47 | CF_EXPORT | |
8ca704e1 | 48 | CFLocaleRef CFLocaleCopyCurrent(void); |
bd5b749c A |
49 | // Returns the logical "user" locale for the current user. |
50 | // [This is Copy in the sense that you get a retain you have to release, | |
51 | // but we may return the same cached object over and over.] Settings | |
52 | // you get from this locale do not change under you as CFPreferences | |
53 | // are changed (for safety and correctness). Generally you would not | |
54 | // grab this and hold onto it forever, but use it to do the operations | |
55 | // you need to do at the moment, then throw it away. (The non-changing | |
56 | // ensures that all the results of your operations are consistent.) | |
57 | ||
58 | CF_EXPORT | |
8ca704e1 | 59 | CFArrayRef CFLocaleCopyAvailableLocaleIdentifiers(void); |
bd5b749c A |
60 | // Returns an array of CFStrings that represents all locales for |
61 | // which locale data is available. | |
62 | ||
63 | CF_EXPORT | |
8ca704e1 | 64 | CFArrayRef CFLocaleCopyISOLanguageCodes(void); |
bd5b749c A |
65 | // Returns an array of CFStrings that represents all known legal ISO |
66 | // language codes. Note: many of these will not have any supporting | |
67 | // locale data in Mac OS X. | |
68 | ||
69 | CF_EXPORT | |
8ca704e1 | 70 | CFArrayRef CFLocaleCopyISOCountryCodes(void); |
bd5b749c A |
71 | // Returns an array of CFStrings that represents all known legal ISO |
72 | // country codes. Note: many of these will not have any supporting | |
73 | // locale data in Mac OS X. | |
74 | ||
75 | CF_EXPORT | |
8ca704e1 | 76 | CFArrayRef CFLocaleCopyISOCurrencyCodes(void); |
bd5b749c A |
77 | // Returns an array of CFStrings that represents all known legal ISO |
78 | // currency codes. Note: some of these currencies may be obsolete, or | |
79 | // represent other financial instruments. | |
80 | ||
81 | CF_EXPORT | |
8ca704e1 | 82 | CFArrayRef CFLocaleCopyCommonISOCurrencyCodes(void) CF_AVAILABLE(10_5, 2_0); |
bd5b749c A |
83 | // Returns an array of CFStrings that represents ISO currency codes for |
84 | // currencies in common use. | |
85 | ||
86 | CF_EXPORT | |
8ca704e1 | 87 | CFArrayRef CFLocaleCopyPreferredLanguages(void) CF_AVAILABLE(10_5, 2_0); |
bd5b749c A |
88 | // Returns the array of canonicalized CFString locale IDs that the user prefers. |
89 | ||
90 | CF_EXPORT | |
8ca704e1 | 91 | CFStringRef CFLocaleCreateCanonicalLanguageIdentifierFromString(CFAllocatorRef allocator, CFStringRef localeIdentifier); |
bd5b749c A |
92 | // Map an arbitrary language identification string (something close at |
93 | // least) to a canonical language identifier. | |
94 | ||
95 | CF_EXPORT | |
8ca704e1 | 96 | CFStringRef CFLocaleCreateCanonicalLocaleIdentifierFromString(CFAllocatorRef allocator, CFStringRef localeIdentifier); |
bd5b749c A |
97 | // Map an arbitrary locale identification string (something close at |
98 | // least) to the canonical identifier. | |
99 | ||
100 | CF_EXPORT | |
8ca704e1 | 101 | CFStringRef CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(CFAllocatorRef allocator, LangCode lcode, RegionCode rcode); |
bd5b749c A |
102 | // Map a Mac OS LangCode and RegionCode to the canonical locale identifier. |
103 | ||
cf7d2af9 | 104 | CF_EXPORT |
8ca704e1 | 105 | CFStringRef CFLocaleCreateLocaleIdentifierFromWindowsLocaleCode(CFAllocatorRef allocator, uint32_t lcid) CF_AVAILABLE(10_6, 4_0); |
cf7d2af9 A |
106 | // Map a Windows LCID to the canonical locale identifier. |
107 | ||
108 | CF_EXPORT | |
8ca704e1 | 109 | uint32_t CFLocaleGetWindowsLocaleCodeFromLocaleIdentifier(CFStringRef localeIdentifier) CF_AVAILABLE(10_6, 4_0); |
cf7d2af9 A |
110 | // Map a locale identifier to a Windows LCID. |
111 | ||
856091c5 | 112 | typedef CF_ENUM(CFIndex, CFLocaleLanguageDirection) { |
cf7d2af9 A |
113 | kCFLocaleLanguageDirectionUnknown = 0, |
114 | kCFLocaleLanguageDirectionLeftToRight = 1, | |
115 | kCFLocaleLanguageDirectionRightToLeft = 2, | |
116 | kCFLocaleLanguageDirectionTopToBottom = 3, | |
117 | kCFLocaleLanguageDirectionBottomToTop = 4 | |
118 | }; | |
cf7d2af9 A |
119 | |
120 | CF_EXPORT | |
8ca704e1 | 121 | CFLocaleLanguageDirection CFLocaleGetLanguageCharacterDirection(CFStringRef isoLangCode) CF_AVAILABLE(10_6, 4_0); |
cf7d2af9 A |
122 | |
123 | CF_EXPORT | |
8ca704e1 | 124 | CFLocaleLanguageDirection CFLocaleGetLanguageLineDirection(CFStringRef isoLangCode) CF_AVAILABLE(10_6, 4_0); |
cf7d2af9 | 125 | |
bd5b749c | 126 | CF_EXPORT |
8ca704e1 | 127 | CFDictionaryRef CFLocaleCreateComponentsFromLocaleIdentifier(CFAllocatorRef allocator, CFStringRef localeID); |
bd5b749c A |
128 | // Parses a locale ID consisting of language, script, country, variant, |
129 | // and keyword/value pairs into a dictionary. The keys are the constant | |
130 | // CFStrings corresponding to the locale ID components, and the values | |
131 | // will correspond to constants where available. | |
132 | // Example: "en_US@calendar=japanese" yields a dictionary with three | |
133 | // entries: kCFLocaleLanguageCode=en, kCFLocaleCountryCode=US, and | |
134 | // kCFLocaleCalendarIdentifier=kCFJapaneseCalendar. | |
135 | ||
136 | CF_EXPORT | |
8ca704e1 | 137 | CFStringRef CFLocaleCreateLocaleIdentifierFromComponents(CFAllocatorRef allocator, CFDictionaryRef dictionary); |
bd5b749c A |
138 | // Reverses the actions of CFLocaleCreateDictionaryFromLocaleIdentifier, |
139 | // creating a single string from the data in the dictionary. The | |
140 | // dictionary {kCFLocaleLanguageCode=en, kCFLocaleCountryCode=US, | |
141 | // kCFLocaleCalendarIdentifier=kCFJapaneseCalendar} becomes | |
142 | // "en_US@calendar=japanese". | |
143 | ||
144 | CF_EXPORT | |
8ca704e1 | 145 | CFLocaleRef CFLocaleCreate(CFAllocatorRef allocator, CFStringRef localeIdentifier); |
bd5b749c A |
146 | // Returns a CFLocaleRef for the locale named by the "arbitrary" locale identifier. |
147 | ||
148 | CF_EXPORT | |
8ca704e1 | 149 | CFLocaleRef CFLocaleCreateCopy(CFAllocatorRef allocator, CFLocaleRef locale); |
bd5b749c A |
150 | // Having gotten a CFLocale from somebody, code should make a copy |
151 | // if it is going to use it for several operations | |
152 | // or hold onto it. In the future, there may be mutable locales. | |
153 | ||
154 | CF_EXPORT | |
8ca704e1 | 155 | CFStringRef CFLocaleGetIdentifier(CFLocaleRef locale); |
bd5b749c A |
156 | // Returns the locale's identifier. This may not be the same string |
157 | // that the locale was created with (CFLocale may canonicalize it). | |
158 | ||
159 | CF_EXPORT | |
8ca704e1 | 160 | CFTypeRef CFLocaleGetValue(CFLocaleRef locale, CFStringRef key); |
bd5b749c A |
161 | // Returns the value for the given key. This is how settings and state |
162 | // are accessed via a CFLocale. Values might be of any CF type. | |
163 | ||
164 | CF_EXPORT | |
8ca704e1 | 165 | CFStringRef CFLocaleCopyDisplayNameForPropertyValue(CFLocaleRef displayLocale, CFStringRef key, CFStringRef value); |
bd5b749c A |
166 | // Returns the display name for the given value. The key tells what |
167 | // the value is, and is one of the usual locale property keys, though | |
168 | // not all locale property keys have values with display name values. | |
169 | ||
170 | ||
8ca704e1 | 171 | CF_EXPORT const CFStringRef kCFLocaleCurrentLocaleDidChangeNotification CF_AVAILABLE(10_5, 2_0); |
bd5b749c A |
172 | |
173 | ||
174 | // Locale Keys | |
8ca704e1 A |
175 | CF_EXPORT const CFStringRef kCFLocaleIdentifier; |
176 | CF_EXPORT const CFStringRef kCFLocaleLanguageCode; | |
177 | CF_EXPORT const CFStringRef kCFLocaleCountryCode; | |
178 | CF_EXPORT const CFStringRef kCFLocaleScriptCode; | |
179 | CF_EXPORT const CFStringRef kCFLocaleVariantCode; | |
180 | ||
181 | CF_EXPORT const CFStringRef kCFLocaleExemplarCharacterSet; | |
182 | CF_EXPORT const CFStringRef kCFLocaleCalendarIdentifier; | |
183 | CF_EXPORT const CFStringRef kCFLocaleCalendar; | |
184 | CF_EXPORT const CFStringRef kCFLocaleCollationIdentifier; | |
185 | CF_EXPORT const CFStringRef kCFLocaleUsesMetricSystem; | |
186 | CF_EXPORT const CFStringRef kCFLocaleMeasurementSystem; // "Metric" or "U.S." | |
187 | CF_EXPORT const CFStringRef kCFLocaleDecimalSeparator; | |
188 | CF_EXPORT const CFStringRef kCFLocaleGroupingSeparator; | |
189 | CF_EXPORT const CFStringRef kCFLocaleCurrencySymbol; | |
190 | CF_EXPORT const CFStringRef kCFLocaleCurrencyCode; // ISO 3-letter currency code | |
191 | CF_EXPORT const CFStringRef kCFLocaleCollatorIdentifier CF_AVAILABLE(10_6, 4_0); | |
192 | CF_EXPORT const CFStringRef kCFLocaleQuotationBeginDelimiterKey CF_AVAILABLE(10_6, 4_0); | |
193 | CF_EXPORT const CFStringRef kCFLocaleQuotationEndDelimiterKey CF_AVAILABLE(10_6, 4_0); | |
194 | CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationBeginDelimiterKey CF_AVAILABLE(10_6, 4_0); | |
195 | CF_EXPORT const CFStringRef kCFLocaleAlternateQuotationEndDelimiterKey CF_AVAILABLE(10_6, 4_0); | |
bd5b749c A |
196 | |
197 | // Values for kCFLocaleCalendarIdentifier | |
8ca704e1 A |
198 | CF_EXPORT const CFStringRef kCFGregorianCalendar; |
199 | CF_EXPORT const CFStringRef kCFBuddhistCalendar; | |
200 | CF_EXPORT const CFStringRef kCFChineseCalendar; | |
201 | CF_EXPORT const CFStringRef kCFHebrewCalendar; | |
202 | CF_EXPORT const CFStringRef kCFIslamicCalendar; | |
203 | CF_EXPORT const CFStringRef kCFIslamicCivilCalendar; | |
204 | CF_EXPORT const CFStringRef kCFJapaneseCalendar; | |
205 | CF_EXPORT const CFStringRef kCFRepublicOfChinaCalendar CF_AVAILABLE(10_6, 4_0); | |
206 | CF_EXPORT const CFStringRef kCFPersianCalendar CF_AVAILABLE(10_6, 4_0); | |
207 | CF_EXPORT const CFStringRef kCFIndianCalendar CF_AVAILABLE(10_6, 4_0); | |
208 | CF_EXPORT const CFStringRef kCFISO8601Calendar CF_AVAILABLE(10_6, 4_0); | |
d7384798 A |
209 | CF_EXPORT const CFStringRef kCFIslamicTabularCalendar CF_AVAILABLE(10_10, 8_0); |
210 | CF_EXPORT const CFStringRef kCFIslamicUmmAlQuraCalendar CF_AVAILABLE(10_10, 8_0); | |
bd5b749c A |
211 | |
212 | CF_EXTERN_C_END | |
856091c5 | 213 | CF_IMPLICIT_BRIDGING_DISABLED |
bd5b749c | 214 | |
bd5b749c A |
215 | #endif /* ! __COREFOUNDATION_CFLOCALE__ */ |
216 |