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"))]
48unsafe impl NSCopying for NSXMLDocument {}
49
50#[cfg(all(feature = "NSObject", feature = "NSXMLNode"))]
51unsafe impl CopyingHelper for NSXMLDocument {
52 type Result = Self;
53}
54
55#[cfg(feature = "NSXMLNode")]
56unsafe impl NSObjectProtocol for NSXMLDocument {}
57
58#[cfg(feature = "NSXMLNode")]
59impl NSXMLDocument {
60 extern_methods!(
61 #[unsafe(method(init))]
62 #[unsafe(method_family = init)]
63 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
64
65 #[cfg(all(
66 feature = "NSError",
67 feature = "NSString",
68 feature = "NSXMLNodeOptions"
69 ))]
70 #[unsafe(method(initWithXMLString:options:error:_))]
76 #[unsafe(method_family = init)]
77 pub unsafe fn initWithXMLString_options_error(
78 this: Allocated<Self>,
79 string: &NSString,
80 mask: NSXMLNodeOptions,
81 ) -> Result<Retained<Self>, Retained<NSError>>;
82
83 #[cfg(all(feature = "NSError", feature = "NSURL", feature = "NSXMLNodeOptions"))]
84 #[unsafe(method(initWithContentsOfURL:options:error:_))]
90 #[unsafe(method_family = init)]
91 pub unsafe fn initWithContentsOfURL_options_error(
92 this: Allocated<Self>,
93 url: &NSURL,
94 mask: NSXMLNodeOptions,
95 ) -> Result<Retained<Self>, Retained<NSError>>;
96
97 #[cfg(all(feature = "NSData", feature = "NSError", feature = "NSXMLNodeOptions"))]
98 #[unsafe(method(initWithData:options:error:_))]
104 #[unsafe(method_family = init)]
105 pub unsafe fn initWithData_options_error(
106 this: Allocated<Self>,
107 data: &NSData,
108 mask: NSXMLNodeOptions,
109 ) -> Result<Retained<Self>, Retained<NSError>>;
110
111 #[cfg(feature = "NSXMLElement")]
112 #[unsafe(method(initWithRootElement:))]
114 #[unsafe(method_family = init)]
115 pub unsafe fn initWithRootElement(
116 this: Allocated<Self>,
117 element: Option<&NSXMLElement>,
118 ) -> Retained<Self>;
119
120 #[unsafe(method(replacementClassForClass:))]
121 #[unsafe(method_family = none)]
122 pub unsafe fn replacementClassForClass(cls: &AnyClass) -> &'static AnyClass;
123
124 #[cfg(feature = "NSString")]
125 #[unsafe(method(characterEncoding))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn characterEncoding(&self) -> Option<Retained<NSString>>;
129
130 #[cfg(feature = "NSString")]
131 #[unsafe(method(setCharacterEncoding:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn setCharacterEncoding(&self, character_encoding: Option<&NSString>);
135
136 #[cfg(feature = "NSString")]
137 #[unsafe(method(version))]
139 #[unsafe(method_family = none)]
140 pub unsafe fn version(&self) -> Option<Retained<NSString>>;
141
142 #[cfg(feature = "NSString")]
143 #[unsafe(method(setVersion:))]
145 #[unsafe(method_family = none)]
146 pub unsafe fn setVersion(&self, version: Option<&NSString>);
147
148 #[unsafe(method(isStandalone))]
150 #[unsafe(method_family = none)]
151 pub unsafe fn isStandalone(&self) -> bool;
152
153 #[unsafe(method(setStandalone:))]
155 #[unsafe(method_family = none)]
156 pub unsafe fn setStandalone(&self, standalone: bool);
157
158 #[unsafe(method(documentContentKind))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn documentContentKind(&self) -> NSXMLDocumentContentKind;
162
163 #[unsafe(method(setDocumentContentKind:))]
165 #[unsafe(method_family = none)]
166 pub unsafe fn setDocumentContentKind(
167 &self,
168 document_content_kind: NSXMLDocumentContentKind,
169 );
170
171 #[cfg(feature = "NSString")]
172 #[unsafe(method(MIMEType))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn MIMEType(&self) -> Option<Retained<NSString>>;
176
177 #[cfg(feature = "NSString")]
178 #[unsafe(method(setMIMEType:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn setMIMEType(&self, mime_type: Option<&NSString>);
182
183 #[cfg(feature = "NSXMLDTD")]
184 #[unsafe(method(DTD))]
186 #[unsafe(method_family = none)]
187 pub unsafe fn DTD(&self) -> Option<Retained<NSXMLDTD>>;
188
189 #[cfg(feature = "NSXMLDTD")]
190 #[unsafe(method(setDTD:))]
192 #[unsafe(method_family = none)]
193 pub unsafe fn setDTD(&self, dtd: Option<&NSXMLDTD>);
194
195 #[cfg(feature = "NSXMLElement")]
196 #[unsafe(method(setRootElement:))]
198 #[unsafe(method_family = none)]
199 pub unsafe fn setRootElement(&self, root: &NSXMLElement);
200
201 #[cfg(feature = "NSXMLElement")]
202 #[unsafe(method(rootElement))]
204 #[unsafe(method_family = none)]
205 pub unsafe fn rootElement(&self) -> Option<Retained<NSXMLElement>>;
206
207 #[unsafe(method(insertChild:atIndex:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn insertChild_atIndex(&self, child: &NSXMLNode, index: NSUInteger);
211
212 #[cfg(feature = "NSArray")]
213 #[unsafe(method(insertChildren:atIndex:))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn insertChildren_atIndex(
217 &self,
218 children: &NSArray<NSXMLNode>,
219 index: NSUInteger,
220 );
221
222 #[unsafe(method(removeChildAtIndex:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn removeChildAtIndex(&self, index: NSUInteger);
226
227 #[cfg(feature = "NSArray")]
228 #[unsafe(method(setChildren:))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn setChildren(&self, children: Option<&NSArray<NSXMLNode>>);
232
233 #[unsafe(method(addChild:))]
235 #[unsafe(method_family = none)]
236 pub unsafe fn addChild(&self, child: &NSXMLNode);
237
238 #[unsafe(method(replaceChildAtIndex:withNode:))]
240 #[unsafe(method_family = none)]
241 pub unsafe fn replaceChildAtIndex_withNode(&self, index: NSUInteger, node: &NSXMLNode);
242
243 #[cfg(feature = "NSData")]
244 #[unsafe(method(XMLData))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn XMLData(&self) -> Retained<NSData>;
248
249 #[cfg(all(feature = "NSData", feature = "NSXMLNodeOptions"))]
250 #[unsafe(method(XMLDataWithOptions:))]
252 #[unsafe(method_family = none)]
253 pub unsafe fn XMLDataWithOptions(&self, options: NSXMLNodeOptions) -> Retained<NSData>;
254
255 #[cfg(all(
256 feature = "NSData",
257 feature = "NSDictionary",
258 feature = "NSError",
259 feature = "NSString"
260 ))]
261 #[unsafe(method(objectByApplyingXSLT:arguments:error:_))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn objectByApplyingXSLT_arguments_error(
265 &self,
266 xslt: &NSData,
267 arguments: Option<&NSDictionary<NSString, NSString>>,
268 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
269
270 #[cfg(all(feature = "NSDictionary", feature = "NSError", feature = "NSString"))]
271 #[unsafe(method(objectByApplyingXSLTString:arguments:error:_))]
273 #[unsafe(method_family = none)]
274 pub unsafe fn objectByApplyingXSLTString_arguments_error(
275 &self,
276 xslt: &NSString,
277 arguments: Option<&NSDictionary<NSString, NSString>>,
278 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
279
280 #[cfg(all(
281 feature = "NSDictionary",
282 feature = "NSError",
283 feature = "NSString",
284 feature = "NSURL"
285 ))]
286 #[unsafe(method(objectByApplyingXSLTAtURL:arguments:error:_))]
288 #[unsafe(method_family = none)]
289 pub unsafe fn objectByApplyingXSLTAtURL_arguments_error(
290 &self,
291 xslt_url: &NSURL,
292 argument: Option<&NSDictionary<NSString, NSString>>,
293 ) -> Result<Retained<AnyObject>, Retained<NSError>>;
294
295 #[cfg(feature = "NSError")]
296 #[unsafe(method(validateAndReturnError:_))]
297 #[unsafe(method_family = none)]
298 pub unsafe fn validateAndReturnError(&self) -> Result<(), Retained<NSError>>;
299 );
300}
301
302#[cfg(feature = "NSXMLNode")]
304impl NSXMLDocument {
305 extern_methods!(
306 #[unsafe(method(initWithKind:))]
314 #[unsafe(method_family = init)]
315 pub unsafe fn initWithKind(this: Allocated<Self>, kind: NSXMLNodeKind) -> Retained<Self>;
316
317 #[cfg(feature = "NSXMLNodeOptions")]
318 #[unsafe(method(initWithKind:options:))]
320 #[unsafe(method_family = init)]
321 pub unsafe fn initWithKind_options(
322 this: Allocated<Self>,
323 kind: NSXMLNodeKind,
324 options: NSXMLNodeOptions,
325 ) -> Retained<Self>;
326 );
327}
328
329#[cfg(feature = "NSXMLNode")]
331impl NSXMLDocument {
332 extern_methods!(
333 #[unsafe(method(new))]
334 #[unsafe(method_family = new)]
335 pub unsafe fn new() -> Retained<Self>;
336 );
337}