objc2_web_kit/generated/WebArchive.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern "C" {
10 /// The pasteboard type constant used when adding or accessing a WebArchive on the pasteboard.
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webarchivepboardtype?language=objc)
13 #[deprecated]
14 pub static WebArchivePboardType: Option<&'static NSString>;
15}
16
17extern_class!(
18 /// WebArchive represents a main resource as well as all the subresources and subframes associated with the main resource.
19 /// The main resource can be an entire web page, a portion of a web page, or some other kind of data such as an image.
20 /// This class can be used for saving standalone web pages, representing portions of a web page on the pasteboard, or any other
21 /// application where one class is needed to represent rich web content.
22 ///
23 /// See also [Apple's documentation](https://developer.apple.com/documentation/webkit/webarchive?language=objc)
24 #[unsafe(super(NSObject))]
25 #[derive(Debug, PartialEq, Eq, Hash)]
26 #[deprecated]
27 pub struct WebArchive;
28);
29
30extern_conformance!(
31 unsafe impl NSCoding for WebArchive {}
32);
33
34extern_conformance!(
35 unsafe impl NSCopying for WebArchive {}
36);
37
38unsafe impl CopyingHelper for WebArchive {
39 type Result = Self;
40}
41
42extern_conformance!(
43 unsafe impl NSObjectProtocol for WebArchive {}
44);
45
46impl WebArchive {
47 extern_methods!(
48 #[cfg(feature = "WebResource")]
49 /// The initializer for WebArchive.
50 ///
51 /// Parameter `mainResource`: The main resource of the archive.
52 ///
53 /// Parameter `subresources`: The subresources of the archive (can be nil).
54 ///
55 /// Parameter `subframeArchives`: The archives representing the subframes of the archive (can be nil).
56 ///
57 /// Returns: An initialized WebArchive.
58 ///
59 /// # Safety
60 ///
61 /// - `main_resource` might not allow `None`.
62 /// - `subresources` generic should be of the correct type.
63 /// - `subresources` might not allow `None`.
64 /// - `subframe_archives` generic should be of the correct type.
65 /// - `subframe_archives` might not allow `None`.
66 #[deprecated]
67 #[unsafe(method(initWithMainResource:subresources:subframeArchives:))]
68 #[unsafe(method_family = init)]
69 pub unsafe fn initWithMainResource_subresources_subframeArchives(
70 this: Allocated<Self>,
71 main_resource: Option<&WebResource>,
72 subresources: Option<&NSArray>,
73 subframe_archives: Option<&NSArray>,
74 ) -> Option<Retained<Self>>;
75
76 /// The initializer for creating a WebArchive from data.
77 ///
78 /// Parameter `data`: The data representing the archive. This can be obtained using WebArchive's data method.
79 ///
80 /// Returns: An initialized WebArchive.
81 ///
82 /// # Safety
83 ///
84 /// `data` might not allow `None`.
85 #[deprecated]
86 #[unsafe(method(initWithData:))]
87 #[unsafe(method_family = init)]
88 pub unsafe fn initWithData(
89 this: Allocated<Self>,
90 data: Option<&NSData>,
91 ) -> Option<Retained<Self>>;
92
93 #[cfg(feature = "WebResource")]
94 /// The main resource of the archive.
95 #[deprecated]
96 #[unsafe(method(mainResource))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn mainResource(&self) -> Option<Retained<WebResource>>;
99
100 /// The subresource of the archive (can be nil).
101 #[deprecated]
102 #[unsafe(method(subresources))]
103 #[unsafe(method_family = none)]
104 pub unsafe fn subresources(&self) -> Retained<NSArray>;
105
106 /// The archives representing the subframes of the archive (can be nil).
107 #[deprecated]
108 #[unsafe(method(subframeArchives))]
109 #[unsafe(method_family = none)]
110 pub unsafe fn subframeArchives(&self) -> Retained<NSArray>;
111
112 /// The data representation of the archive.
113 ///
114 /// The data returned by this method can be used to save a web archive to a file or to place a web archive on the pasteboard
115 /// using WebArchivePboardType. To create a WebArchive using the returned data, call initWithData:.
116 #[deprecated]
117 #[unsafe(method(data))]
118 #[unsafe(method_family = none)]
119 pub unsafe fn data(&self) -> Retained<NSData>;
120 );
121}
122
123/// Methods declared on superclass `NSObject`.
124impl WebArchive {
125 extern_methods!(
126 #[unsafe(method(init))]
127 #[unsafe(method_family = init)]
128 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
129
130 #[unsafe(method(new))]
131 #[unsafe(method_family = new)]
132 pub unsafe fn new() -> Retained<Self>;
133 );
134}