]>
Commit | Line | Data |
---|---|---|
9ce05555 | 1 | /* |
8ca704e1 | 2 | * Copyright (c) 2011 Apple Inc. All rights reserved. |
9ce05555 A |
3 | * |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
9ce05555 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. | |
12 | * | |
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. | |
20 | * | |
21 | * @APPLE_LICENSE_HEADER_END@ | |
22 | */ | |
f64f9b69 | 23 | |
9ce05555 | 24 | /* CFCharacterSetPriv.h |
8ca704e1 | 25 | Copyright (c) 1998-2011, Apple Inc. All rights reserved. |
9ce05555 A |
26 | */ |
27 | ||
bd5b749c A |
28 | #if !defined(__COREFOUNDATION_CFCHARACTERSETPRIV__) |
29 | #define __COREFOUNDATION_CFCHARACTERSETPRIV__ 1 | |
9ce05555 A |
30 | |
31 | #include <CoreFoundation/CFCharacterSet.h> | |
32 | ||
bd5b749c | 33 | CF_EXTERN_C_BEGIN |
9ce05555 | 34 | |
9ce05555 A |
35 | /*! |
36 | @function CFCharacterSetIsSurrogateHighCharacter | |
37 | Reports whether or not the character is a high surrogate. | |
38 | @param character The character to be checked. | |
39 | @result true, if character is a high surrogate, otherwise false. | |
40 | */ | |
41 | CF_INLINE Boolean CFCharacterSetIsSurrogateHighCharacter(UniChar character) { | |
42 | return ((character >= 0xD800UL) && (character <= 0xDBFFUL) ? true : false); | |
43 | } | |
44 | ||
45 | /*! | |
46 | @function CFCharacterSetIsSurrogateLowCharacter | |
47 | Reports whether or not the character is a low surrogate. | |
48 | @param character The character to be checked. | |
49 | @result true, if character is a low surrogate, otherwise false. | |
50 | */ | |
51 | CF_INLINE Boolean CFCharacterSetIsSurrogateLowCharacter(UniChar character) { | |
52 | return ((character >= 0xDC00UL) && (character <= 0xDFFFUL) ? true : false); | |
53 | } | |
54 | ||
55 | /*! | |
56 | @function CFCharacterSetGetLongCharacterForSurrogatePair | |
57 | Returns the UTF-32 value corresponding to the surrogate pair passed in. | |
58 | @param surrogateHigh The high surrogate character. If this parameter | |
59 | is not a valid high surrogate character, the behavior is undefined. | |
60 | @param surrogateLow The low surrogate character. If this parameter | |
61 | is not a valid low surrogate character, the behavior is undefined. | |
62 | @result The UTF-32 value for the surrogate pair. | |
63 | */ | |
64 | CF_INLINE UTF32Char CFCharacterSetGetLongCharacterForSurrogatePair(UniChar surrogateHigh, UniChar surrogateLow) { | |
65 | return ((surrogateHigh - 0xD800UL) << 10) + (surrogateLow - 0xDC00UL) + 0x0010000UL; | |
66 | } | |
9ce05555 A |
67 | |
68 | /* Check to see if the character represented by the surrogate pair surrogateHigh & surrogateLow is in the chraracter set */ | |
69 | CF_EXPORT Boolean CFCharacterSetIsSurrogatePairMember(CFCharacterSetRef theSet, UniChar surrogateHigh, UniChar surrogateLow) ; | |
70 | ||
71 | /* Keyed-coding support | |
72 | */ | |
bd5b749c | 73 | enum { |
9ce05555 A |
74 | kCFCharacterSetKeyedCodingTypeBitmap = 1, |
75 | kCFCharacterSetKeyedCodingTypeBuiltin = 2, | |
76 | kCFCharacterSetKeyedCodingTypeRange = 3, | |
bd5b749c A |
77 | kCFCharacterSetKeyedCodingTypeString = 4, |
78 | kCFCharacterSetKeyedCodingTypeBuiltinAndBitmap = 5 | |
79 | }; | |
80 | typedef CFIndex CFCharacterSetKeyedCodingType; | |
9ce05555 A |
81 | |
82 | CF_EXPORT CFCharacterSetKeyedCodingType _CFCharacterSetGetKeyedCodingType(CFCharacterSetRef cset); | |
83 | CF_EXPORT CFCharacterSetPredefinedSet _CFCharacterSetGetKeyedCodingBuiltinType(CFCharacterSetRef cset); | |
84 | CF_EXPORT CFRange _CFCharacterSetGetKeyedCodingRange(CFCharacterSetRef cset); | |
85 | CF_EXPORT CFStringRef _CFCharacterSetCreateKeyedCodingString(CFCharacterSetRef cset); | |
9ce05555 A |
86 | CF_EXPORT bool _CFCharacterSetIsInverted(CFCharacterSetRef cset); |
87 | CF_EXPORT void _CFCharacterSetSetIsInverted(CFCharacterSetRef cset, bool flag); | |
88 | ||
bd5b749c A |
89 | CF_EXTERN_C_END |
90 | ||
91 | #endif /* ! __COREFOUNDATION_CFCHARACTERSETPRIV__ */ | |
9ce05555 | 92 |