objc2_core_foundation/generated/
CFXMLParser.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7#[cfg(feature = "objc2")]
8use objc2::__framework_prelude::*;
9
10use crate::*;
11
12/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparser?language=objc)
13#[repr(C)]
14pub struct CFXMLParser {
15    inner: [u8; 0],
16    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
17}
18
19cf_type!(
20    unsafe impl CFXMLParser {}
21);
22#[cfg(feature = "objc2")]
23cf_objc2_type!(
24    unsafe impl RefEncode<"__CFXMLParser"> for CFXMLParser {}
25);
26
27/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparseroptions?language=objc)
28// NS_OPTIONS
29#[repr(transparent)]
30#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
31pub struct CFXMLParserOptions(pub CFOptionFlags);
32bitflags::bitflags! {
33    impl CFXMLParserOptions: CFOptionFlags {
34        #[doc(alias = "kCFXMLParserValidateDocument")]
35        const ValidateDocument = 1<<0;
36        #[doc(alias = "kCFXMLParserSkipMetaData")]
37        const SkipMetaData = 1<<1;
38        #[doc(alias = "kCFXMLParserReplacePhysicalEntities")]
39        const ReplacePhysicalEntities = 1<<2;
40        #[doc(alias = "kCFXMLParserSkipWhitespace")]
41        const SkipWhitespace = 1<<3;
42        #[doc(alias = "kCFXMLParserResolveExternalEntities")]
43        const ResolveExternalEntities = 1<<4;
44        #[doc(alias = "kCFXMLParserAddImpliedAttributes")]
45        const AddImpliedAttributes = 1<<5;
46        #[doc(alias = "kCFXMLParserAllOptions")]
47        const AllOptions = 0x00FFFFFF;
48        #[doc(alias = "kCFXMLParserNoOptions")]
49        const NoOptions = 0;
50    }
51}
52
53#[cfg(feature = "objc2")]
54unsafe impl Encode for CFXMLParserOptions {
55    const ENCODING: Encoding = CFOptionFlags::ENCODING;
56}
57
58#[cfg(feature = "objc2")]
59unsafe impl RefEncode for CFXMLParserOptions {
60    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
61}
62
63/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparserstatuscode?language=objc)
64// NS_OPTIONS
65#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct CFXMLParserStatusCode(pub CFIndex);
68bitflags::bitflags! {
69    impl CFXMLParserStatusCode: CFIndex {
70        #[doc(alias = "kCFXMLStatusParseNotBegun")]
71        const StatusParseNotBegun = -2;
72        #[doc(alias = "kCFXMLStatusParseInProgress")]
73        const StatusParseInProgress = -1;
74        #[doc(alias = "kCFXMLStatusParseSuccessful")]
75        const StatusParseSuccessful = 0;
76        #[doc(alias = "kCFXMLErrorUnexpectedEOF")]
77        const ErrorUnexpectedEOF = 1;
78        #[doc(alias = "kCFXMLErrorUnknownEncoding")]
79        const ErrorUnknownEncoding = 2;
80        #[doc(alias = "kCFXMLErrorEncodingConversionFailure")]
81        const ErrorEncodingConversionFailure = 3;
82        #[doc(alias = "kCFXMLErrorMalformedProcessingInstruction")]
83        const ErrorMalformedProcessingInstruction = 4;
84        #[doc(alias = "kCFXMLErrorMalformedDTD")]
85        const ErrorMalformedDTD = 5;
86        #[doc(alias = "kCFXMLErrorMalformedName")]
87        const ErrorMalformedName = 6;
88        #[doc(alias = "kCFXMLErrorMalformedCDSect")]
89        const ErrorMalformedCDSect = 7;
90        #[doc(alias = "kCFXMLErrorMalformedCloseTag")]
91        const ErrorMalformedCloseTag = 8;
92        #[doc(alias = "kCFXMLErrorMalformedStartTag")]
93        const ErrorMalformedStartTag = 9;
94        #[doc(alias = "kCFXMLErrorMalformedDocument")]
95        const ErrorMalformedDocument = 10;
96        #[doc(alias = "kCFXMLErrorElementlessDocument")]
97        const ErrorElementlessDocument = 11;
98        #[doc(alias = "kCFXMLErrorMalformedComment")]
99        const ErrorMalformedComment = 12;
100        #[doc(alias = "kCFXMLErrorMalformedCharacterReference")]
101        const ErrorMalformedCharacterReference = 13;
102        #[doc(alias = "kCFXMLErrorMalformedParsedCharacterData")]
103        const ErrorMalformedParsedCharacterData = 14;
104        #[doc(alias = "kCFXMLErrorNoData")]
105        const ErrorNoData = 15;
106    }
107}
108
109#[cfg(feature = "objc2")]
110unsafe impl Encode for CFXMLParserStatusCode {
111    const ENCODING: Encoding = CFIndex::ENCODING;
112}
113
114#[cfg(feature = "objc2")]
115unsafe impl RefEncode for CFXMLParserStatusCode {
116    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
117}
118
119/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparsercreatexmlstructurecallback?language=objc)
120#[cfg(feature = "CFXMLNode")]
121pub type CFXMLParserCreateXMLStructureCallBack = Option<
122    unsafe extern "C-unwind" fn(*mut CFXMLParser, *const CFXMLNode, *mut c_void) -> *mut c_void,
123>;
124
125/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparseraddchildcallback?language=objc)
126pub type CFXMLParserAddChildCallBack =
127    Option<unsafe extern "C-unwind" fn(*mut CFXMLParser, *mut c_void, *mut c_void, *mut c_void)>;
128
129/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparserendxmlstructurecallback?language=objc)
130pub type CFXMLParserEndXMLStructureCallBack =
131    Option<unsafe extern "C-unwind" fn(*mut CFXMLParser, *mut c_void, *mut c_void)>;
132
133/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparserresolveexternalentitycallback?language=objc)
134#[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
135pub type CFXMLParserResolveExternalEntityCallBack = Option<
136    unsafe extern "C-unwind" fn(
137        *mut CFXMLParser,
138        *mut CFXMLExternalID,
139        *mut c_void,
140    ) -> *const CFData,
141>;
142
143/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparserhandleerrorcallback?language=objc)
144pub type CFXMLParserHandleErrorCallBack = Option<
145    unsafe extern "C-unwind" fn(*mut CFXMLParser, CFXMLParserStatusCode, *mut c_void) -> Boolean,
146>;
147
148/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparsercallbacks?language=objc)
149#[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
150#[repr(C)]
151#[derive(Clone, Copy, Debug, PartialEq)]
152pub struct CFXMLParserCallBacks {
153    pub version: CFIndex,
154    pub createXMLStructure: CFXMLParserCreateXMLStructureCallBack,
155    pub addChild: CFXMLParserAddChildCallBack,
156    pub endXMLStructure: CFXMLParserEndXMLStructureCallBack,
157    pub resolveExternalEntity: CFXMLParserResolveExternalEntityCallBack,
158    pub handleError: CFXMLParserHandleErrorCallBack,
159}
160
161#[cfg(all(
162    feature = "CFData",
163    feature = "CFURL",
164    feature = "CFXMLNode",
165    feature = "objc2"
166))]
167unsafe impl Encode for CFXMLParserCallBacks {
168    const ENCODING: Encoding = Encoding::Struct(
169        "?",
170        &[
171            <CFIndex>::ENCODING,
172            <CFXMLParserCreateXMLStructureCallBack>::ENCODING,
173            <CFXMLParserAddChildCallBack>::ENCODING,
174            <CFXMLParserEndXMLStructureCallBack>::ENCODING,
175            <CFXMLParserResolveExternalEntityCallBack>::ENCODING,
176            <CFXMLParserHandleErrorCallBack>::ENCODING,
177        ],
178    );
179}
180
181#[cfg(all(
182    feature = "CFData",
183    feature = "CFURL",
184    feature = "CFXMLNode",
185    feature = "objc2"
186))]
187unsafe impl RefEncode for CFXMLParserCallBacks {
188    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
189}
190
191/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparserretaincallback?language=objc)
192pub type CFXMLParserRetainCallBack =
193    Option<unsafe extern "C-unwind" fn(*const c_void) -> *const c_void>;
194
195/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparserreleasecallback?language=objc)
196pub type CFXMLParserReleaseCallBack = Option<unsafe extern "C-unwind" fn(*const c_void)>;
197
198/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparsercopydescriptioncallback?language=objc)
199pub type CFXMLParserCopyDescriptionCallBack =
200    Option<unsafe extern "C-unwind" fn(*const c_void) -> *const CFString>;
201
202/// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/cfxmlparsercontext?language=objc)
203#[repr(C)]
204#[derive(Clone, Copy, Debug, PartialEq)]
205pub struct CFXMLParserContext {
206    pub version: CFIndex,
207    pub info: *mut c_void,
208    pub retain: CFXMLParserRetainCallBack,
209    pub release: CFXMLParserReleaseCallBack,
210    pub copyDescription: CFXMLParserCopyDescriptionCallBack,
211}
212
213#[cfg(feature = "objc2")]
214unsafe impl Encode for CFXMLParserContext {
215    const ENCODING: Encoding = Encoding::Struct(
216        "?",
217        &[
218            <CFIndex>::ENCODING,
219            <*mut c_void>::ENCODING,
220            <CFXMLParserRetainCallBack>::ENCODING,
221            <CFXMLParserReleaseCallBack>::ENCODING,
222            <CFXMLParserCopyDescriptionCallBack>::ENCODING,
223        ],
224    );
225}
226
227#[cfg(feature = "objc2")]
228unsafe impl RefEncode for CFXMLParserContext {
229    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
230}
231
232unsafe impl ConcreteType for CFXMLParser {
233    #[doc(alias = "CFXMLParserGetTypeID")]
234    #[inline]
235    fn type_id() -> CFTypeID {
236        extern "C-unwind" {
237            fn CFXMLParserGetTypeID() -> CFTypeID;
238        }
239        unsafe { CFXMLParserGetTypeID() }
240    }
241}
242
243impl CFXMLParser {
244    #[doc(alias = "CFXMLParserCreate")]
245    #[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
246    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
247    #[inline]
248    pub unsafe fn new(
249        allocator: Option<&CFAllocator>,
250        xml_data: Option<&CFData>,
251        data_source: Option<&CFURL>,
252        parse_options: CFOptionFlags,
253        version_of_nodes: CFIndex,
254        call_backs: *mut CFXMLParserCallBacks,
255        context: *mut CFXMLParserContext,
256    ) -> Option<CFRetained<CFXMLParser>> {
257        extern "C-unwind" {
258            fn CFXMLParserCreate(
259                allocator: Option<&CFAllocator>,
260                xml_data: Option<&CFData>,
261                data_source: Option<&CFURL>,
262                parse_options: CFOptionFlags,
263                version_of_nodes: CFIndex,
264                call_backs: *mut CFXMLParserCallBacks,
265                context: *mut CFXMLParserContext,
266            ) -> Option<NonNull<CFXMLParser>>;
267        }
268        let ret = unsafe {
269            CFXMLParserCreate(
270                allocator,
271                xml_data,
272                data_source,
273                parse_options,
274                version_of_nodes,
275                call_backs,
276                context,
277            )
278        };
279        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
280    }
281
282    #[doc(alias = "CFXMLParserCreateWithDataFromURL")]
283    #[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
284    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
285    #[inline]
286    pub unsafe fn with_data_from_url(
287        allocator: Option<&CFAllocator>,
288        data_source: Option<&CFURL>,
289        parse_options: CFOptionFlags,
290        version_of_nodes: CFIndex,
291        call_backs: *mut CFXMLParserCallBacks,
292        context: *mut CFXMLParserContext,
293    ) -> Option<CFRetained<CFXMLParser>> {
294        extern "C-unwind" {
295            fn CFXMLParserCreateWithDataFromURL(
296                allocator: Option<&CFAllocator>,
297                data_source: Option<&CFURL>,
298                parse_options: CFOptionFlags,
299                version_of_nodes: CFIndex,
300                call_backs: *mut CFXMLParserCallBacks,
301                context: *mut CFXMLParserContext,
302            ) -> Option<NonNull<CFXMLParser>>;
303        }
304        let ret = unsafe {
305            CFXMLParserCreateWithDataFromURL(
306                allocator,
307                data_source,
308                parse_options,
309                version_of_nodes,
310                call_backs,
311                context,
312            )
313        };
314        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
315    }
316
317    #[doc(alias = "CFXMLParserGetContext")]
318    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
319    #[inline]
320    pub unsafe fn context(self: &CFXMLParser, context: *mut CFXMLParserContext) {
321        extern "C-unwind" {
322            fn CFXMLParserGetContext(parser: &CFXMLParser, context: *mut CFXMLParserContext);
323        }
324        unsafe { CFXMLParserGetContext(self, context) }
325    }
326
327    #[doc(alias = "CFXMLParserGetCallBacks")]
328    #[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
329    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
330    #[inline]
331    pub unsafe fn call_backs(self: &CFXMLParser, call_backs: *mut CFXMLParserCallBacks) {
332        extern "C-unwind" {
333            fn CFXMLParserGetCallBacks(parser: &CFXMLParser, call_backs: *mut CFXMLParserCallBacks);
334        }
335        unsafe { CFXMLParserGetCallBacks(self, call_backs) }
336    }
337
338    #[doc(alias = "CFXMLParserGetSourceURL")]
339    #[cfg(feature = "CFURL")]
340    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
341    #[inline]
342    pub unsafe fn source_url(self: &CFXMLParser) -> Option<CFRetained<CFURL>> {
343        extern "C-unwind" {
344            fn CFXMLParserGetSourceURL(parser: &CFXMLParser) -> Option<NonNull<CFURL>>;
345        }
346        let ret = unsafe { CFXMLParserGetSourceURL(self) };
347        ret.map(|ret| unsafe { CFRetained::retain(ret) })
348    }
349
350    #[doc(alias = "CFXMLParserGetLocation")]
351    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
352    #[inline]
353    pub unsafe fn location(self: &CFXMLParser) -> CFIndex {
354        extern "C-unwind" {
355            fn CFXMLParserGetLocation(parser: &CFXMLParser) -> CFIndex;
356        }
357        unsafe { CFXMLParserGetLocation(self) }
358    }
359
360    #[doc(alias = "CFXMLParserGetLineNumber")]
361    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
362    #[inline]
363    pub unsafe fn line_number(self: &CFXMLParser) -> CFIndex {
364        extern "C-unwind" {
365            fn CFXMLParserGetLineNumber(parser: &CFXMLParser) -> CFIndex;
366        }
367        unsafe { CFXMLParserGetLineNumber(self) }
368    }
369
370    #[doc(alias = "CFXMLParserGetDocument")]
371    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
372    #[inline]
373    pub unsafe fn document(self: &CFXMLParser) -> *mut c_void {
374        extern "C-unwind" {
375            fn CFXMLParserGetDocument(parser: &CFXMLParser) -> *mut c_void;
376        }
377        unsafe { CFXMLParserGetDocument(self) }
378    }
379
380    #[doc(alias = "CFXMLParserGetStatusCode")]
381    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
382    #[inline]
383    pub unsafe fn status_code(self: &CFXMLParser) -> CFXMLParserStatusCode {
384        extern "C-unwind" {
385            fn CFXMLParserGetStatusCode(parser: &CFXMLParser) -> CFXMLParserStatusCode;
386        }
387        unsafe { CFXMLParserGetStatusCode(self) }
388    }
389
390    #[doc(alias = "CFXMLParserCopyErrorDescription")]
391    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
392    #[inline]
393    pub unsafe fn error_description(self: &CFXMLParser) -> Option<CFRetained<CFString>> {
394        extern "C-unwind" {
395            fn CFXMLParserCopyErrorDescription(parser: &CFXMLParser) -> Option<NonNull<CFString>>;
396        }
397        let ret = unsafe { CFXMLParserCopyErrorDescription(self) };
398        ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
399    }
400
401    #[doc(alias = "CFXMLParserAbort")]
402    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
403    #[inline]
404    pub unsafe fn abort(
405        self: &CFXMLParser,
406        error_code: CFXMLParserStatusCode,
407        error_description: Option<&CFString>,
408    ) {
409        extern "C-unwind" {
410            fn CFXMLParserAbort(
411                parser: &CFXMLParser,
412                error_code: CFXMLParserStatusCode,
413                error_description: Option<&CFString>,
414            );
415        }
416        unsafe { CFXMLParserAbort(self, error_code, error_description) }
417    }
418
419    #[doc(alias = "CFXMLParserParse")]
420    #[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
421    #[inline]
422    pub unsafe fn parse(self: &CFXMLParser) -> bool {
423        extern "C-unwind" {
424            fn CFXMLParserParse(parser: &CFXMLParser) -> Boolean;
425        }
426        let ret = unsafe { CFXMLParserParse(self) };
427        ret != 0
428    }
429}
430
431#[cfg(all(
432    feature = "CFData",
433    feature = "CFTree",
434    feature = "CFURL",
435    feature = "CFXMLNode"
436))]
437#[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
438#[inline]
439pub unsafe extern "C-unwind" fn CFXMLTreeCreateFromData(
440    allocator: Option<&CFAllocator>,
441    xml_data: Option<&CFData>,
442    data_source: Option<&CFURL>,
443    parse_options: CFOptionFlags,
444    version_of_nodes: CFIndex,
445) -> Option<CFRetained<CFXMLTree>> {
446    extern "C-unwind" {
447        fn CFXMLTreeCreateFromData(
448            allocator: Option<&CFAllocator>,
449            xml_data: Option<&CFData>,
450            data_source: Option<&CFURL>,
451            parse_options: CFOptionFlags,
452            version_of_nodes: CFIndex,
453        ) -> Option<NonNull<CFXMLTree>>;
454    }
455    let ret = unsafe {
456        CFXMLTreeCreateFromData(
457            allocator,
458            xml_data,
459            data_source,
460            parse_options,
461            version_of_nodes,
462        )
463    };
464    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
465}
466
467#[cfg(all(
468    feature = "CFData",
469    feature = "CFDictionary",
470    feature = "CFTree",
471    feature = "CFURL",
472    feature = "CFXMLNode"
473))]
474#[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
475#[inline]
476pub unsafe extern "C-unwind" fn CFXMLTreeCreateFromDataWithError(
477    allocator: Option<&CFAllocator>,
478    xml_data: Option<&CFData>,
479    data_source: Option<&CFURL>,
480    parse_options: CFOptionFlags,
481    version_of_nodes: CFIndex,
482    error_dict: *mut *const CFDictionary,
483) -> Option<CFRetained<CFXMLTree>> {
484    extern "C-unwind" {
485        fn CFXMLTreeCreateFromDataWithError(
486            allocator: Option<&CFAllocator>,
487            xml_data: Option<&CFData>,
488            data_source: Option<&CFURL>,
489            parse_options: CFOptionFlags,
490            version_of_nodes: CFIndex,
491            error_dict: *mut *const CFDictionary,
492        ) -> Option<NonNull<CFXMLTree>>;
493    }
494    let ret = unsafe {
495        CFXMLTreeCreateFromDataWithError(
496            allocator,
497            xml_data,
498            data_source,
499            parse_options,
500            version_of_nodes,
501            error_dict,
502        )
503    };
504    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
505}
506
507#[cfg(all(feature = "CFTree", feature = "CFURL", feature = "CFXMLNode"))]
508#[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
509#[inline]
510pub unsafe extern "C-unwind" fn CFXMLTreeCreateWithDataFromURL(
511    allocator: Option<&CFAllocator>,
512    data_source: Option<&CFURL>,
513    parse_options: CFOptionFlags,
514    version_of_nodes: CFIndex,
515) -> Option<CFRetained<CFXMLTree>> {
516    extern "C-unwind" {
517        fn CFXMLTreeCreateWithDataFromURL(
518            allocator: Option<&CFAllocator>,
519            data_source: Option<&CFURL>,
520            parse_options: CFOptionFlags,
521            version_of_nodes: CFIndex,
522        ) -> Option<NonNull<CFXMLTree>>;
523    }
524    let ret = unsafe {
525        CFXMLTreeCreateWithDataFromURL(allocator, data_source, parse_options, version_of_nodes)
526    };
527    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
528}
529
530#[cfg(all(feature = "CFData", feature = "CFTree", feature = "CFXMLNode"))]
531#[deprecated = "CFXMLParser is deprecated, use NSXMLParser, NSXMLDocument or libxml2 library instead"]
532#[inline]
533pub unsafe extern "C-unwind" fn CFXMLTreeCreateXMLData(
534    allocator: Option<&CFAllocator>,
535    xml_tree: Option<&CFXMLTree>,
536) -> Option<CFRetained<CFData>> {
537    extern "C-unwind" {
538        fn CFXMLTreeCreateXMLData(
539            allocator: Option<&CFAllocator>,
540            xml_tree: Option<&CFXMLTree>,
541        ) -> Option<NonNull<CFData>>;
542    }
543    let ret = unsafe { CFXMLTreeCreateXMLData(allocator, xml_tree) };
544    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
545}
546
547#[cfg(feature = "CFDictionary")]
548#[inline]
549pub unsafe extern "C-unwind" fn CFXMLCreateStringByEscapingEntities(
550    allocator: Option<&CFAllocator>,
551    string: Option<&CFString>,
552    entities_dictionary: Option<&CFDictionary>,
553) -> Option<CFRetained<CFString>> {
554    extern "C-unwind" {
555        fn CFXMLCreateStringByEscapingEntities(
556            allocator: Option<&CFAllocator>,
557            string: Option<&CFString>,
558            entities_dictionary: Option<&CFDictionary>,
559        ) -> Option<NonNull<CFString>>;
560    }
561    let ret =
562        unsafe { CFXMLCreateStringByEscapingEntities(allocator, string, entities_dictionary) };
563    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
564}
565
566#[cfg(feature = "CFDictionary")]
567#[inline]
568pub unsafe extern "C-unwind" fn CFXMLCreateStringByUnescapingEntities(
569    allocator: Option<&CFAllocator>,
570    string: Option<&CFString>,
571    entities_dictionary: Option<&CFDictionary>,
572) -> Option<CFRetained<CFString>> {
573    extern "C-unwind" {
574        fn CFXMLCreateStringByUnescapingEntities(
575            allocator: Option<&CFAllocator>,
576            string: Option<&CFString>,
577            entities_dictionary: Option<&CFDictionary>,
578        ) -> Option<NonNull<CFString>>;
579    }
580    let ret =
581        unsafe { CFXMLCreateStringByUnescapingEntities(allocator, string, entities_dictionary) };
582    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
583}
584
585extern "C" {
586    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfxmltreeerrordescription?language=objc)
587    pub static kCFXMLTreeErrorDescription: Option<&'static CFString>;
588}
589
590extern "C" {
591    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfxmltreeerrorlinenumber?language=objc)
592    pub static kCFXMLTreeErrorLineNumber: Option<&'static CFString>;
593}
594
595extern "C" {
596    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfxmltreeerrorlocation?language=objc)
597    pub static kCFXMLTreeErrorLocation: Option<&'static CFString>;
598}
599
600extern "C" {
601    /// [Apple's documentation](https://developer.apple.com/documentation/corefoundation/kcfxmltreeerrorstatuscode?language=objc)
602    pub static kCFXMLTreeErrorStatusCode: Option<&'static CFString>;
603}
604
605#[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
606#[deprecated = "renamed to `CFXMLParser::new`"]
607#[inline]
608pub unsafe extern "C-unwind" fn CFXMLParserCreate(
609    allocator: Option<&CFAllocator>,
610    xml_data: Option<&CFData>,
611    data_source: Option<&CFURL>,
612    parse_options: CFOptionFlags,
613    version_of_nodes: CFIndex,
614    call_backs: *mut CFXMLParserCallBacks,
615    context: *mut CFXMLParserContext,
616) -> Option<CFRetained<CFXMLParser>> {
617    extern "C-unwind" {
618        fn CFXMLParserCreate(
619            allocator: Option<&CFAllocator>,
620            xml_data: Option<&CFData>,
621            data_source: Option<&CFURL>,
622            parse_options: CFOptionFlags,
623            version_of_nodes: CFIndex,
624            call_backs: *mut CFXMLParserCallBacks,
625            context: *mut CFXMLParserContext,
626        ) -> Option<NonNull<CFXMLParser>>;
627    }
628    let ret = unsafe {
629        CFXMLParserCreate(
630            allocator,
631            xml_data,
632            data_source,
633            parse_options,
634            version_of_nodes,
635            call_backs,
636            context,
637        )
638    };
639    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
640}
641
642#[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
643#[deprecated = "renamed to `CFXMLParser::with_data_from_url`"]
644#[inline]
645pub unsafe extern "C-unwind" fn CFXMLParserCreateWithDataFromURL(
646    allocator: Option<&CFAllocator>,
647    data_source: Option<&CFURL>,
648    parse_options: CFOptionFlags,
649    version_of_nodes: CFIndex,
650    call_backs: *mut CFXMLParserCallBacks,
651    context: *mut CFXMLParserContext,
652) -> Option<CFRetained<CFXMLParser>> {
653    extern "C-unwind" {
654        fn CFXMLParserCreateWithDataFromURL(
655            allocator: Option<&CFAllocator>,
656            data_source: Option<&CFURL>,
657            parse_options: CFOptionFlags,
658            version_of_nodes: CFIndex,
659            call_backs: *mut CFXMLParserCallBacks,
660            context: *mut CFXMLParserContext,
661        ) -> Option<NonNull<CFXMLParser>>;
662    }
663    let ret = unsafe {
664        CFXMLParserCreateWithDataFromURL(
665            allocator,
666            data_source,
667            parse_options,
668            version_of_nodes,
669            call_backs,
670            context,
671        )
672    };
673    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
674}
675
676extern "C-unwind" {
677    #[deprecated = "renamed to `CFXMLParser::context`"]
678    pub fn CFXMLParserGetContext(parser: &CFXMLParser, context: *mut CFXMLParserContext);
679}
680
681extern "C-unwind" {
682    #[cfg(all(feature = "CFData", feature = "CFURL", feature = "CFXMLNode"))]
683    #[deprecated = "renamed to `CFXMLParser::call_backs`"]
684    pub fn CFXMLParserGetCallBacks(parser: &CFXMLParser, call_backs: *mut CFXMLParserCallBacks);
685}
686
687#[cfg(feature = "CFURL")]
688#[deprecated = "renamed to `CFXMLParser::source_url`"]
689#[inline]
690pub unsafe extern "C-unwind" fn CFXMLParserGetSourceURL(
691    parser: &CFXMLParser,
692) -> Option<CFRetained<CFURL>> {
693    extern "C-unwind" {
694        fn CFXMLParserGetSourceURL(parser: &CFXMLParser) -> Option<NonNull<CFURL>>;
695    }
696    let ret = unsafe { CFXMLParserGetSourceURL(parser) };
697    ret.map(|ret| unsafe { CFRetained::retain(ret) })
698}
699
700extern "C-unwind" {
701    #[deprecated = "renamed to `CFXMLParser::location`"]
702    pub fn CFXMLParserGetLocation(parser: &CFXMLParser) -> CFIndex;
703}
704
705extern "C-unwind" {
706    #[deprecated = "renamed to `CFXMLParser::line_number`"]
707    pub fn CFXMLParserGetLineNumber(parser: &CFXMLParser) -> CFIndex;
708}
709
710extern "C-unwind" {
711    #[deprecated = "renamed to `CFXMLParser::document`"]
712    pub fn CFXMLParserGetDocument(parser: &CFXMLParser) -> *mut c_void;
713}
714
715extern "C-unwind" {
716    #[deprecated = "renamed to `CFXMLParser::status_code`"]
717    pub fn CFXMLParserGetStatusCode(parser: &CFXMLParser) -> CFXMLParserStatusCode;
718}
719
720#[deprecated = "renamed to `CFXMLParser::error_description`"]
721#[inline]
722pub unsafe extern "C-unwind" fn CFXMLParserCopyErrorDescription(
723    parser: &CFXMLParser,
724) -> Option<CFRetained<CFString>> {
725    extern "C-unwind" {
726        fn CFXMLParserCopyErrorDescription(parser: &CFXMLParser) -> Option<NonNull<CFString>>;
727    }
728    let ret = unsafe { CFXMLParserCopyErrorDescription(parser) };
729    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
730}
731
732extern "C-unwind" {
733    #[deprecated = "renamed to `CFXMLParser::abort`"]
734    pub fn CFXMLParserAbort(
735        parser: &CFXMLParser,
736        error_code: CFXMLParserStatusCode,
737        error_description: Option<&CFString>,
738    );
739}
740
741#[deprecated = "renamed to `CFXMLParser::parse`"]
742#[inline]
743pub unsafe extern "C-unwind" fn CFXMLParserParse(parser: &CFXMLParser) -> bool {
744    extern "C-unwind" {
745        fn CFXMLParserParse(parser: &CFXMLParser) -> Boolean;
746    }
747    let ret = unsafe { CFXMLParserParse(parser) };
748    ret != 0
749}