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
//! 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 NSXMLNodeKind(pub NSUInteger);
impl NSXMLNodeKind {
    pub const NSXMLInvalidKind: Self = Self(0);
    pub const NSXMLDocumentKind: Self = Self(1);
    pub const NSXMLElementKind: Self = Self(2);
    pub const NSXMLAttributeKind: Self = Self(3);
    pub const NSXMLNamespaceKind: Self = Self(4);
    pub const NSXMLProcessingInstructionKind: Self = Self(5);
    pub const NSXMLCommentKind: Self = Self(6);
    pub const NSXMLTextKind: Self = Self(7);
    pub const NSXMLDTDKind: Self = Self(8);
    pub const NSXMLEntityDeclarationKind: Self = Self(9);
    pub const NSXMLAttributeDeclarationKind: Self = Self(10);
    pub const NSXMLElementDeclarationKind: Self = Self(11);
    pub const NSXMLNotationDeclarationKind: Self = Self(12);
}

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

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

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

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

#[cfg(feature = "NSObject")]
unsafe impl NSCopying for NSXMLNode {}

unsafe impl NSObjectProtocol for NSXMLNode {}

extern_methods!(
    unsafe impl NSXMLNode {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[method_id(@__retain_semantics Init initWithKind:)]
        pub unsafe fn initWithKind(this: Allocated<Self>, kind: NSXMLNodeKind) -> Retained<Self>;

        #[cfg(feature = "NSXMLNodeOptions")]
        #[method_id(@__retain_semantics Init initWithKind:options:)]
        pub unsafe fn initWithKind_options(
            this: Allocated<Self>,
            kind: NSXMLNodeKind,
            options: NSXMLNodeOptions,
        ) -> Retained<Self>;

        #[method_id(@__retain_semantics Other document)]
        pub unsafe fn document() -> Retained<AnyObject>;

        #[cfg(feature = "NSXMLElement")]
        #[method_id(@__retain_semantics Other documentWithRootElement:)]
        pub unsafe fn documentWithRootElement(element: &NSXMLElement) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other elementWithName:)]
        pub unsafe fn elementWithName(name: &NSString) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other elementWithName:URI:)]
        pub unsafe fn elementWithName_URI(name: &NSString, uri: &NSString) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other elementWithName:stringValue:)]
        pub unsafe fn elementWithName_stringValue(
            name: &NSString,
            string: &NSString,
        ) -> Retained<AnyObject>;

        #[cfg(all(feature = "NSArray", feature = "NSString"))]
        #[method_id(@__retain_semantics Other elementWithName:children:attributes:)]
        pub unsafe fn elementWithName_children_attributes(
            name: &NSString,
            children: Option<&NSArray<NSXMLNode>>,
            attributes: Option<&NSArray<NSXMLNode>>,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other attributeWithName:stringValue:)]
        pub unsafe fn attributeWithName_stringValue(
            name: &NSString,
            string_value: &NSString,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other attributeWithName:URI:stringValue:)]
        pub unsafe fn attributeWithName_URI_stringValue(
            name: &NSString,
            uri: &NSString,
            string_value: &NSString,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other namespaceWithName:stringValue:)]
        pub unsafe fn namespaceWithName_stringValue(
            name: &NSString,
            string_value: &NSString,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other processingInstructionWithName:stringValue:)]
        pub unsafe fn processingInstructionWithName_stringValue(
            name: &NSString,
            string_value: &NSString,
        ) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other commentWithStringValue:)]
        pub unsafe fn commentWithStringValue(string_value: &NSString) -> Retained<AnyObject>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other textWithStringValue:)]
        pub unsafe fn textWithStringValue(string_value: &NSString) -> Retained<AnyObject>;

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

        #[method(kind)]
        pub unsafe fn kind(&self) -> NSXMLNodeKind;

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

        #[cfg(feature = "NSString")]
        #[method(setName:)]
        pub unsafe fn setName(&self, name: Option<&NSString>);

        #[method_id(@__retain_semantics Other objectValue)]
        pub unsafe fn objectValue(&self) -> Option<Retained<AnyObject>>;

        #[method(setObjectValue:)]
        pub unsafe fn setObjectValue(&self, object_value: Option<&AnyObject>);

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

        #[cfg(feature = "NSString")]
        #[method(setStringValue:)]
        pub unsafe fn setStringValue(&self, string_value: Option<&NSString>);

        #[cfg(feature = "NSString")]
        #[method(setStringValue:resolvingEntities:)]
        pub unsafe fn setStringValue_resolvingEntities(&self, string: &NSString, resolve: bool);

        #[method(index)]
        pub unsafe fn index(&self) -> NSUInteger;

        #[method(level)]
        pub unsafe fn level(&self) -> NSUInteger;

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

        #[method_id(@__retain_semantics Other parent)]
        pub unsafe fn parent(&self) -> Option<Retained<NSXMLNode>>;

        #[method(childCount)]
        pub unsafe fn childCount(&self) -> NSUInteger;

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

        #[method_id(@__retain_semantics Other childAtIndex:)]
        pub unsafe fn childAtIndex(&self, index: NSUInteger) -> Option<Retained<NSXMLNode>>;

        #[method_id(@__retain_semantics Other previousSibling)]
        pub unsafe fn previousSibling(&self) -> Option<Retained<NSXMLNode>>;

        #[method_id(@__retain_semantics Other nextSibling)]
        pub unsafe fn nextSibling(&self) -> Option<Retained<NSXMLNode>>;

        #[method_id(@__retain_semantics Other previousNode)]
        pub unsafe fn previousNode(&self) -> Option<Retained<NSXMLNode>>;

        #[method_id(@__retain_semantics Other nextNode)]
        pub unsafe fn nextNode(&self) -> Option<Retained<NSXMLNode>>;

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

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

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

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

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

        #[cfg(feature = "NSString")]
        #[method(setURI:)]
        pub unsafe fn setURI(&self, uri: Option<&NSString>);

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other localNameForName:)]
        pub unsafe fn localNameForName(name: &NSString) -> Retained<NSString>;

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

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

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

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

        #[cfg(all(feature = "NSString", feature = "NSXMLNodeOptions"))]
        #[method_id(@__retain_semantics Other XMLStringWithOptions:)]
        pub unsafe fn XMLStringWithOptions(&self, options: NSXMLNodeOptions) -> Retained<NSString>;

        #[cfg(feature = "NSString")]
        #[method_id(@__retain_semantics Other canonicalXMLStringPreservingComments:)]
        pub unsafe fn canonicalXMLStringPreservingComments(
            &self,
            comments: bool,
        ) -> Retained<NSString>;

        #[cfg(all(feature = "NSArray", feature = "NSError", feature = "NSString"))]
        #[method_id(@__retain_semantics Other nodesForXPath:error:_)]
        pub unsafe fn nodesForXPath_error(
            &self,
            xpath: &NSString,
        ) -> Result<Retained<NSArray<NSXMLNode>>, Retained<NSError>>;

        #[cfg(all(
            feature = "NSArray",
            feature = "NSDictionary",
            feature = "NSError",
            feature = "NSString"
        ))]
        #[method_id(@__retain_semantics Other objectsForXQuery:constants:error:_)]
        pub unsafe fn objectsForXQuery_constants_error(
            &self,
            xquery: &NSString,
            constants: Option<&NSDictionary<NSString, AnyObject>>,
        ) -> Result<Retained<NSArray>, Retained<NSError>>;

        #[cfg(all(feature = "NSArray", feature = "NSError", feature = "NSString"))]
        #[method_id(@__retain_semantics Other objectsForXQuery:error:_)]
        pub unsafe fn objectsForXQuery_error(
            &self,
            xquery: &NSString,
        ) -> Result<Retained<NSArray>, Retained<NSError>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    unsafe impl NSXMLNode {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new() -> Retained<Self>;
    }
);