1/*
2 * Copyright (C) 2004, 2005 Apple Computer, Inc.  All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 *
8 * 1.  Redistributions of source code must retain the above copyright
9 *     notice, this list of conditions and the following disclaimer.
10 * 2.  Redistributions in binary form must reproduce the above copyright
11 *     notice, this list of conditions and the following disclaimer in the
12 *     documentation and/or other materials provided with the distribution.
13 * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
14 *     its contributors may be used to endorse or promote products derived
15 *     from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#import <Foundation/Foundation.h>
30
31@class WebArchivePrivate;
32@class WebResource;
33
34/*!
35    @const WebArchivePboardType
36    @abstract The pasteboard type constant used when adding or accessing a WebArchive on the pasteboard.
37*/
38extern NSString *WebArchivePboardType;
39
40/*!
41    @class WebArchive
42    @discussion WebArchive represents a main resource as well as all the subresources and subframes associated with the main resource.
43    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.
44    This class can be used for saving standalone web pages, representing portions of a web page on the pasteboard, or any other
45    application where one class is needed to represent rich web content.
46*/
47@interface WebArchive : NSObject <NSCoding, NSCopying>
48{
49    @private
50    WebArchivePrivate *_private;
51}
52
53/*!
54    @method initWithMainResource:subresources:subframeArchives:
55    @abstract The initializer for WebArchive.
56    @param mainResource The main resource of the archive.
57    @param subresources The subresources of the archive (can be nil).
58    @param subframeArchives The archives representing the subframes of the archive (can be nil).
59    @result An initialized WebArchive.
60*/
61- (id)initWithMainResource:(WebResource *)mainResource subresources:(NSArray *)subresources subframeArchives:(NSArray *)subframeArchives;
62
63/*!
64    @method initWithData:
65    @abstract The initializer for creating a WebArchive from data.
66    @param data The data representing the archive. This can be obtained using WebArchive's data method.
67    @result An initialized WebArchive.
68*/
69- (id)initWithData:(NSData *)data;
70
71/*!
72    @method mainResource
73    @result The main resource of the archive.
74*/
75- (WebResource *)mainResource;
76
77/*!
78    @method subresources
79    @result The subresource of the archive (can be nil).
80*/
81- (NSArray *)subresources;
82
83/*!
84    @method subframeArchives
85    @result The archives representing the subframes of the archive (can be nil).
86*/
87- (NSArray *)subframeArchives;
88
89/*!
90    @method data
91    @result The data representation of the archive.
92    @discussion 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
93    using WebArchivePboardType. To create a WebArchive using the returned data, call initWithData:.
94*/
95- (NSData *)data;
96
97@end
98