]>
Commit | Line | Data |
---|---|---|
9ce05555 A |
1 | /* |
2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. | |
3 | * | |
4 | * @APPLE_LICENSE_HEADER_START@ | |
5 | * | |
6 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. | |
7 | * | |
8 | * This file contains Original Code and/or Modifications of Original Code | |
9 | * as defined in and that are subject to the Apple Public Source License | |
10 | * Version 2.0 (the 'License'). You may not use this file except in | |
11 | * compliance with the License. Please obtain a copy of the License at | |
12 | * http://www.opensource.apple.com/apsl/ and read it before using this | |
13 | * file. | |
14 | * | |
15 | * The Original Code and all software distributed under the License are | |
16 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER | |
17 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, | |
18 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, | |
19 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. | |
20 | * Please see the License for the specific language governing rights and | |
21 | * limitations under the License. | |
22 | * | |
23 | * @APPLE_LICENSE_HEADER_END@ | |
24 | */ | |
25 | /* CFCharacterSetPriv.h | |
26 | Copyright (c) 1998-2003, Apple, Inc. All rights reserved. | |
27 | */ | |
28 | ||
29 | #if !defined(__COREFOUNDATION_CFCHARACTERSET_PRIV__) | |
30 | #define __COREFOUNDATION_CFCHARACTERSET_PRIV__ 1 | |
31 | ||
32 | #include <CoreFoundation/CFCharacterSet.h> | |
33 | ||
34 | #if defined(__cplusplus) | |
35 | extern "C" { | |
36 | #endif | |
37 | ||
38 | #if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED | |
39 | /*! | |
40 | @function CFCharacterSetIsSurrogateHighCharacter | |
41 | Reports whether or not the character is a high surrogate. | |
42 | @param character The character to be checked. | |
43 | @result true, if character is a high surrogate, otherwise false. | |
44 | */ | |
45 | CF_INLINE Boolean CFCharacterSetIsSurrogateHighCharacter(UniChar character) { | |
46 | return ((character >= 0xD800UL) && (character <= 0xDBFFUL) ? true : false); | |
47 | } | |
48 | ||
49 | /*! | |
50 | @function CFCharacterSetIsSurrogateLowCharacter | |
51 | Reports whether or not the character is a low surrogate. | |
52 | @param character The character to be checked. | |
53 | @result true, if character is a low surrogate, otherwise false. | |
54 | */ | |
55 | CF_INLINE Boolean CFCharacterSetIsSurrogateLowCharacter(UniChar character) { | |
56 | return ((character >= 0xDC00UL) && (character <= 0xDFFFUL) ? true : false); | |
57 | } | |
58 | ||
59 | /*! | |
60 | @function CFCharacterSetGetLongCharacterForSurrogatePair | |
61 | Returns the UTF-32 value corresponding to the surrogate pair passed in. | |
62 | @param surrogateHigh The high surrogate character. If this parameter | |
63 | is not a valid high surrogate character, the behavior is undefined. | |
64 | @param surrogateLow The low surrogate character. If this parameter | |
65 | is not a valid low surrogate character, the behavior is undefined. | |
66 | @result The UTF-32 value for the surrogate pair. | |
67 | */ | |
68 | CF_INLINE UTF32Char CFCharacterSetGetLongCharacterForSurrogatePair(UniChar surrogateHigh, UniChar surrogateLow) { | |
69 | return ((surrogateHigh - 0xD800UL) << 10) + (surrogateLow - 0xDC00UL) + 0x0010000UL; | |
70 | } | |
71 | #endif | |
72 | ||
73 | /* Check to see if the character represented by the surrogate pair surrogateHigh & surrogateLow is in the chraracter set */ | |
74 | CF_EXPORT Boolean CFCharacterSetIsSurrogatePairMember(CFCharacterSetRef theSet, UniChar surrogateHigh, UniChar surrogateLow) ; | |
75 | ||
76 | /* Keyed-coding support | |
77 | */ | |
78 | typedef enum { | |
79 | kCFCharacterSetKeyedCodingTypeBitmap = 1, | |
80 | kCFCharacterSetKeyedCodingTypeBuiltin = 2, | |
81 | kCFCharacterSetKeyedCodingTypeRange = 3, | |
82 | kCFCharacterSetKeyedCodingTypeString = 4 | |
83 | } CFCharacterSetKeyedCodingType; | |
84 | ||
85 | CF_EXPORT CFCharacterSetKeyedCodingType _CFCharacterSetGetKeyedCodingType(CFCharacterSetRef cset); | |
86 | CF_EXPORT CFCharacterSetPredefinedSet _CFCharacterSetGetKeyedCodingBuiltinType(CFCharacterSetRef cset); | |
87 | CF_EXPORT CFRange _CFCharacterSetGetKeyedCodingRange(CFCharacterSetRef cset); | |
88 | CF_EXPORT CFStringRef _CFCharacterSetCreateKeyedCodingString(CFCharacterSetRef cset); | |
89 | CF_EXPORT bool _CFCharacterSetIsMutable(CFCharacterSetRef cset); | |
90 | CF_EXPORT bool _CFCharacterSetIsInverted(CFCharacterSetRef cset); | |
91 | CF_EXPORT void _CFCharacterSetSetIsInverted(CFCharacterSetRef cset, bool flag); | |
92 | ||
93 | #if defined(__cplusplus) | |
94 | } | |
95 | #endif | |
96 | ||
97 | #endif /* !__COREFOUNDATION_CFCHARACTERSET_PRIV__ */ |