This repository has been archived by the owner on Jul 6, 2021. It is now read-only.
forked from nevali/opencflite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCFPropertyList.h
135 lines (116 loc) · 5.77 KB
/
CFPropertyList.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
/*
* Copyright (c) 2008-2009 Brent Fulgham <[email protected]>. All rights reserved.
*
* This source code is a modified version of the CoreFoundation sources released by Apple Inc. under
* the terms of the APSL version 2.0 (see below).
*
* For information about changes from the original Apple source release can be found by reviewing the
* source control system for the project at https://sourceforge.net/svn/?group_id=246198.
*
* The original license information is as follows:
*
* Copyright (c) 2008 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
* This file contains Original Code and/or Modifications of Original Code
* as defined in and that are subject to the Apple Public Source License
* Version 2.0 (the 'License'). You may not use this file except in
* compliance with the License. Please obtain a copy of the License at
* http://www.opensource.apple.com/apsl/ and read it before using this
* file.
*
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
* Please see the License for the specific language governing rights and
* limitations under the License.
*
* @APPLE_LICENSE_HEADER_END@
*/
/* CFPropertyList.h
Copyright (c) 1998-2007, Apple Inc. All rights reserved.
*/
#if !defined(__COREFOUNDATION_CFPROPERTYLIST__)
#define __COREFOUNDATION_CFPROPERTYLIST__ 1
#include <CoreFoundation/CFBase.h>
#include <CoreFoundation/CFData.h>
#include <CoreFoundation/CFString.h>
#include <CoreFoundation/CFStream.h>
CF_EXTERN_C_BEGIN
enum {
kCFPropertyListImmutable = 0,
kCFPropertyListMutableContainers,
kCFPropertyListMutableContainersAndLeaves
};
typedef CFOptionFlags CFPropertyListMutabilityOptions;
/*
Creates a property list object from its XML description; xmlData should
be the raw bytes of that description, possibly the contents of an XML
file. Returns NULL if the data cannot be parsed; if the parse fails
and errorString is non-NULL, a human-readable description of the failure
is returned in errorString. It is the caller's responsibility to release
either the returned object or the error string, whichever is applicable.
*/
CF_EXPORT
CFPropertyListRef CFPropertyListCreateFromXMLData(CFAllocatorRef allocator, CFDataRef xmlData, CFOptionFlags mutabilityOption, CFStringRef *errorString);
/*
Returns the XML description of the given object; propertyList must
be one of the supported property list types, and (for composite types
like CFArray and CFDictionary) must not contain any elements that
are not themselves of a property list type. If a non-property list
type is encountered, NULL is returned. The returned data is
appropriate for writing out to an XML file. Note that a data, not a
string, is returned because the bytes contain in them a description
of the string encoding used.
*/
CF_EXPORT
CFDataRef CFPropertyListCreateXMLData(CFAllocatorRef allocator, CFPropertyListRef propertyList);
/*
Recursively creates a copy of the given property list (so nested arrays
and dictionaries are copied as well as the top-most container). The
resulting property list has the mutability characteristics determined
by mutabilityOption.
*/
CF_EXPORT
CFPropertyListRef CFPropertyListCreateDeepCopy(CFAllocatorRef allocator, CFPropertyListRef propertyList, CFOptionFlags mutabilityOption);
#if MAC_OS_X_VERSION_10_2 <= MAC_OS_X_VERSION_MAX_ALLOWED
enum {
kCFPropertyListOpenStepFormat = 1,
kCFPropertyListXMLFormat_v1_0 = 100,
kCFPropertyListBinaryFormat_v1_0 = 200
};
typedef CFIndex CFPropertyListFormat;
CF_EXPORT
Boolean CFPropertyListIsValid(CFPropertyListRef plist, CFPropertyListFormat format);
/* Returns true if the object graph rooted at plist is a valid property list
* graph -- that is, no cycles, containing only plist objects, and dictionary
* keys are strings. The debugging library version spits out some messages
* to be helpful. The plist structure which is to be allowed is given by
* the format parameter. */
CF_EXPORT
CFIndex CFPropertyListWriteToStream(CFPropertyListRef propertyList, CFWriteStreamRef stream, CFPropertyListFormat format, CFStringRef *errorString);
/* Writes the bytes of a plist serialization out to the stream. The
* stream must be opened and configured -- the function simply writes
* a bunch of bytes to the stream. The output plist format can be chosen.
* Leaves the stream open, but note that reading a plist expects the
* reading stream to end wherever the writing ended, so that the
* end of the plist data can be identified. Returns the number of bytes
* written, or 0 on error. Error messages are not currently localized, but
* may be in the future, so they are not suitable for comparison. */
CF_EXPORT
CFPropertyListRef CFPropertyListCreateFromStream(CFAllocatorRef allocator, CFReadStreamRef stream, CFIndex streamLength, CFOptionFlags mutabilityOption, CFPropertyListFormat *format, CFStringRef *errorString);
/* Same as current function CFPropertyListCreateFromXMLData()
* but takes a stream instead of data, and works on any plist file format.
* CFPropertyListCreateFromXMLData() also works on any plist file format.
* The stream must be open and configured -- the function simply reads a bunch
* of bytes from it starting at the current location in the stream, to the END
* of the stream, which is expected to be the end of the plist, or up to the
* number of bytes given by the length parameter if it is not 0. Error messages
* are not currently localized, but may be in the future, so they are not
* suitable for comparison. */
#endif
CF_EXTERN_C_END
#endif /* ! __COREFOUNDATION_CFPROPERTYLIST__ */