objc2_foundation/generated/
NSXMLDocument.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9#[repr(transparent)]
14#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
15pub struct NSXMLDocumentContentKind(pub NSUInteger);
16impl NSXMLDocumentContentKind {
17 #[doc(alias = "NSXMLDocumentXMLKind")]
18 pub const XMLKind: Self = Self(0);
19 #[doc(alias = "NSXMLDocumentXHTMLKind")]
20 pub const XHTMLKind: Self = Self(1);
21 #[doc(alias = "NSXMLDocumentHTMLKind")]
22 pub const HTMLKind: Self = Self(2);
23 #[doc(alias = "NSXMLDocumentTextKind")]
24 pub const TextKind: Self = Self(3);
25}
26
27unsafe impl Encode for NSXMLDocumentContentKind {
28 const ENCODING: Encoding = NSUInteger::ENCODING;
29}
30
31unsafe impl RefEncode for NSXMLDocumentContentKind {
32 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
33}
34
35extern_class!(
36 #[unsafe(super(NSXMLNode, NSObject))]
42 #[derive(Debug, PartialEq, Eq, Hash)]
43 #[cfg(feature = "NSXMLNode")]
44 pub struct NSXMLDocument;
45);
46
47#[cfg(all(feature = "NSObject", feature = "NSXMLNode"))]
48extern_conformance!(
49 unsafe impl NSCopying for NSXMLDocument {}
50);
51
52#[cfg(all(feature = "NSObject", feature = "NSXMLNode"))]
53unsafe impl CopyingHelper for NSXMLDocument {
54 type Result = Self;
55}
56
57#[cfg(feature = "NSXMLNode")]
58extern_conformance!(
59 unsafe impl NSObjectProtocol for NSXMLDocument {}
60);
61
62#[cfg(feature = "NSXMLNode")]
63impl NSXMLDocument {
64 extern_methods!(
65 #[unsafe(method(init))]
66 #[unsafe(method_family = init)]
67 pub fn init(this: Allocated<Self>) -> Retained<Self>;
68
69 #[cfg(all(
70 feature = "NSError",
71 feature = "NSString",
72 feature = "NSXMLNodeOptions"
73 ))]
74 #[unsafe(method(initWithXMLString:options:error:_))]
80 #[unsafe(method_family = init)]
81 pub fn initWithXMLString_options_error(
82 this: Allocated<Self>,
83 string: &NSString,
84 mask: NSXMLNodeOptions,
85 ) -> Result<Retained<Self>, Retained<NSError>>;
86
87 #[cfg(all(feature = "NSError", feature = "NSURL", feature = "NSXMLNodeOptions"))]
88 #[unsafe(method(initWithContentsOfURL:options:error:_))]
94 #[unsafe(method_family = init)]
95 pub fn initWithContentsOfURL_options_error(
96 this: Allocated<Self>,
97 url: &NSURL,
98 mask: NSXMLNodeOptions,
99 ) -> Result<Retained<Self>, Retained<NSError>>;
100
101 #[cfg(all(feature = "NSData", feature = "NSError", feature = "NSXMLNodeOptions"))]
102 #[unsafe(method(initWithData:options:error:_))]
108 #[unsafe(method_family = init)]
109 pub fn initWithData_options_error(
110 this: Allocated<Self>,
111 data: &NSData,
112 mask: NSXMLNodeOptions,
113 ) -> Result<Retained<Self>, Retained<NSError>>;
114
115 #[cfg(feature = "NSXMLElement")]
116 #[unsafe(method(initWithRootElement:))]
118 #[unsafe(method_family = init)]
119 pub fn initWithRootElement(
120 this: Allocated<Self>,
121 element: Option<&NSXMLElement>,
122 ) -> Retained<Self>;
123
124 #[unsafe(method(replacementClassForClass:))]
128 #[unsafe(method_family = none)]
129 pub unsafe fn replacementClassForClass(cls: &AnyClass) -> &'static AnyClass;
130
131 #[cfg(feature = "NSString")]
132 #[unsafe(method(characterEncoding))]
134 #[unsafe(method_family = none)]
135 pub fn characterEncoding(&self) -> Option<Retained<NSString>>;
136
137 #[cfg(feature = "NSString")]
138 #[unsafe(method(setCharacterEncoding:))]
142 #[unsafe(method_family = none)]
143 pub fn setCharacterEncoding(&self, character_encoding: Option<&NSString>);
144
145 #[cfg(feature = "NSString")]
146 #[unsafe(method(version))]
148 #[unsafe(method_family = none)]
149 pub fn version(&self) -> Option<Retained<NSString>>;
150
151 #[cfg(feature = "NSString")]
152 #[unsafe(method(setVersion:))]
156 #[unsafe(method_family = none)]
157 pub fn setVersion(&self, version: Option<&NSString>);
158
159 #[unsafe(method(isStandalone))]
161 #[unsafe(method_family = none)]
162 pub fn isStandalone(&self) -> bool;
163
164 #[unsafe(method(setStandalone:))]
166 #[unsafe(method_family = none)]
167 pub fn setStandalone(&self, standalone: bool);
168
169 #[unsafe(method(documentContentKind))]
171 #[unsafe(method_family = none)]
172 pub fn documentContentKind(&self) -> NSXMLDocumentContentKind;
173
174 #[unsafe(method(setDocumentContentKind:))]
176 #[unsafe(method_family = none)]
177 pub fn setDocumentContentKind(&self, document_content_kind: NSXMLDocumentContentKind);
178
179 #[cfg(feature = "NSString")]
180 #[unsafe(method(MIMEType))]
182 #[unsafe(method_family = none)]
183 pub fn MIMEType(&self) -> Option<Retained<NSString>>;
184
185 #[cfg(feature = "NSString")]
186 #[unsafe(method(setMIMEType:))]
190 #[unsafe(method_family = none)]
191 pub fn setMIMEType(&self, mime_type: Option<&NSString>);
192
193 #[cfg(feature = "NSXMLDTD")]
194 #[unsafe(method(DTD))]
196 #[unsafe(method_family = none)]
197 pub fn DTD(&self) -> Option<Retained<NSXMLDTD>>;
198
199 #[cfg(feature = "NSXMLDTD")]
200 #[unsafe(method(setDTD:))]
204 #[unsafe(method_family = none)]
205 pub fn setDTD(&self, dtd: Option<&NSXMLDTD>);
206
207 #[cfg(feature = "NSXMLElement")]
208 #[unsafe(method(setRootElement:))]
210 #[unsafe(method_family = none)]
211 pub fn setRootElement(&self, root: &NSXMLElement);
212
213 #[cfg(feature = "NSXMLElement")]
214 #[unsafe(method(rootElement))]
216 #[unsafe(method_family = none)]
217 pub fn rootElement(&self) -> Option<Retained<NSXMLElement>>;
218
219 #[unsafe(method(insertChild:atIndex:))]
221 #[unsafe(method_family = none)]
222 pub fn insertChild_atIndex(&self, child: &NSXMLNode, index: NSUInteger);
223
224 #[cfg(feature = "NSArray")]
225 #[unsafe(method(insertChildren:atIndex:))]
227 #[unsafe(method_family = none)]
228 pub fn insertChildren_atIndex(&self, children: &NSArray<NSXMLNode>, index: NSUInteger);
229
230 #[unsafe(method(removeChildAtIndex:))]
232 #[unsafe(method_family = none)]
233 pub fn removeChildAtIndex(&self, index: NSUInteger);
234
235 #[cfg(feature = "NSArray")]
236 #[unsafe(method(setChildren:))]
238 #[unsafe(method_family = none)]
239 pub fn setChildren(&self, children: Option<&NSArray<NSXMLNode>>);
240
241 #[unsafe(method(addChild:))]
243 #[unsafe(method_family = none)]
244 pub fn addChild(&self, child: &NSXMLNode);
245
246 #[unsafe(method(replaceChildAtIndex:withNode:))]
248 #[unsafe(method_family = none)]
249 pub fn replaceChildAtIndex_withNode(&self, index: NSUInteger, node: &NSXMLNode);
250
251 #[cfg(feature = "NSData")]
252 #[unsafe(method(XMLData))]
254 #[unsafe(method_family = none)]
255 pub fn XMLData(&self) -> Retained<NSData>;
256
257 #[cfg(all(feature = "NSData", feature = "NSXMLNodeOptions"))]
258 #[unsafe(method(XMLDataWithOptions:))]
260 #[unsafe(method_family = none)]
261 pub fn XMLDataWithOptions(&self, options: NSXMLNodeOptions) -> Retained<NSData>;
262
263 #[cfg(all(
264 feature = "NSData",
265 feature = "NSDictionary",
266 feature = "NSError",
267 feature = "NSString"
268 ))]
269 #[unsafe(method(objectByApplyingXSLT:arguments:error:_))]
271 #[unsafe(method_family = none)]
272 pub fn objectByApplyingXSLT_arguments_error(
273 &self,
274 xslt: &NSData,
275 arguments: Option<&NSDictionary<NSString, NSString>>,
276 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
277
278 #[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
279 #[unsafe(method(objectByApplyingXSLTString:arguments:error:_))]
281 #[unsafe(method_family = none)]
282 pub fn objectByApplyingXSLTString_arguments_error(
283 &self,
284 xslt: &NSString,
285 arguments: Option<&NSDictionary<NSString, NSString>>,
286 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
287
288 #[cfg(all(
289 feature = "NSDictionary",
290 feature = "NSError",
291 feature = "NSString",
292 feature = "NSURL"
293 ))]
294 #[unsafe(method(objectByApplyingXSLTAtURL:arguments:error:_))]
296 #[unsafe(method_family = none)]
297 pub fn objectByApplyingXSLTAtURL_arguments_error(
298 &self,
299 xslt_url: &NSURL,
300 argument: Option<&NSDictionary<NSString, NSString>>,
301 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
302
303 #[cfg(feature = "NSError")]
304 #[unsafe(method(validateAndReturnError:_))]
305 #[unsafe(method_family = none)]
306 pub fn validateAndReturnError(&self) -> Result<(), Retained<NSError>>;
307 );
308}
309
310#[cfg(feature = "NSXMLNode")]
312impl NSXMLDocument {
313 extern_methods!(
314 #[unsafe(method(initWithKind:))]
322 #[unsafe(method_family = init)]
323 pub fn initWithKind(this: Allocated<Self>, kind: NSXMLNodeKind) -> Retained<Self>;
324
325 #[cfg(feature = "NSXMLNodeOptions")]
326 #[unsafe(method(initWithKind:options:))]
328 #[unsafe(method_family = init)]
329 pub fn initWithKind_options(
330 this: Allocated<Self>,
331 kind: NSXMLNodeKind,
332 options: NSXMLNodeOptions,
333 ) -> Retained<Self>;
334 );
335}
336
337#[cfg(feature = "NSXMLNode")]
339impl NSXMLDocument {
340 extern_methods!(
341 #[unsafe(method(new))]
342 #[unsafe(method_family = new)]
343 pub fn new() -> Retained<Self>;
344 );
345}
346
347#[cfg(feature = "NSXMLNode")]
348impl DefaultRetained for NSXMLDocument {
349 #[inline]
350 fn default_retained() -> Retained<Self> {
351 Self::new()
352 }
353}