123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460 |
- { CFCharacterSet.h
- Copyright (c) 1999-2005, Apple, Inc. All rights reserved.
- }
- { Pascal Translation Updated: Peter N Lewis, <[email protected]>, September 2005 }
- {
- Modified for use with Free Pascal
- Version 210
- Please report any bugs to <[email protected]>
- }
- {$mode macpas}
- {$packenum 1}
- {$macro on}
- {$inline on}
- {$calling mwpascal}
- unit CFCharacterSet;
- interface
- {$setc UNIVERSAL_INTERFACES_VERSION := $0342}
- {$setc GAP_INTERFACES_VERSION := $0210}
- {$ifc not defined USE_CFSTR_CONSTANT_MACROS}
- {$setc USE_CFSTR_CONSTANT_MACROS := TRUE}
- {$endc}
- {$ifc defined CPUPOWERPC and defined CPUI386}
- {$error Conflicting initial definitions for CPUPOWERPC and CPUI386}
- {$endc}
- {$ifc defined FPC_BIG_ENDIAN and defined FPC_LITTLE_ENDIAN}
- {$error Conflicting initial definitions for FPC_BIG_ENDIAN and FPC_LITTLE_ENDIAN}
- {$endc}
- {$ifc not defined __ppc__ and defined CPUPOWERPC}
- {$setc __ppc__ := 1}
- {$elsec}
- {$setc __ppc__ := 0}
- {$endc}
- {$ifc not defined __i386__ and defined CPUI386}
- {$setc __i386__ := 1}
- {$elsec}
- {$setc __i386__ := 0}
- {$endc}
- {$ifc defined __ppc__ and __ppc__ and defined __i386__ and __i386__}
- {$error Conflicting definitions for __ppc__ and __i386__}
- {$endc}
- {$ifc defined __ppc__ and __ppc__}
- {$setc TARGET_CPU_PPC := TRUE}
- {$setc TARGET_CPU_X86 := FALSE}
- {$elifc defined __i386__ and __i386__}
- {$setc TARGET_CPU_PPC := FALSE}
- {$setc TARGET_CPU_X86 := TRUE}
- {$elsec}
- {$error Neither __ppc__ nor __i386__ is defined.}
- {$endc}
- {$setc TARGET_CPU_PPC_64 := FALSE}
- {$ifc defined FPC_BIG_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := TRUE}
- {$setc TARGET_RT_LITTLE_ENDIAN := FALSE}
- {$elifc defined FPC_LITTLE_ENDIAN}
- {$setc TARGET_RT_BIG_ENDIAN := FALSE}
- {$setc TARGET_RT_LITTLE_ENDIAN := TRUE}
- {$elsec}
- {$error Neither FPC_BIG_ENDIAN nor FPC_LITTLE_ENDIAN are defined.}
- {$endc}
- {$setc ACCESSOR_CALLS_ARE_FUNCTIONS := TRUE}
- {$setc CALL_NOT_IN_CARBON := FALSE}
- {$setc OLDROUTINENAMES := FALSE}
- {$setc OPAQUE_TOOLBOX_STRUCTS := TRUE}
- {$setc OPAQUE_UPP_TYPES := TRUE}
- {$setc OTCARBONAPPLICATION := TRUE}
- {$setc OTKERNEL := FALSE}
- {$setc PM_USE_SESSION_APIS := TRUE}
- {$setc TARGET_API_MAC_CARBON := TRUE}
- {$setc TARGET_API_MAC_OS8 := FALSE}
- {$setc TARGET_API_MAC_OSX := TRUE}
- {$setc TARGET_CARBON := TRUE}
- {$setc TARGET_CPU_68K := FALSE}
- {$setc TARGET_CPU_MIPS := FALSE}
- {$setc TARGET_CPU_SPARC := FALSE}
- {$setc TARGET_OS_MAC := TRUE}
- {$setc TARGET_OS_UNIX := FALSE}
- {$setc TARGET_OS_WIN32 := FALSE}
- {$setc TARGET_RT_MAC_68881 := FALSE}
- {$setc TARGET_RT_MAC_CFM := FALSE}
- {$setc TARGET_RT_MAC_MACHO := TRUE}
- {$setc TYPED_FUNCTION_POINTERS := TRUE}
- {$setc TYPE_BOOL := FALSE}
- {$setc TYPE_EXTENDED := FALSE}
- {$setc TYPE_LONGLONG := TRUE}
- uses MacTypes,CFBase,CFData;
- {$ALIGN POWER}
- {!
- @header CFCharacterSet
- CFCharacterSet represents a set, or a bag, of Unicode characters.
- The API consists of 3 groups:
- 1) creation/manipulation of CFCharacterSet instances,
- 2) query of a single Unicode character membership,
- and 3) bitmap representation related (reading/writing).
- Conceptually, CFCharacterSet is a 136K byte bitmap array of
- which each bit represents a Unicode code point. It could
- contain the Unicode characters in ISO 10646 Basic Multilingual
- Plane (BMP) and characters in Plane 1 through Plane 16
- accessible via surrogate paris in the Unicode Transformation
- Format, 16-bit encoding form (UTF-16). In other words, it can
- store values from 0x00000 to 0x10FFFF in the Unicode
- Transformation Format, 32-bit encoding form (UTF-32). However,
- in general, how CFCharacterSet stores the information is an
- implementation detail. Note even CFData used for the external
- bitmap representation rarely has 136K byte. For detailed
- discussion of the external bitmap representation, refer to the
- comments for CFCharacterSetCreateWithBitmapRepresentation below.
- Note that the existance of non-BMP characters in a character set
- does not imply the membership of the corresponding surrogate
- characters. For example, a character set with U+10000 does not
- match with U+D800.
- }
- {!
- @typedef CFCharacterSetRef
- This is the type of a reference to immutable CFCharacterSets.
- }
- type
- CFCharacterSetRef = ^SInt32; { an opaque 32-bit type }
- CFCharacterSetRefPtr = ^CFCharacterSetRef;
- {!
- @typedef CFMutableCharacterSetRef
- This is the type of a reference to mutable CFMutableCharacterSets.
- }
- type
- CFMutableCharacterSetRef = CFCharacterSetRef;
- CFMutableCharacterSetRefPtr = ^CFMutableCharacterSetRef;
- {!
- @typedef CFCharacterSetPredefinedSet
- Type of the predefined CFCharacterSet selector values.
- }
- type
- CFCharacterSetPredefinedSet = SInt32;
- const
- kCFCharacterSetControl = 1; { Control character set (Unicode General Category Cc and Cf) }
- kCFCharacterSetWhitespace = 2; { Whitespace character set (Unicode General Category Zs and U0009 CHARACTER TABULATION) }
- kCFCharacterSetWhitespaceAndNewline = 3; { Whitespace and Newline character set (Unicode General Category Z*, U000A ~ U000D, and U0085) }
- kCFCharacterSetDecimalDigit = 4; { Decimal digit character set }
- kCFCharacterSetLetter = 5; { Letter character set (Unicode General Category L* & M*) }
- kCFCharacterSetLowercaseLetter = 6; { Lowercase character set (Unicode General Category Ll) }
- kCFCharacterSetUppercaseLetter = 7; { Uppercase character set (Unicode General Category Lu and Lt) }
- kCFCharacterSetNonBase = 8; { Non-base character set (Unicode General Category M*) }
- kCFCharacterSetDecomposable = 9; { Canonically decomposable character set }
- kCFCharacterSetAlphaNumeric = 10; { Alpha Numeric character set (Unicode General Category L*, M*, & N*) }
- kCFCharacterSetPunctuation = 11; { Punctuation character set (Unicode General Category P*) }
- kCFCharacterSetIllegal = 12; { Illegal character set }
- {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
- kCFCharacterSetCapitalizedLetter = 13; { Titlecase character set (Unicode General Category Lt) }
- {#endif}
- {#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
- kCFCharacterSetSymbol = 14; { Symbol character set (Unicode General Category S*) }
- {#endif}
- {!
- @function CFCharacterSetGetTypeID
- Returns the type identifier of all CFCharacterSet instances.
- }
- function CFCharacterSetGetTypeID: CFTypeID; external name '_CFCharacterSetGetTypeID';
- {!
- @function CFCharacterSetGetPredefined
- Returns a predefined CFCharacterSet instance.
- @param theSetIdentifier The CFCharacterSetPredefinedSet selector
- which specifies the predefined character set. If the
- value is not in CFCharacterSetPredefinedSet, the behavior
- is undefined.
- @result A reference to the predefined immutable CFCharacterSet.
- This instance is owned by CF.
- }
- function CFCharacterSetGetPredefined( theSetIdentifier: CFCharacterSetPredefinedSet ): CFCharacterSetRef; external name '_CFCharacterSetGetPredefined';
- {!
- @function CFCharacterSetCreateWithCharactersInRange
- Creates a new immutable character set with the values from the given range.
- @param alloc The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @param theRange The CFRange which should be used to specify the
- Unicode range the character set is filled with. It
- accepts the range in 32-bit in the UTF-32 format. The
- valid character point range is from 0x00000 to 0x10FFFF.
- If the range is outside of the valid Unicode character
- point, the behavior is undefined.
- @result A reference to the new immutable CFCharacterSet.
- }
- function CFCharacterSetCreateWithCharactersInRange( alloc: CFAllocatorRef; theRange: CFRange ): CFCharacterSetRef; external name '_CFCharacterSetCreateWithCharactersInRange';
- {!
- @function CFCharacterSetCreateWithCharactersInString
- Creates a new immutable character set with the values in the given string.
- @param alloc The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @param theString The CFString which should be used to specify
- the Unicode characters the character set is filled with.
- If this parameter is not a valid CFString, the behavior
- is undefined.
- @result A reference to the new immutable CFCharacterSet.
- }
- function CFCharacterSetCreateWithCharactersInString( alloc: CFAllocatorRef; theString: CFStringRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateWithCharactersInString';
- {!
- @function CFCharacterSetCreateWithBitmapRepresentation
- Creates a new immutable character set with the bitmap representtion in the given data.
- @param alloc The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @param theData The CFData which should be used to specify the
- bitmap representation of the Unicode character points
- the character set is filled with. The bitmap
- representation could contain all the Unicode character
- range starting from BMP to Plane 16. The first 8K bytes
- of the data represents the BMP range. The BMP range 8K
- bytes can be followed by zero to sixteen 8K byte
- bitmaps, each one with the plane index byte prepended.
- For example, the bitmap representing the BMP and Plane 2
- has the size of 16385 bytes (8K bytes for BMP, 1 byte
- index + 8K bytes bitmap for Plane 2). The plane index
- byte, in this case, contains the integer value two. If
- this parameter is not a valid CFData or it contains a
- Plane index byte outside of the valid Plane range
- (1 to 16), the behavior is undefined.
- @result A reference to the new immutable CFCharacterSet.
- }
- function CFCharacterSetCreateWithBitmapRepresentation( alloc: CFAllocatorRef; theData: CFDataRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateWithBitmapRepresentation';
- {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
- {!
- @function CFCharacterSetCreateInvertedSet
- Creates a new immutable character set that is the invert of the specified character set.
- @param alloc The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @param theSet The CFCharacterSet which is to be inverted. If this
- parameter is not a valid CFCharacterSet, the behavior is
- undefined.
- @result A reference to the new immutable CFCharacterSet.
- }
- function CFCharacterSetCreateInvertedSet( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateInvertedSet';
- {!
- @function CFCharacterSetIsSupersetOfSet
- Reports whether or not the character set is a superset of the character set specified as the second parameter.
- @param theSet The character set to be checked for the membership of theOtherSet.
- If this parameter is not a valid CFCharacterSet, the behavior is undefined.
- @param theOtherset The character set to be checked whether or not it is a subset of theSet.
- If this parameter is not a valid CFCharacterSet, the behavior is undefined.
- }
- function CFCharacterSetIsSupersetOfSet( theSet: CFCharacterSetRef; theOtherset: CFCharacterSetRef ): Boolean; external name '_CFCharacterSetIsSupersetOfSet';
- {!
- @function CFCharacterSetHasMemberInPlane
- Reports whether or not the character set contains at least one member character in the specified plane.
- @param theSet The character set to be checked for the membership. If this
- parameter is not a valid CFCharacterSet, the behavior is undefined.
- @param thePlane The plane number to be checked for the membership.
- The valid value range is from 0 to 16. If the value is outside of the valid
- plane number range, the behavior is undefined.
- }
- function CFCharacterSetHasMemberInPlane( theSet: CFCharacterSetRef; thePlane: CFIndex ): Boolean; external name '_CFCharacterSetHasMemberInPlane';
- {#endif}
- {!
- @function CFCharacterSetCreateMutable
- Creates a new empty mutable character set.
- @param allocator The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @result A reference to the new mutable CFCharacterSet.
- }
- function CFCharacterSetCreateMutable( alloc: CFAllocatorRef ): CFMutableCharacterSetRef; external name '_CFCharacterSetCreateMutable';
- {#if MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED}
- {!
- @function CFCharacterSetCreateCopy
- Creates a new character set with the values from the given character set. This function tries to compact the backing store where applicable.
- @param allocator The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @param theSet The CFCharacterSet which is to be copied. If this
- parameter is not a valid CFCharacterSet, the behavior is
- undefined.
- @result A reference to the new CFCharacterSet.
- }
- function CFCharacterSetCreateCopy( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFCharacterSetRef; external name '_CFCharacterSetCreateCopy';
- (* AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER *)
- {#endif} { MAC_OS_X_VERSION_10_3 <= MAC_OS_X_VERSION_MAX_ALLOWED }
- {!
- @function CFCharacterSetCreateMutableCopy
- Creates a new mutable character set with the values from the given character set.
- @param allocator The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @param theSet The CFCharacterSet which is to be copied. If this
- parameter is not a valid CFCharacterSet, the behavior is
- undefined.
- @result A reference to the new mutable CFCharacterSet.
- }
- function CFCharacterSetCreateMutableCopy( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFMutableCharacterSetRef; external name '_CFCharacterSetCreateMutableCopy';
- {!
- @function CFCharacterSetIsCharacterMember
- Reports whether or not the Unicode character is in the character set.
- @param theSet The character set to be searched. If this parameter
- is not a valid CFCharacterSet, the behavior is undefined.
- @param theChar The Unicode character for which to test against the
- character set. Note that this function takes 16-bit Unicode
- character value; hence, it does not support access to the
- non-BMP planes.
- @result true, if the value is in the character set, otherwise false.
- }
- function CFCharacterSetIsCharacterMember( theSet: CFCharacterSetRef; theChar: UniChar ): Boolean; external name '_CFCharacterSetIsCharacterMember';
- {#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED}
- {!
- @function CFCharacterSetIsLongCharacterMember
- Reports whether or not the UTF-32 character is in the character set.
- @param theSet The character set to be searched. If this parameter
- is not a valid CFCharacterSet, the behavior is undefined.
- @param theChar The UTF-32 character for which to test against the
- character set.
- @result true, if the value is in the character set, otherwise false.
- }
- function CFCharacterSetIsLongCharacterMember( theSet: CFCharacterSetRef; theChar: UTF32Char ): Boolean; external name '_CFCharacterSetIsLongCharacterMember';
- {#endif}
- {!
- @function CFCharacterSetCreateBitmapRepresentation
- Creates a new immutable data with the bitmap representation from the given character set.
- @param allocator The CFAllocator which should be used to allocate
- memory for the array and its storage for values. This
- parameter may be NULL in which case the current default
- CFAllocator is used. If this reference is not a valid
- CFAllocator, the behavior is undefined.
- @param theSet The CFCharacterSet which is to be used create the
- bitmap representation from. Refer to the comments for
- CFCharacterSetCreateWithBitmapRepresentation for the
- detailed discussion of the bitmap representation format.
- If this parameter is not a valid CFCharacterSet, the
- behavior is undefined.
- @result A reference to the new immutable CFData.
- }
- function CFCharacterSetCreateBitmapRepresentation( alloc: CFAllocatorRef; theSet: CFCharacterSetRef ): CFDataRef; external name '_CFCharacterSetCreateBitmapRepresentation';
- {!
- @function CFCharacterSetAddCharactersInRange
- Adds the given range to the charaacter set.
- @param theSet The character set to which the range is to be added.
- If this parameter is not a valid mutable CFCharacterSet,
- the behavior is undefined.
- @param theRange The range to add to the character set. It accepts
- the range in 32-bit in the UTF-32 format. The valid
- character point range is from 0x00000 to 0x10FFFF. If the
- range is outside of the valid Unicode character point,
- the behavior is undefined.
- }
- procedure CFCharacterSetAddCharactersInRange( theSet: CFMutableCharacterSetRef; theRange: CFRange ); external name '_CFCharacterSetAddCharactersInRange';
- {!
- @function CFCharacterSetRemoveCharactersInRange
- Removes the given range from the charaacter set.
- @param theSet The character set from which the range is to be
- removed. If this parameter is not a valid mutable
- CFCharacterSet, the behavior is undefined.
- @param theRange The range to remove from the character set.
- It accepts the range in 32-bit in the UTF-32 format.
- The valid character point range is from 0x00000 to 0x10FFFF.
- If the range is outside of the valid Unicode character point,
- the behavior is undefined.
- }
- procedure CFCharacterSetRemoveCharactersInRange( theSet: CFMutableCharacterSetRef; theRange: CFRange ); external name '_CFCharacterSetRemoveCharactersInRange';
- {!
- @function CFCharacterSetAddCharactersInString
- Adds the characters in the given string to the charaacter set.
- @param theSet The character set to which the characters in the
- string are to be added. If this parameter is not a
- valid mutable CFCharacterSet, the behavior is undefined.
- @param theString The string to add to the character set.
- If this parameter is not a valid CFString, the behavior
- is undefined.
- }
- procedure CFCharacterSetAddCharactersInString( theSet: CFMutableCharacterSetRef; theString: CFStringRef ); external name '_CFCharacterSetAddCharactersInString';
- {!
- @function CFCharacterSetRemoveCharactersInString
- Removes the characters in the given string from the charaacter set.
- @param theSet The character set from which the characters in the
- string are to be remove. If this parameter is not a
- valid mutable CFCharacterSet, the behavior is undefined.
- @param theString The string to remove from the character set.
- If this parameter is not a valid CFString, the behavior
- is undefined.
- }
- procedure CFCharacterSetRemoveCharactersInString( theSet: CFMutableCharacterSetRef; theString: CFStringRef ); external name '_CFCharacterSetRemoveCharactersInString';
- {!
- @function CFCharacterSetUnion
- Forms the union with the given character set.
- @param theSet The destination character set into which the
- union of the two character sets is stored. If this
- parameter is not a valid mutable CFCharacterSet, the
- behavior is undefined.
- @param theOtherSet The character set with which the union is
- formed. If this parameter is not a valid CFCharacterSet,
- the behavior is undefined.
- }
- procedure CFCharacterSetUnion( theSet: CFMutableCharacterSetRef; theOtherSet: CFCharacterSetRef ); external name '_CFCharacterSetUnion';
- {!
- @function CFCharacterSetIntersect
- Forms the intersection with the given character set.
- @param theSet The destination character set into which the
- intersection of the two character sets is stored.
- If this parameter is not a valid mutable CFCharacterSet,
- the behavior is undefined.
- @param theOtherSet The character set with which the intersection
- is formed. If this parameter is not a valid CFCharacterSet,
- the behavior is undefined.
- }
- procedure CFCharacterSetIntersect( theSet: CFMutableCharacterSetRef; theOtherSet: CFCharacterSetRef ); external name '_CFCharacterSetIntersect';
- {!
- @function CFCharacterSetInvert
- Inverts the content of the given character set.
- @param theSet The character set to be inverted.
- If this parameter is not a valid mutable CFCharacterSet,
- the behavior is undefined.
- }
- procedure CFCharacterSetInvert( theSet: CFMutableCharacterSetRef ); external name '_CFCharacterSetInvert';
- end.
|