-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathIRRemoteResourceDownloadOperation.h
More file actions
66 lines (45 loc) · 2.69 KB
/
IRRemoteResourceDownloadOperation.h
File metadata and controls
66 lines (45 loc) · 2.69 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//
// IRRemoteResourceDownloadOperation.h
// IRWebAPIKit
//
// Created by Evadne Wu on 9/16/11.
// Copyright (c) 2011 Iridia Productions. All rights reserved.
//
#import "IRWebAPIKit.h"
#import <TargetConditionals.h>
#if TARGET_OS_IPHONE
#import <MobileCoreServices/MobileCoreServices.h>
#else
#import <ApplicationServices/ApplicationServices.h>
#endif
@class IRRemoteResourceDownloadOperation;
@protocol IRRemoteResourceDownloadOperationDelegate <NSObject>
- (void) remoteResourceDownloadOperationWillBegin:(IRRemoteResourceDownloadOperation *)anOperation;
// @optional
// - (void) remoteResourceDownloadOperation:(IRRemoteResourceDownloadOperation *)anOperation didChangeProgress:(float_t)currentProgress;
// - (void) remoteResourceDownloadOperationDidEnd:(IRRemoteResourceDownloadOperation *)anOperation successfully:(BOOL)wasCompleted;
@end
@interface IRRemoteResourceDownloadOperation : NSOperation
+ (IRRemoteResourceDownloadOperation *) operationWithURL:(NSURL *)aRemoteURL path:(NSString *)aLocalPath prelude:(void(^)(void))aPrelude completion:(void(^)(void))aBlock;
@property (nonatomic, readonly, copy) NSString *path;
@property (nonatomic, readonly, copy) NSString *mimeType;
@property (nonatomic, readonly, retain) NSURL *url;
@property (nonatomic, readonly, assign) long long processedBytes;
@property (nonatomic, readonly, assign) long long totalBytes;
@property (nonatomic, readonly, assign) long long preferredByteOffset;
@property (nonatomic, readonly, assign, getter=isExecuting) BOOL executing;
@property (nonatomic, readonly, assign, getter=isFinished) BOOL finished;
@property (nonatomic, readonly, assign, getter=isCancelled) BOOL cancelled;
@property (nonatomic, readonly, assign) float_t progress; // Convenience
@property (nonatomic, readwrite, assign) id<IRRemoteResourceDownloadOperationDelegate> delegate;
- (void) appendCompletionBlock:(void(^)(void))aBlock;
- (void) invokeCompletionBlocks;
- (IRRemoteResourceDownloadOperation *) continuationOperationCancellingCurrentOperation:(BOOL)cancelsCurrentOperation;
// The appended completion blocks will only be invoked if the operation finishes successfully; otherwise, as in cases where [anOperation continuationOperationCancellingCurrentOperation:YES] is invoked,
// The blocks will be transferred to the continuation operation, and the original operation will be cancelled.
- (NSURLConnection *) underlyingConnection;
- (NSMutableURLRequest *) underlyingRequest;
// may be nil if nothing, but usually there after -remoteResourceDownloadOperationWillBegin
@end
extern NSString * const kIRRemoteResourceDownloadOperationDidReceiveDataNotification;
extern NSString * const kIRRemoteResourceDownloadOperationURL; // user info key pointing to NSURL