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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;

use crate::*;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSXMLParserExternalEntityResolvingPolicy(pub NSUInteger);
impl NSXMLParserExternalEntityResolvingPolicy {
    pub const NSXMLParserResolveExternalEntitiesNever: Self = Self(0);
    pub const NSXMLParserResolveExternalEntitiesNoNetwork: Self = Self(1);
    pub const NSXMLParserResolveExternalEntitiesSameOriginOnly: Self = Self(2);
    pub const NSXMLParserResolveExternalEntitiesAlways: Self = Self(3);
}

unsafe impl Encode for NSXMLParserExternalEntityResolvingPolicy {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSXMLParserExternalEntityResolvingPolicy {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSXMLParser;

    unsafe impl ClassType for NSXMLParser {
        type Super = NSObject;
        type Mutability = InteriorMutable;
    }
);

unsafe impl NSObjectProtocol for NSXMLParser {}

extern_methods!(
    unsafe impl NSXMLParser {
        #[cfg(feature = "NSURL")]
        #[method_id(@__retain_semantics Init initWithContentsOfURL:)]
        pub unsafe fn initWithContentsOfURL(
            this: Allocated<Self>,
            url: &NSURL,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSData")]
        #[method_id(@__retain_semantics Init initWithData:)]
        pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Retained<Self>;

        #[cfg(feature = "NSStream")]
        #[method_id(@__retain_semantics Init initWithStream:)]
        pub unsafe fn initWithStream(
            this: Allocated<Self>,
            stream: &NSInputStream,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSXMLParserDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(
            &self,
            delegate: Option<&ProtocolObject<dyn NSXMLParserDelegate>>,
        );

        #[method(shouldProcessNamespaces)]
        pub unsafe fn shouldProcessNamespaces(&self) -> bool;

        #[method(setShouldProcessNamespaces:)]
        pub unsafe fn setShouldProcessNamespaces(&self, should_process_namespaces: bool);

        #[method(shouldReportNamespacePrefixes)]
        pub unsafe fn shouldReportNamespacePrefixes(&self) -> bool;

        #[method(setShouldReportNamespacePrefixes:)]
        pub unsafe fn setShouldReportNamespacePrefixes(
            &self,
            should_report_namespace_prefixes: bool,
        );

        #[method(externalEntityResolvingPolicy)]
        pub unsafe fn externalEntityResolvingPolicy(
            &self,
        ) -> NSXMLParserExternalEntityResolvingPolicy;

        #[method(setExternalEntityResolvingPolicy:)]
        pub unsafe fn setExternalEntityResolvingPolicy(
            &self,
            external_entity_resolving_policy: NSXMLParserExternalEntityResolvingPolicy,
        );

        #[cfg(all(feature = "NSSet", feature = "NSURL"))]
        #[method_id(@__retain_semantics Other allowedExternalEntityURLs)]
        pub unsafe fn allowedExternalEntityURLs(&self) -> Option<Retained<NSSet<NSURL>>>;

        #[cfg(all(feature = "NSSet", feature = "NSURL"))]
        #[method(setAllowedExternalEntityURLs:)]
        pub unsafe fn setAllowedExternalEntityURLs(
            &self,
            allowed_external_entity_ur_ls: Option<&NSSet<NSURL>>,
        );

        #[method(parse)]
        pub unsafe fn parse(&self) -> bool;

        #[method(abortParsing)]
        pub unsafe fn abortParsing(&self);

        #[cfg(feature = "NSError")]
        #[method_id(@__retain_semantics Other parserError)]
        pub unsafe fn parserError(&self) -> Option<Retained<NSError>>;

        #[method(shouldResolveExternalEntities)]
        pub unsafe fn shouldResolveExternalEntities(&self) -> bool;

        #[method(setShouldResolveExternalEntities:)]
        pub unsafe fn setShouldResolveExternalEntities(
            &self,
            should_resolve_external_entities: bool,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSXMLParser {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);

extern_methods!(
    /// NSXMLParserLocatorAdditions
    unsafe impl NSXMLParser {
        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other publicID)]
        pub unsafe fn publicID(&self) -> Option<Retained<NSString>>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other systemID)]
        pub unsafe fn systemID(&self) -> Option<Retained<NSString>>;

        #[method(lineNumber)]
        pub unsafe fn lineNumber(&self) -> NSInteger;

        #[method(columnNumber)]
        pub unsafe fn columnNumber(&self) -> NSInteger;
    }
);

extern_protocol!(
    pub unsafe trait NSXMLParserDelegate: NSObjectProtocol {
        #[optional]
        #[method(parserDidStartDocument:)]
        unsafe fn parserDidStartDocument(&self, parser: &NSXMLParser);

        #[optional]
        #[method(parserDidEndDocument:)]
        unsafe fn parserDidEndDocument(&self, parser: &NSXMLParser);

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundNotationDeclarationWithName:publicID:systemID:)]
        unsafe fn parser_foundNotationDeclarationWithName_publicID_systemID(
            &self,
            parser: &NSXMLParser,
            name: &NSString,
            public_id: Option<&NSString>,
            system_id: Option<&NSString>,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundUnparsedEntityDeclarationWithName:publicID:systemID:notationName:)]
        unsafe fn parser_foundUnparsedEntityDeclarationWithName_publicID_systemID_notationName(
            &self,
            parser: &NSXMLParser,
            name: &NSString,
            public_id: Option<&NSString>,
            system_id: Option<&NSString>,
            notation_name: Option<&NSString>,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundAttributeDeclarationWithName:forElement:type:defaultValue:)]
        unsafe fn parser_foundAttributeDeclarationWithName_forElement_type_defaultValue(
            &self,
            parser: &NSXMLParser,
            attribute_name: &NSString,
            element_name: &NSString,
            r#type: Option<&NSString>,
            default_value: Option<&NSString>,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundElementDeclarationWithName:model:)]
        unsafe fn parser_foundElementDeclarationWithName_model(
            &self,
            parser: &NSXMLParser,
            element_name: &NSString,
            model: &NSString,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundInternalEntityDeclarationWithName:value:)]
        unsafe fn parser_foundInternalEntityDeclarationWithName_value(
            &self,
            parser: &NSXMLParser,
            name: &NSString,
            value: Option<&NSString>,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundExternalEntityDeclarationWithName:publicID:systemID:)]
        unsafe fn parser_foundExternalEntityDeclarationWithName_publicID_systemID(
            &self,
            parser: &NSXMLParser,
            name: &NSString,
            public_id: Option<&NSString>,
            system_id: Option<&NSString>,
        );

        #[cfg(all(feature = "NSDictionary", feature = "NSString"))]
        #[optional]
        #[method(parser:didStartElement:namespaceURI:qualifiedName:attributes:)]
        unsafe fn parser_didStartElement_namespaceURI_qualifiedName_attributes(
            &self,
            parser: &NSXMLParser,
            element_name: &NSString,
            namespace_uri: Option<&NSString>,
            q_name: Option<&NSString>,
            attribute_dict: &NSDictionary<NSString, NSString>,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:didEndElement:namespaceURI:qualifiedName:)]
        unsafe fn parser_didEndElement_namespaceURI_qualifiedName(
            &self,
            parser: &NSXMLParser,
            element_name: &NSString,
            namespace_uri: Option<&NSString>,
            q_name: Option<&NSString>,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:didStartMappingPrefix:toURI:)]
        unsafe fn parser_didStartMappingPrefix_toURI(
            &self,
            parser: &NSXMLParser,
            prefix: &NSString,
            namespace_uri: &NSString,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:didEndMappingPrefix:)]
        unsafe fn parser_didEndMappingPrefix(&self, parser: &NSXMLParser, prefix: &NSString);

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundCharacters:)]
        unsafe fn parser_foundCharacters(&self, parser: &NSXMLParser, string: &NSString);

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundIgnorableWhitespace:)]
        unsafe fn parser_foundIgnorableWhitespace(
            &self,
            parser: &NSXMLParser,
            whitespace_string: &NSString,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundProcessingInstructionWithTarget:data:)]
        unsafe fn parser_foundProcessingInstructionWithTarget_data(
            &self,
            parser: &NSXMLParser,
            target: &NSString,
            data: Option<&NSString>,
        );

        #[cfg(feature = "NSString")]
        #[optional]
        #[method(parser:foundComment:)]
        unsafe fn parser_foundComment(&self, parser: &NSXMLParser, comment: &NSString);

        #[cfg(feature = "NSData")]
        #[optional]
        #[method(parser:foundCDATA:)]
        unsafe fn parser_foundCDATA(&self, parser: &NSXMLParser, cdata_block: &NSData);

        #[cfg(all(feature = "NSData", feature = "NSString"))]
        #[optional]
        #[method_id(@__retain_semantics Other parser:resolveExternalEntityName:systemID:)]
        unsafe fn parser_resolveExternalEntityName_systemID(
            &self,
            parser: &NSXMLParser,
            name: &NSString,
            system_id: Option<&NSString>,
        ) -> Option<Retained<NSData>>;

        #[cfg(feature = "NSError")]
        #[optional]
        #[method(parser:parseErrorOccurred:)]
        unsafe fn parser_parseErrorOccurred(&self, parser: &NSXMLParser, parse_error: &NSError);

        #[cfg(feature = "NSError")]
        #[optional]
        #[method(parser:validationErrorOccurred:)]
        unsafe fn parser_validationErrorOccurred(
            &self,
            parser: &NSXMLParser,
            validation_error: &NSError,
        );
    }

    unsafe impl ProtocolType for dyn NSXMLParserDelegate {}
);

extern "C" {
    #[cfg(all(feature = "NSError", feature = "NSString"))]
    pub static NSXMLParserErrorDomain: &'static NSErrorDomain;
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSXMLParserError(pub NSInteger);
impl NSXMLParserError {
    pub const NSXMLParserInternalError: Self = Self(1);
    pub const NSXMLParserOutOfMemoryError: Self = Self(2);
    pub const NSXMLParserDocumentStartError: Self = Self(3);
    pub const NSXMLParserEmptyDocumentError: Self = Self(4);
    pub const NSXMLParserPrematureDocumentEndError: Self = Self(5);
    pub const NSXMLParserInvalidHexCharacterRefError: Self = Self(6);
    pub const NSXMLParserInvalidDecimalCharacterRefError: Self = Self(7);
    pub const NSXMLParserInvalidCharacterRefError: Self = Self(8);
    pub const NSXMLParserInvalidCharacterError: Self = Self(9);
    pub const NSXMLParserCharacterRefAtEOFError: Self = Self(10);
    pub const NSXMLParserCharacterRefInPrologError: Self = Self(11);
    pub const NSXMLParserCharacterRefInEpilogError: Self = Self(12);
    pub const NSXMLParserCharacterRefInDTDError: Self = Self(13);
    pub const NSXMLParserEntityRefAtEOFError: Self = Self(14);
    pub const NSXMLParserEntityRefInPrologError: Self = Self(15);
    pub const NSXMLParserEntityRefInEpilogError: Self = Self(16);
    pub const NSXMLParserEntityRefInDTDError: Self = Self(17);
    pub const NSXMLParserParsedEntityRefAtEOFError: Self = Self(18);
    pub const NSXMLParserParsedEntityRefInPrologError: Self = Self(19);
    pub const NSXMLParserParsedEntityRefInEpilogError: Self = Self(20);
    pub const NSXMLParserParsedEntityRefInInternalSubsetError: Self = Self(21);
    pub const NSXMLParserEntityReferenceWithoutNameError: Self = Self(22);
    pub const NSXMLParserEntityReferenceMissingSemiError: Self = Self(23);
    pub const NSXMLParserParsedEntityRefNoNameError: Self = Self(24);
    pub const NSXMLParserParsedEntityRefMissingSemiError: Self = Self(25);
    pub const NSXMLParserUndeclaredEntityError: Self = Self(26);
    pub const NSXMLParserUnparsedEntityError: Self = Self(28);
    pub const NSXMLParserEntityIsExternalError: Self = Self(29);
    pub const NSXMLParserEntityIsParameterError: Self = Self(30);
    pub const NSXMLParserUnknownEncodingError: Self = Self(31);
    pub const NSXMLParserEncodingNotSupportedError: Self = Self(32);
    pub const NSXMLParserStringNotStartedError: Self = Self(33);
    pub const NSXMLParserStringNotClosedError: Self = Self(34);
    pub const NSXMLParserNamespaceDeclarationError: Self = Self(35);
    pub const NSXMLParserEntityNotStartedError: Self = Self(36);
    pub const NSXMLParserEntityNotFinishedError: Self = Self(37);
    pub const NSXMLParserLessThanSymbolInAttributeError: Self = Self(38);
    pub const NSXMLParserAttributeNotStartedError: Self = Self(39);
    pub const NSXMLParserAttributeNotFinishedError: Self = Self(40);
    pub const NSXMLParserAttributeHasNoValueError: Self = Self(41);
    pub const NSXMLParserAttributeRedefinedError: Self = Self(42);
    pub const NSXMLParserLiteralNotStartedError: Self = Self(43);
    pub const NSXMLParserLiteralNotFinishedError: Self = Self(44);
    pub const NSXMLParserCommentNotFinishedError: Self = Self(45);
    pub const NSXMLParserProcessingInstructionNotStartedError: Self = Self(46);
    pub const NSXMLParserProcessingInstructionNotFinishedError: Self = Self(47);
    pub const NSXMLParserNotationNotStartedError: Self = Self(48);
    pub const NSXMLParserNotationNotFinishedError: Self = Self(49);
    pub const NSXMLParserAttributeListNotStartedError: Self = Self(50);
    pub const NSXMLParserAttributeListNotFinishedError: Self = Self(51);
    pub const NSXMLParserMixedContentDeclNotStartedError: Self = Self(52);
    pub const NSXMLParserMixedContentDeclNotFinishedError: Self = Self(53);
    pub const NSXMLParserElementContentDeclNotStartedError: Self = Self(54);
    pub const NSXMLParserElementContentDeclNotFinishedError: Self = Self(55);
    pub const NSXMLParserXMLDeclNotStartedError: Self = Self(56);
    pub const NSXMLParserXMLDeclNotFinishedError: Self = Self(57);
    pub const NSXMLParserConditionalSectionNotStartedError: Self = Self(58);
    pub const NSXMLParserConditionalSectionNotFinishedError: Self = Self(59);
    pub const NSXMLParserExternalSubsetNotFinishedError: Self = Self(60);
    pub const NSXMLParserDOCTYPEDeclNotFinishedError: Self = Self(61);
    pub const NSXMLParserMisplacedCDATAEndStringError: Self = Self(62);
    pub const NSXMLParserCDATANotFinishedError: Self = Self(63);
    pub const NSXMLParserMisplacedXMLDeclarationError: Self = Self(64);
    pub const NSXMLParserSpaceRequiredError: Self = Self(65);
    pub const NSXMLParserSeparatorRequiredError: Self = Self(66);
    pub const NSXMLParserNMTOKENRequiredError: Self = Self(67);
    pub const NSXMLParserNAMERequiredError: Self = Self(68);
    pub const NSXMLParserPCDATARequiredError: Self = Self(69);
    pub const NSXMLParserURIRequiredError: Self = Self(70);
    pub const NSXMLParserPublicIdentifierRequiredError: Self = Self(71);
    pub const NSXMLParserLTRequiredError: Self = Self(72);
    pub const NSXMLParserGTRequiredError: Self = Self(73);
    pub const NSXMLParserLTSlashRequiredError: Self = Self(74);
    pub const NSXMLParserEqualExpectedError: Self = Self(75);
    pub const NSXMLParserTagNameMismatchError: Self = Self(76);
    pub const NSXMLParserUnfinishedTagError: Self = Self(77);
    pub const NSXMLParserStandaloneValueError: Self = Self(78);
    pub const NSXMLParserInvalidEncodingNameError: Self = Self(79);
    pub const NSXMLParserCommentContainsDoubleHyphenError: Self = Self(80);
    pub const NSXMLParserInvalidEncodingError: Self = Self(81);
    pub const NSXMLParserExternalStandaloneEntityError: Self = Self(82);
    pub const NSXMLParserInvalidConditionalSectionError: Self = Self(83);
    pub const NSXMLParserEntityValueRequiredError: Self = Self(84);
    pub const NSXMLParserNotWellBalancedError: Self = Self(85);
    pub const NSXMLParserExtraContentError: Self = Self(86);
    pub const NSXMLParserInvalidCharacterInEntityError: Self = Self(87);
    pub const NSXMLParserParsedEntityRefInInternalError: Self = Self(88);
    pub const NSXMLParserEntityRefLoopError: Self = Self(89);
    pub const NSXMLParserEntityBoundaryError: Self = Self(90);
    pub const NSXMLParserInvalidURIError: Self = Self(91);
    pub const NSXMLParserURIFragmentError: Self = Self(92);
    pub const NSXMLParserNoDTDError: Self = Self(94);
    pub const NSXMLParserDelegateAbortedParseError: Self = Self(512);
}

unsafe impl Encode for NSXMLParserError {
    const ENCODING: Encoding = NSInteger::ENCODING;
}

unsafe impl RefEncode for NSXMLParserError {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}