summaryrefslogtreecommitdiffstats
path: root/Classes/Fetcher.h
blob: cc32abaa15114ac8f50302e283ea523c55bb1b37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
//  Fetcher.h
//  PicCast
//
//  Created by Matthew Handler on 4/26/11.
//  Copyright 2011 Earl Industries. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol FetcherDelegate

- (void) connection:(NSURLConnection *)connection failedWithError:(NSError *)error;
- (void) connection:(NSURLConnection *)connection finishedWithData:(NSData *)data;

@optional

- (void) connection:(NSURLConnection *)connection failedWithError:(NSError *)error andPayload:(id)payload;
- (void) connection:(NSURLConnection *)connection finishedWithData:(NSData *)data andPayload:(id)payload;

@end


@interface Fetcher : NSObject <NSURLProtocolClient> {
	NSMutableData *receivedData;
	id<FetcherDelegate> delegate;
	id payload;
}

@property (nonatomic, assign) id<FetcherDelegate> delegate;
@property (nonatomic, retain) id payload;

+ (Fetcher *) initWithString:(NSString *)string payload:(id)p andDelegate:(id <FetcherDelegate>)d;
+ (Fetcher *) initWithString:(NSString *)string andDelegate:(id <FetcherDelegate>)d;
- (void) setUrlAndConnect:(NSString *)string;

@end