| 1 |
// Copyright 2019 The Servo Project Developers. See the COPYRIGHT |
| 2 |
// file at the top-level directory of this distribution. |
| 3 |
// |
| 4 |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or |
| 5 |
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 6 |
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your |
| 7 |
// option. This file may not be copied, modified, or distributed |
| 8 |
// except according to those terms. |
| 9 |
|
| 10 |
use crate::base::{Boolean, CFAllocatorRef, CFIndex, CFRange, CFTypeID, UTF32Char}; |
| 11 |
use crate::data::CFDataRef; |
| 12 |
use crate::string::{CFStringRef, UniChar}; |
| 13 |
use std::os::raw::c_void; |
| 14 |
|
| 15 |
pub type CFCharacterSetPredefinedSet = CFIndex; |
| 16 |
|
| 17 |
// Members of CFCharacterSetPredefinedSet enum |
| 18 |
pub static kCFCharacterSetControl: CFCharacterSetPredefinedSet = 1; |
| 19 |
pub static kCFCharacterSetWhitespace: CFCharacterSetPredefinedSet = 2; |
| 20 |
pub static kCFCharacterSetWhitespaceAndNewline: CFCharacterSetPredefinedSet = 3; |
| 21 |
pub static kCFCharacterSetDecimalDigit: CFCharacterSetPredefinedSet = 4; |
| 22 |
pub static kCFCharacterSetLetter: CFCharacterSetPredefinedSet = 5; |
| 23 |
pub static kCFCharacterSetLowercaseLetter: CFCharacterSetPredefinedSet = 6; |
| 24 |
pub static kCFCharacterSetUppercaseLetter: CFCharacterSetPredefinedSet = 7; |
| 25 |
pub static kCFCharacterSetNonBase: CFCharacterSetPredefinedSet = 8; |
| 26 |
pub static kCFCharacterSetDecomposable: CFCharacterSetPredefinedSet = 9; |
| 27 |
pub static kCFCharacterSetAlphaNumeric: CFCharacterSetPredefinedSet = 10; |
| 28 |
pub static kCFCharacterSetPunctuation: CFCharacterSetPredefinedSet = 11; |
| 29 |
pub static kCFCharacterSetIllegal: CFCharacterSetPredefinedSet = 12; |
| 30 |
pub static kCFCharacterSetCapitalizedLetter: CFCharacterSetPredefinedSet = 13; |
| 31 |
pub static kCFCharacterSetSymbol: CFCharacterSetPredefinedSet = 14; |
| 32 |
pub static kCFCharacterSetNewline: CFCharacterSetPredefinedSet = 15; |
| 33 |
|
| 34 |
#[repr(C)] |
| 35 |
pub struct __CFCharacterSet(c_void); |
| 36 |
|
| 37 |
pub type CFCharacterSetRef = *const __CFCharacterSet; |
| 38 |
pub type CFMutableCharacterSetRef = *mut __CFCharacterSet; |
| 39 |
|
| 40 |
extern "C" { |
| 41 |
/* |
| 42 |
* CFCharacterSet.h |
| 43 |
*/ |
| 44 |
|
| 45 |
/* CFCharacterSet */ |
| 46 |
/* Creating Character Sets */ |
| 47 |
pub fn CFCharacterSetCreateCopy( |
| 48 |
alloc: CFAllocatorRef, |
| 49 |
theSet: CFCharacterSetRef, |
| 50 |
) -> CFCharacterSetRef; |
| 51 |
pub fn CFCharacterSetCreateInvertedSet( |
| 52 |
alloc: CFAllocatorRef, |
| 53 |
theSet: CFCharacterSetRef, |
| 54 |
) -> CFCharacterSetRef; |
| 55 |
pub fn CFCharacterSetCreateWithCharactersInRange( |
| 56 |
alloc: CFAllocatorRef, |
| 57 |
theRange: CFRange, |
| 58 |
) -> CFCharacterSetRef; |
| 59 |
pub fn CFCharacterSetCreateWithCharactersInString( |
| 60 |
alloc: CFAllocatorRef, |
| 61 |
theString: CFStringRef, |
| 62 |
) -> CFCharacterSetRef; |
| 63 |
pub fn CFCharacterSetCreateWithBitmapRepresentation( |
| 64 |
alloc: CFAllocatorRef, |
| 65 |
theData: CFDataRef, |
| 66 |
) -> CFCharacterSetRef; |
| 67 |
|
| 68 |
/* Getting Predefined Character Sets */ |
| 69 |
pub fn CFCharacterSetGetPredefined( |
| 70 |
theSetIdentifier: CFCharacterSetPredefinedSet, |
| 71 |
) -> CFCharacterSetRef; |
| 72 |
|
| 73 |
/* Querying Character Sets */ |
| 74 |
pub fn CFCharacterSetCreateBitmapRepresentation( |
| 75 |
alloc: CFAllocatorRef, |
| 76 |
theSet: CFCharacterSetRef, |
| 77 |
) -> CFDataRef; |
| 78 |
pub fn CFCharacterSetHasMemberInPlane(theSet: CFCharacterSetRef, thePlane: CFIndex) -> Boolean; |
| 79 |
pub fn CFCharacterSetIsCharacterMember(theSet: CFCharacterSetRef, theChar: UniChar) -> Boolean; |
| 80 |
pub fn CFCharacterSetIsLongCharacterMember( |
| 81 |
theSet: CFCharacterSetRef, |
| 82 |
theChar: UTF32Char, |
| 83 |
) -> Boolean; |
| 84 |
pub fn CFCharacterSetIsSupersetOfSet( |
| 85 |
theSet: CFCharacterSetRef, |
| 86 |
theOtherset: CFCharacterSetRef, |
| 87 |
) -> Boolean; |
| 88 |
|
| 89 |
/* Getting the Character Set Type Identifier */ |
| 90 |
pub fn CFCharacterSetGetTypeID() -> CFTypeID; |
| 91 |
|
| 92 |
/* CFMutableCharacterSet */ |
| 93 |
/* Creating a Mutable Character Set */ |
| 94 |
pub fn CFCharacterSetCreateMutable(alloc: CFAllocatorRef) -> CFMutableCharacterSetRef; |
| 95 |
pub fn CFCharacterSetCreateMutableCopy( |
| 96 |
alloc: CFAllocatorRef, |
| 97 |
theSet: CFCharacterSetRef, |
| 98 |
) -> CFMutableCharacterSetRef; |
| 99 |
|
| 100 |
/* Adding Characters */ |
| 101 |
pub fn CFCharacterSetAddCharactersInRange(theSet: CFMutableCharacterSetRef, theRange: CFRange); |
| 102 |
pub fn CFCharacterSetAddCharactersInString( |
| 103 |
theSet: CFMutableCharacterSetRef, |
| 104 |
theString: CFStringRef, |
| 105 |
); |
| 106 |
|
| 107 |
/* Removing Characters */ |
| 108 |
pub fn CFCharacterSetRemoveCharactersInRange( |
| 109 |
theSet: CFMutableCharacterSetRef, |
| 110 |
theRange: CFRange, |
| 111 |
); |
| 112 |
pub fn CFCharacterSetRemoveCharactersInString( |
| 113 |
theSet: CFMutableCharacterSetRef, |
| 114 |
theString: CFStringRef, |
| 115 |
); |
| 116 |
|
| 117 |
/* Logical Operations */ |
| 118 |
pub fn CFCharacterSetIntersect( |
| 119 |
theSet: CFMutableCharacterSetRef, |
| 120 |
theOtherSet: CFCharacterSetRef, |
| 121 |
); |
| 122 |
pub fn CFCharacterSetInvert(theSet: CFMutableCharacterSetRef); |
| 123 |
pub fn CFCharacterSetUnion(theSet: CFMutableCharacterSetRef, theOtherSet: CFCharacterSetRef); |
| 124 |
} |