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