1 | /* |
2 | * Copyright (c) 2000-2016 Apple Inc. All rights reserved. |
3 | * |
4 | * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ |
5 | * |
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. The rights granted to you under the License |
10 | * may not be used to create, or enable the creation or redistribution of, |
11 | * unlawful or unlicensed copies of an Apple operating system, or to |
12 | * circumvent, violate, or enable the circumvention or violation of, any |
13 | * terms of an Apple operating system software license agreement. |
14 | * |
15 | * Please obtain a copy of the License at |
16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. |
17 | * |
18 | * The Original Code and all software distributed under the License are |
19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER |
20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, |
21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, |
22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. |
23 | * Please see the License for the specific language governing rights and |
24 | * limitations under the License. |
25 | * |
26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ |
27 | */ |
28 | /* OSUnserialize.h created by rsulack on Mon 23-Nov-1998 */ |
29 | |
30 | #ifndef _OS_OSUNSERIALIZE_H |
31 | #define _OS_OSUNSERIALIZE_H |
32 | |
33 | #include <libkern/c++/OSMetaClass.h> |
34 | #include <libkern/c++/OSString.h> |
35 | #include <libkern/c++/OSPtr.h> |
36 | |
37 | #include <sys/appleapiopts.h> |
38 | #include <sys/types.h> |
39 | |
40 | class OSObject; |
41 | class OSString; |
42 | |
43 | /*! |
44 | * @header |
45 | * |
46 | * @abstract |
47 | * This header declares the <code>OSUnserializeXML</code> function. |
48 | */ |
49 | |
50 | |
51 | /*! |
52 | * @function OSUnserializeXML |
53 | * |
54 | * @abstract |
55 | * Recreates an OSContainer object |
56 | * from its previously serialized OSContainer class instance data. |
57 | * |
58 | * @param buffer A buffer containing nul-terminated XML data |
59 | * representing the object to be recreated. |
60 | * @param errorString If non-<code>NULL</code>, and the XML parser |
61 | * finds an error in <code>buffer</code>, |
62 | * <code>*errorString</code> indicates the line number |
63 | * and type of error encountered. |
64 | * |
65 | * @result |
66 | * The recreated object, or <code>NULL</code> on failure. |
67 | * |
68 | * @discussion |
69 | * <b>Not safe</b> to call in a primary interrupt handler. |
70 | */ |
71 | extern "C++" OSPtr<OSObject> OSUnserializeXML( |
72 | const char * buffer, |
73 | OSString * * errorString = NULL); |
74 | |
75 | extern "C++" OSPtr<OSObject> OSUnserializeXML( |
76 | const char * buffer, |
77 | OSSharedPtr<OSString>& errorString); |
78 | |
79 | /*! |
80 | * @function OSUnserializeXML |
81 | * |
82 | * @abstract |
83 | * Recreates an OSContainer object |
84 | * from its previously serialized OSContainer class instance data. |
85 | * |
86 | * @param buffer A buffer containing nul-terminated XML data |
87 | * representing the object to be recreated. |
88 | * @param bufferSize The size of the block of memory. The function |
89 | * never scans beyond the first bufferSize bytes. |
90 | * @param errorString If non-<code>NULL</code>, and the XML parser |
91 | * finds an error in <code>buffer</code>, |
92 | * <code>*errorString</code> indicates the line number |
93 | * and type of error encountered. |
94 | * |
95 | * @result |
96 | * The recreated object, or <code>NULL</code> on failure. |
97 | * |
98 | * @discussion |
99 | * <b>Not safe</b> to call in a primary interrupt handler. |
100 | */ |
101 | extern "C++" OSPtr<OSObject> OSUnserializeXML( |
102 | const char * buffer, |
103 | size_t bufferSize, |
104 | OSString * *errorString = NULL); |
105 | |
106 | extern "C++" OSPtr<OSObject> OSUnserializeXML( |
107 | const char * buffer, |
108 | size_t bufferSize, |
109 | OSSharedPtr<OSString> &errorString); |
110 | |
111 | extern "C++" OSPtr<OSObject> |
112 | OSUnserializeBinary(const char *buffer, size_t bufferSize, OSString * *errorString); |
113 | |
114 | extern "C++" OSPtr<OSObject> |
115 | OSUnserializeBinary(const char *buffer, size_t bufferSize, OSSharedPtr<OSString>& errorString); |
116 | |
117 | #ifdef __APPLE_API_OBSOLETE |
118 | extern OSPtr<OSObject> OSUnserialize(const char *buffer, OSString * *errorString = NULL); |
119 | |
120 | extern OSPtr<OSObject> OSUnserialize(const char *buffer, OSSharedPtr<OSString>& errorString); |
121 | |
122 | #endif /* __APPLE_API_OBSOLETE */ |
123 | |
124 | #endif /* _OS_OSUNSERIALIZE_H */ |
125 | |