objc2_foundation/generated/
NSXMLNode.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[repr(transparent)]
12#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
13pub struct NSXMLNodeKind(pub NSUInteger);
14impl NSXMLNodeKind {
15 #[doc(alias = "NSXMLInvalidKind")]
16 pub const InvalidKind: Self = Self(0);
17 #[doc(alias = "NSXMLDocumentKind")]
18 pub const DocumentKind: Self = Self(1);
19 #[doc(alias = "NSXMLElementKind")]
20 pub const ElementKind: Self = Self(2);
21 #[doc(alias = "NSXMLAttributeKind")]
22 pub const AttributeKind: Self = Self(3);
23 #[doc(alias = "NSXMLNamespaceKind")]
24 pub const NamespaceKind: Self = Self(4);
25 #[doc(alias = "NSXMLProcessingInstructionKind")]
26 pub const ProcessingInstructionKind: Self = Self(5);
27 #[doc(alias = "NSXMLCommentKind")]
28 pub const CommentKind: Self = Self(6);
29 #[doc(alias = "NSXMLTextKind")]
30 pub const TextKind: Self = Self(7);
31 #[doc(alias = "NSXMLDTDKind")]
32 pub const DTDKind: Self = Self(8);
33 #[doc(alias = "NSXMLEntityDeclarationKind")]
34 pub const EntityDeclarationKind: Self = Self(9);
35 #[doc(alias = "NSXMLAttributeDeclarationKind")]
36 pub const AttributeDeclarationKind: Self = Self(10);
37 #[doc(alias = "NSXMLElementDeclarationKind")]
38 pub const ElementDeclarationKind: Self = Self(11);
39 #[doc(alias = "NSXMLNotationDeclarationKind")]
40 pub const NotationDeclarationKind: Self = Self(12);
41}
42
43unsafe impl Encode for NSXMLNodeKind {
44 const ENCODING: Encoding = NSUInteger::ENCODING;
45}
46
47unsafe impl RefEncode for NSXMLNodeKind {
48 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
49}
50
51extern_class!(
52 #[unsafe(super(NSObject))]
56 #[derive(Debug, PartialEq, Eq, Hash)]
57 pub struct NSXMLNode;
58);
59
60#[cfg(feature = "NSObject")]
61extern_conformance!(
62 unsafe impl NSCopying for NSXMLNode {}
63);
64
65#[cfg(feature = "NSObject")]
66unsafe impl CopyingHelper for NSXMLNode {
67 type Result = Self;
68}
69
70extern_conformance!(
71 unsafe impl NSObjectProtocol for NSXMLNode {}
72);
73
74impl NSXMLNode {
75 extern_methods!(
76 #[unsafe(method(init))]
77 #[unsafe(method_family = init)]
78 pub fn init(this: Allocated<Self>) -> Retained<Self>;
79
80 #[unsafe(method(initWithKind:))]
88 #[unsafe(method_family = init)]
89 pub fn initWithKind(this: Allocated<Self>, kind: NSXMLNodeKind) -> Retained<Self>;
90
91 #[cfg(feature = "NSXMLNodeOptions")]
92 #[unsafe(method(initWithKind:options:))]
94 #[unsafe(method_family = init)]
95 pub fn initWithKind_options(
96 this: Allocated<Self>,
97 kind: NSXMLNodeKind,
98 options: NSXMLNodeOptions,
99 ) -> Retained<Self>;
100
101 #[unsafe(method(document))]
103 #[unsafe(method_family = none)]
104 pub fn document() -> Retained<AnyObject>;
105
106 #[cfg(feature = "NSXMLElement")]
107 #[unsafe(method(documentWithRootElement:))]
111 #[unsafe(method_family = none)]
112 pub fn documentWithRootElement(element: &NSXMLElement) -> Retained<AnyObject>;
113
114 #[cfg(feature = "NSString")]
115 #[unsafe(method(elementWithName:))]
124 #[unsafe(method_family = none)]
125 pub fn elementWithName(name: &NSString) -> Retained<AnyObject>;
126
127 #[cfg(feature = "NSString")]
128 #[unsafe(method(elementWithName:URI:))]
130 #[unsafe(method_family = none)]
131 pub fn elementWithName_URI(name: &NSString, uri: &NSString) -> Retained<AnyObject>;
132
133 #[cfg(feature = "NSString")]
134 #[unsafe(method(elementWithName:stringValue:))]
143 #[unsafe(method_family = none)]
144 pub fn elementWithName_stringValue(
145 name: &NSString,
146 string: &NSString,
147 ) -> Retained<AnyObject>;
148
149 #[cfg(all(feature = "NSArray", feature = "NSString"))]
150 #[unsafe(method(elementWithName:children:attributes:))]
161 #[unsafe(method_family = none)]
162 pub fn elementWithName_children_attributes(
163 name: &NSString,
164 children: Option<&NSArray<NSXMLNode>>,
165 attributes: Option<&NSArray<NSXMLNode>>,
166 ) -> Retained<AnyObject>;
167
168 #[cfg(feature = "NSString")]
169 #[unsafe(method(attributeWithName:stringValue:))]
175 #[unsafe(method_family = none)]
176 pub fn attributeWithName_stringValue(
177 name: &NSString,
178 string_value: &NSString,
179 ) -> Retained<AnyObject>;
180
181 #[cfg(feature = "NSString")]
182 #[unsafe(method(attributeWithName:URI:stringValue:))]
184 #[unsafe(method_family = none)]
185 pub fn attributeWithName_URI_stringValue(
186 name: &NSString,
187 uri: &NSString,
188 string_value: &NSString,
189 ) -> Retained<AnyObject>;
190
191 #[cfg(feature = "NSString")]
192 #[unsafe(method(namespaceWithName:stringValue:))]
198 #[unsafe(method_family = none)]
199 pub fn namespaceWithName_stringValue(
200 name: &NSString,
201 string_value: &NSString,
202 ) -> Retained<AnyObject>;
203
204 #[cfg(feature = "NSString")]
205 #[unsafe(method(processingInstructionWithName:stringValue:))]
212 #[unsafe(method_family = none)]
213 pub fn processingInstructionWithName_stringValue(
214 name: &NSString,
215 string_value: &NSString,
216 ) -> Retained<AnyObject>;
217
218 #[cfg(feature = "NSString")]
219 #[unsafe(method(commentWithStringValue:))]
226 #[unsafe(method_family = none)]
227 pub fn commentWithStringValue(string_value: &NSString) -> Retained<AnyObject>;
228
229 #[cfg(feature = "NSString")]
230 #[unsafe(method(textWithStringValue:))]
232 #[unsafe(method_family = none)]
233 pub fn textWithStringValue(string_value: &NSString) -> Retained<AnyObject>;
234
235 #[cfg(feature = "NSString")]
236 #[unsafe(method(DTDNodeWithXMLString:))]
238 #[unsafe(method_family = none)]
239 pub fn DTDNodeWithXMLString(string: &NSString) -> Option<Retained<AnyObject>>;
240
241 #[unsafe(method(kind))]
243 #[unsafe(method_family = none)]
244 pub fn kind(&self) -> NSXMLNodeKind;
245
246 #[cfg(feature = "NSString")]
247 #[unsafe(method(name))]
249 #[unsafe(method_family = none)]
250 pub fn name(&self) -> Option<Retained<NSString>>;
251
252 #[cfg(feature = "NSString")]
253 #[unsafe(method(setName:))]
257 #[unsafe(method_family = none)]
258 pub fn setName(&self, name: Option<&NSString>);
259
260 #[unsafe(method(objectValue))]
262 #[unsafe(method_family = none)]
263 pub fn objectValue(&self) -> Option<Retained<AnyObject>>;
264
265 #[unsafe(method(setObjectValue:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn setObjectValue(&self, object_value: Option<&AnyObject>);
273
274 #[cfg(feature = "NSString")]
275 #[unsafe(method(stringValue))]
277 #[unsafe(method_family = none)]
278 pub fn stringValue(&self) -> Option<Retained<NSString>>;
279
280 #[cfg(feature = "NSString")]
281 #[unsafe(method(setStringValue:))]
285 #[unsafe(method_family = none)]
286 pub fn setStringValue(&self, string_value: Option<&NSString>);
287
288 #[cfg(feature = "NSString")]
289 #[unsafe(method(setStringValue:resolvingEntities:))]
297 #[unsafe(method_family = none)]
298 pub fn setStringValue_resolvingEntities(&self, string: &NSString, resolve: bool);
299
300 #[unsafe(method(index))]
302 #[unsafe(method_family = none)]
303 pub fn index(&self) -> NSUInteger;
304
305 #[unsafe(method(level))]
307 #[unsafe(method_family = none)]
308 pub fn level(&self) -> NSUInteger;
309
310 #[cfg(feature = "NSXMLDocument")]
311 #[unsafe(method(rootDocument))]
313 #[unsafe(method_family = none)]
314 pub fn rootDocument(&self) -> Option<Retained<NSXMLDocument>>;
315
316 #[unsafe(method(parent))]
318 #[unsafe(method_family = none)]
319 pub fn parent(&self) -> Option<Retained<NSXMLNode>>;
320
321 #[unsafe(method(childCount))]
323 #[unsafe(method_family = none)]
324 pub fn childCount(&self) -> NSUInteger;
325
326 #[cfg(feature = "NSArray")]
327 #[unsafe(method(children))]
329 #[unsafe(method_family = none)]
330 pub fn children(&self) -> Option<Retained<NSArray<NSXMLNode>>>;
331
332 #[unsafe(method(childAtIndex:))]
334 #[unsafe(method_family = none)]
335 pub fn childAtIndex(&self, index: NSUInteger) -> Option<Retained<NSXMLNode>>;
336
337 #[unsafe(method(previousSibling))]
339 #[unsafe(method_family = none)]
340 pub fn previousSibling(&self) -> Option<Retained<NSXMLNode>>;
341
342 #[unsafe(method(nextSibling))]
344 #[unsafe(method_family = none)]
345 pub fn nextSibling(&self) -> Option<Retained<NSXMLNode>>;
346
347 #[unsafe(method(previousNode))]
349 #[unsafe(method_family = none)]
350 pub fn previousNode(&self) -> Option<Retained<NSXMLNode>>;
351
352 #[unsafe(method(nextNode))]
354 #[unsafe(method_family = none)]
355 pub fn nextNode(&self) -> Option<Retained<NSXMLNode>>;
356
357 #[unsafe(method(detach))]
359 #[unsafe(method_family = none)]
360 pub fn detach(&self);
361
362 #[cfg(feature = "NSString")]
363 #[unsafe(method(XPath))]
365 #[unsafe(method_family = none)]
366 pub fn XPath(&self) -> Option<Retained<NSString>>;
367
368 #[cfg(feature = "NSString")]
369 #[unsafe(method(localName))]
371 #[unsafe(method_family = none)]
372 pub fn localName(&self) -> Option<Retained<NSString>>;
373
374 #[cfg(feature = "NSString")]
375 #[unsafe(method(prefix))]
377 #[unsafe(method_family = none)]
378 pub fn prefix(&self) -> Option<Retained<NSString>>;
379
380 #[cfg(feature = "NSString")]
381 #[unsafe(method(URI))]
383 #[unsafe(method_family = none)]
384 pub fn URI(&self) -> Option<Retained<NSString>>;
385
386 #[cfg(feature = "NSString")]
387 #[unsafe(method(setURI:))]
391 #[unsafe(method_family = none)]
392 pub fn setURI(&self, uri: Option<&NSString>);
393
394 #[cfg(feature = "NSString")]
395 #[unsafe(method(localNameForName:))]
397 #[unsafe(method_family = none)]
398 pub fn localNameForName(name: &NSString) -> Retained<NSString>;
399
400 #[cfg(feature = "NSString")]
401 #[unsafe(method(prefixForName:))]
403 #[unsafe(method_family = none)]
404 pub fn prefixForName(name: &NSString) -> Option<Retained<NSString>>;
405
406 #[cfg(feature = "NSString")]
407 #[unsafe(method(predefinedNamespaceForPrefix:))]
409 #[unsafe(method_family = none)]
410 pub fn predefinedNamespaceForPrefix(name: &NSString) -> Option<Retained<NSXMLNode>>;
411
412 #[cfg(feature = "NSString")]
413 #[unsafe(method(description))]
415 #[unsafe(method_family = none)]
416 pub fn description(&self) -> Retained<NSString>;
417
418 #[cfg(feature = "NSString")]
419 #[unsafe(method(XMLString))]
421 #[unsafe(method_family = none)]
422 pub fn XMLString(&self) -> Retained<NSString>;
423
424 #[cfg(all(feature = "NSString", feature = "NSXMLNodeOptions"))]
425 #[unsafe(method(XMLStringWithOptions:))]
427 #[unsafe(method_family = none)]
428 pub fn XMLStringWithOptions(&self, options: NSXMLNodeOptions) -> Retained<NSString>;
429
430 #[cfg(feature = "NSString")]
431 #[unsafe(method(canonicalXMLStringPreservingComments:))]
433 #[unsafe(method_family = none)]
434 pub fn canonicalXMLStringPreservingComments(&self, comments: bool) -> Retained<NSString>;
435
436 #[cfg(all(feature = "NSArray", feature = "NSError", feature = "NSString"))]
437 #[unsafe(method(nodesForXPath:error:_))]
441 #[unsafe(method_family = none)]
442 pub fn nodesForXPath_error(
443 &self,
444 xpath: &NSString,
445 ) -> Result<Retained<NSArray<NSXMLNode>>, Retained<NSError>>;
446
447 #[cfg(all(
448 feature = "NSArray",
449 feature = "NSDictionary",
450 feature = "NSError",
451 feature = "NSString"
452 ))]
453 #[unsafe(method(objectsForXQuery:constants:error:_))]
461 #[unsafe(method_family = none)]
462 pub unsafe fn objectsForXQuery_constants_error(
463 &self,
464 xquery: &NSString,
465 constants: Option<&NSDictionary<NSString, AnyObject>>,
466 ) -> Result<Retained<NSArray>, Retained<NSError>>;
467
468 #[cfg(all(feature = "NSArray", feature = "NSError", feature = "NSString"))]
469 #[unsafe(method(objectsForXQuery:error:_))]
470 #[unsafe(method_family = none)]
471 pub fn objectsForXQuery_error(
472 &self,
473 xquery: &NSString,
474 ) -> Result<Retained<NSArray>, Retained<NSError>>;
475 );
476}
477
478impl NSXMLNode {
480 extern_methods!(
481 #[unsafe(method(new))]
482 #[unsafe(method_family = new)]
483 pub fn new() -> Retained<Self>;
484 );
485}
486
487impl DefaultRetained for NSXMLNode {
488 #[inline]
489 fn default_retained() -> Retained<Self> {
490 Self::new()
491 }
492}