]> err.no Git - sope/blob - libFoundation/Foundation/NSURLHandle.h
fixed some NGMail framework build issue
[sope] / libFoundation / Foundation / NSURLHandle.h
1 /* 
2    NSURLHandle.h
3
4    Copyright (C) 2000 MDlink GmbH, Helge Hess
5    All rights reserved.
6
7    Author: Helge Hess <helge.hess@mdlink.de>
8
9    This file is part of libFoundation.
10
11    Permission to use, copy, modify, and distribute this software and its
12    documentation for any purpose and without fee is hereby granted, provided
13    that the above copyright notice appear in all copies and that both that
14    copyright notice and this permission notice appear in supporting
15    documentation.
16
17    We disclaim all warranties with regard to this software, including all
18    implied warranties of merchantability and fitness, in no event shall
19    we be liable for any special, indirect or consequential damages or any
20    damages whatsoever resulting from loss of use, data or profits, whether in
21    an action of contract, negligence or other tortious action, arising out of
22    or in connection with the use or performance of this software.
23 */
24
25 #ifndef __NSURLHandle_h__
26 #define __NSURLHandle_h__
27
28 #include <Foundation/NSObject.h>
29
30 @class NSURL, NSURLHandle, NSString, NSData, NSMutableArray;
31
32 @protocol NSURLHandleClient
33
34 - (void)URLHandleResourceDidBeginLoading:(NSURLHandle *)_handler;
35 - (void)URLHandleResourceDidCancelLoading:(NSURLHandle *)_handler;
36 - (void)URLHandleResourceDidFinishLoading:(NSURLHandle *)_handler;
37
38 - (void)URLHandle:(NSURLHandle *)_handler
39   resourceDataDidBecomeAvailable:(NSData *)_data;
40 - (void)URLHandle:(NSURLHandle *)_handler
41   resourceDidFailLoadingWithReason:(NSString *)_reason;
42
43 @end
44
45 typedef enum {
46     NSURLHandleNotLoaded,
47     NSURLHandleLoadSucceeded,
48     NSURLHandleLoadInProgress,
49     NSURLHandleLoadFailed
50 } NSURLHandleStatus;
51
52 @interface NSURLHandle : NSObject
53 {
54     NSMutableArray *clients;
55 }
56
57 + (Class)URLHandleClassForURL:(NSURL *)_url;
58 + (void)registerURLHandleClass:(Class)_clazz;
59
60 + (NSURLHandle *)cachedHandleForURL:(NSURL *)_url;
61 + (BOOL)canInitWithURL:(NSURL *)_url;
62
63 - (id)initWithURL:(NSURL *)_url cached:(BOOL)_flag;
64
65 /* loading */
66
67 - (NSData *)loadInForeground;
68 - (void)loadInBackground;
69 - (void)beginLoadInBackground;
70 - (void)endLoadInBackground;
71 - (NSURLHandleStatus)status;
72
73 /* clients */
74
75 - (void)addClient:(id<NSURLHandleClient>)_client;
76 - (void)removeClient:(id<NSURLHandleClient>)_client;
77
78 /* reading data */
79
80 - (NSData *)resourceData;
81 - (void)flushCachedData;
82
83 /* writing data */
84
85 - (BOOL)writeData:(NSData *)_data;
86
87 /* properties */
88
89 - (id)propertyForKey:(NSString *)_propertyKey;
90 - (id)propertyForKeyIfAvailable:(NSString *)_propertyKey;
91 - (BOOL)writeProperty:(id)_propValue forKey:(NSString *)_propertyKey;
92
93 @end
94
95 #endif /* __NSURLHandle_h__ */
96
97 /*
98   Local Variables:
99   c-basic-offset: 4
100   tab-width: 8
101   End:
102 */