Debian Codegraph @

.cargo/vendor/core-foundation-sys/src/propertylist.rs

raw
1 // Copyright 2013-2015 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, CFOptionFlags, CFTypeRef};
11 use crate::data::CFDataRef;
12 use crate::error::CFErrorRef;
13 use crate::stream::{CFReadStreamRef, CFWriteStreamRef};
14 use crate::string::CFStringRef;
15
16 pub type CFPropertyListRef = CFTypeRef;
17
18 pub type CFPropertyListFormat = CFIndex;
19 pub const kCFPropertyListOpenStepFormat: CFPropertyListFormat = 1;
20 pub const kCFPropertyListXMLFormat_v1_0: CFPropertyListFormat = 100;
21 pub const kCFPropertyListBinaryFormat_v1_0: CFPropertyListFormat = 200;
22
23 pub type CFPropertyListMutabilityOptions = CFOptionFlags;
24 pub const kCFPropertyListImmutable: CFPropertyListMutabilityOptions = 0;
25 pub const kCFPropertyListMutableContainers: CFPropertyListMutabilityOptions = 1;
26 pub const kCFPropertyListMutableContainersAndLeaves: CFPropertyListMutabilityOptions = 2;
27
28 /* Reading and Writing Error Codes */
29 pub const kCFPropertyListReadCorruptError: CFIndex = 3840;
30 pub const kCFPropertyListReadUnknownVersionError: CFIndex = 3841;
31 pub const kCFPropertyListReadStreamError: CFIndex = 3842;
32 pub const kCFPropertyListWriteStreamError: CFIndex = 3851;
33
34 extern "C" {
35 /*
36 * CFPropertyList.h
37 */
38
39 /* Creating a Property List */
40 pub fn CFPropertyListCreateWithData(
41 allocator: CFAllocatorRef,
42 data: CFDataRef,
43 options: CFPropertyListMutabilityOptions,
44 format: *mut CFPropertyListFormat,
45 error: *mut CFErrorRef,
46 ) -> CFPropertyListRef;
47 pub fn CFPropertyListCreateWithStream(
48 allocator: CFAllocatorRef,
49 stream: CFReadStreamRef,
50 streamLength: CFIndex,
51 options: CFOptionFlags,
52 format: *mut CFPropertyListFormat,
53 error: *mut CFErrorRef,
54 ) -> CFPropertyListRef;
55 pub fn CFPropertyListCreateDeepCopy(
56 allocator: CFAllocatorRef,
57 propertyList: CFPropertyListRef,
58 mutabilityOption: CFOptionFlags,
59 ) -> CFPropertyListRef;
60 pub fn CFPropertyListCreateFromXMLData(
61 allocator: CFAllocatorRef,
62 xmlData: CFDataRef,
63 mutabilityOption: CFOptionFlags,
64 errorString: *mut CFStringRef,
65 ) -> CFPropertyListRef; // deprecated
66 pub fn CFPropertyListCreateFromStream(
67 allocator: CFAllocatorRef,
68 stream: CFReadStreamRef,
69 streamLength: CFIndex,
70 mutabilityOption: CFOptionFlags,
71 format: *mut CFPropertyListFormat,
72 errorString: *mut CFStringRef,
73 ) -> CFPropertyListRef; // deprecated
74
75 /* Exporting a Property List */
76 pub fn CFPropertyListCreateData(
77 allocator: CFAllocatorRef,
78 propertyList: CFPropertyListRef,
79 format: CFPropertyListFormat,
80 options: CFOptionFlags,
81 error: *mut CFErrorRef,
82 ) -> CFDataRef;
83 pub fn CFPropertyListWrite(
84 propertyList: CFPropertyListRef,
85 stream: CFWriteStreamRef,
86 format: CFPropertyListFormat,
87 options: CFOptionFlags,
88 error: *mut CFErrorRef,
89 ) -> CFIndex;
90 pub fn CFPropertyListCreateXMLData(
91 allocator: CFAllocatorRef,
92 propertyList: CFPropertyListRef,
93 ) -> CFDataRef; // deprecated
94 pub fn CFPropertyListWriteToStream(
95 propertyList: CFPropertyListRef,
96 stream: CFWriteStreamRef,
97 format: CFPropertyListFormat,
98 errorString: *mut CFStringRef,
99 ) -> CFIndex;
100
101 /* Validating a Property List */
102 pub fn CFPropertyListIsValid(plist: CFPropertyListRef, format: CFPropertyListFormat)
103 -> Boolean;
104 }