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 unsafe 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 unsafe 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 unsafe 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 unsafe 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 unsafe fn initWithRootElement(
120 this: Allocated<Self>,
121 element: Option<&NSXMLElement>,
122 ) -> Retained<Self>;
123
124 #[unsafe(method(replacementClassForClass:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn replacementClassForClass(cls: &AnyClass) -> &'static AnyClass;
127
128 #[cfg(feature = "NSString")]
129 #[unsafe(method(characterEncoding))]
131 #[unsafe(method_family = none)]
132 pub unsafe fn characterEncoding(&self) -> Option<Retained<NSString>>;
133
134 #[cfg(feature = "NSString")]
135 #[unsafe(method(setCharacterEncoding:))]
137 #[unsafe(method_family = none)]
138 pub unsafe fn setCharacterEncoding(&self, character_encoding: Option<&NSString>);
139
140 #[cfg(feature = "NSString")]
141 #[unsafe(method(version))]
143 #[unsafe(method_family = none)]
144 pub unsafe fn version(&self) -> Option<Retained<NSString>>;
145
146 #[cfg(feature = "NSString")]
147 #[unsafe(method(setVersion:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn setVersion(&self, version: Option<&NSString>);
151
152 #[unsafe(method(isStandalone))]
154 #[unsafe(method_family = none)]
155 pub unsafe fn isStandalone(&self) -> bool;
156
157 #[unsafe(method(setStandalone:))]
159 #[unsafe(method_family = none)]
160 pub unsafe fn setStandalone(&self, standalone: bool);
161
162 #[unsafe(method(documentContentKind))]
164 #[unsafe(method_family = none)]
165 pub unsafe fn documentContentKind(&self) -> NSXMLDocumentContentKind;
166
167 #[unsafe(method(setDocumentContentKind:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn setDocumentContentKind(
171 &self,
172 document_content_kind: NSXMLDocumentContentKind,
173 );
174
175 #[cfg(feature = "NSString")]
176 #[unsafe(method(MIMEType))]
178 #[unsafe(method_family = none)]
179 pub unsafe fn MIMEType(&self) -> Option<Retained<NSString>>;
180
181 #[cfg(feature = "NSString")]
182 #[unsafe(method(setMIMEType:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn setMIMEType(&self, mime_type: Option<&NSString>);
186
187 #[cfg(feature = "NSXMLDTD")]
188 #[unsafe(method(DTD))]
190 #[unsafe(method_family = none)]
191 pub unsafe fn DTD(&self) -> Option<Retained<NSXMLDTD>>;
192
193 #[cfg(feature = "NSXMLDTD")]
194 #[unsafe(method(setDTD:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn setDTD(&self, dtd: Option<&NSXMLDTD>);
198
199 #[cfg(feature = "NSXMLElement")]
200 #[unsafe(method(setRootElement:))]
202 #[unsafe(method_family = none)]
203 pub unsafe fn setRootElement(&self, root: &NSXMLElement);
204
205 #[cfg(feature = "NSXMLElement")]
206 #[unsafe(method(rootElement))]
208 #[unsafe(method_family = none)]
209 pub unsafe fn rootElement(&self) -> Option<Retained<NSXMLElement>>;
210
211 #[unsafe(method(insertChild:atIndex:))]
213 #[unsafe(method_family = none)]
214 pub unsafe fn insertChild_atIndex(&self, child: &NSXMLNode, index: NSUInteger);
215
216 #[cfg(feature = "NSArray")]
217 #[unsafe(method(insertChildren:atIndex:))]
219 #[unsafe(method_family = none)]
220 pub unsafe fn insertChildren_atIndex(
221 &self,
222 children: &NSArray<NSXMLNode>,
223 index: NSUInteger,
224 );
225
226 #[unsafe(method(removeChildAtIndex:))]
228 #[unsafe(method_family = none)]
229 pub unsafe fn removeChildAtIndex(&self, index: NSUInteger);
230
231 #[cfg(feature = "NSArray")]
232 #[unsafe(method(setChildren:))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn setChildren(&self, children: Option<&NSArray<NSXMLNode>>);
236
237 #[unsafe(method(addChild:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn addChild(&self, child: &NSXMLNode);
241
242 #[unsafe(method(replaceChildAtIndex:withNode:))]
244 #[unsafe(method_family = none)]
245 pub unsafe fn replaceChildAtIndex_withNode(&self, index: NSUInteger, node: &NSXMLNode);
246
247 #[cfg(feature = "NSData")]
248 #[unsafe(method(XMLData))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn XMLData(&self) -> Retained<NSData>;
252
253 #[cfg(all(feature = "NSData", feature = "NSXMLNodeOptions"))]
254 #[unsafe(method(XMLDataWithOptions:))]
256 #[unsafe(method_family = none)]
257 pub unsafe fn XMLDataWithOptions(&self, options: NSXMLNodeOptions) -> Retained<NSData>;
258
259 #[cfg(all(
260 feature = "NSData",
261 feature = "NSDictionary",
262 feature = "NSError",
263 feature = "NSString"
264 ))]
265 #[unsafe(method(objectByApplyingXSLT:arguments:error:_))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn objectByApplyingXSLT_arguments_error(
269 &self,
270 xslt: &NSData,
271 arguments: Option<&NSDictionary<NSString, NSString>>,
272 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
273
274 #[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
275 #[unsafe(method(objectByApplyingXSLTString:arguments:error:_))]
277 #[unsafe(method_family = none)]
278 pub unsafe fn objectByApplyingXSLTString_arguments_error(
279 &self,
280 xslt: &NSString,
281 arguments: Option<&NSDictionary<NSString, NSString>>,
282 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
283
284 #[cfg(all(
285 feature = "NSDictionary",
286 feature = "NSError",
287 feature = "NSString",
288 feature = "NSURL"
289 ))]
290 #[unsafe(method(objectByApplyingXSLTAtURL:arguments:error:_))]
292 #[unsafe(method_family = none)]
293 pub unsafe fn objectByApplyingXSLTAtURL_arguments_error(
294 &self,
295 xslt_url: &NSURL,
296 argument: Option<&NSDictionary<NSString, NSString>>,
297 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
298
299 #[cfg(feature = "NSError")]
300 #[unsafe(method(validateAndReturnError:_))]
301 #[unsafe(method_family = none)]
302 pub unsafe fn validateAndReturnError(&self) -> Result<(), Retained<NSError>>;
303 );
304}
305
306#[cfg(feature = "NSXMLNode")]
308impl NSXMLDocument {
309 extern_methods!(
310 #[unsafe(method(initWithKind:))]
318 #[unsafe(method_family = init)]
319 pub unsafe fn initWithKind(this: Allocated<Self>, kind: NSXMLNodeKind) -> Retained<Self>;
320
321 #[cfg(feature = "NSXMLNodeOptions")]
322 #[unsafe(method(initWithKind:options:))]
324 #[unsafe(method_family = init)]
325 pub unsafe fn initWithKind_options(
326 this: Allocated<Self>,
327 kind: NSXMLNodeKind,
328 options: NSXMLNodeOptions,
329 ) -> Retained<Self>;
330 );
331}
332
333#[cfg(feature = "NSXMLNode")]
335impl NSXMLDocument {
336 extern_methods!(
337 #[unsafe(method(new))]
338 #[unsafe(method_family = new)]
339 pub unsafe fn new() -> Retained<Self>;
340 );
341}