This repository has been archived by the owner on Apr 13, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
STRemoteObject.h
70 lines (50 loc) · 1.71 KB
/
STRemoteObject.h
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
67
68
69
70
//
// RemoteObject.h
//
// Created by Tom Whipple on 12/20/10.
// Copyright 2010 Smartovation Technologies, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
#define kRemoteObjectUpdatedNotification @"RemoteObjectUpdated"
#define kRemoteObjectLoadFailedNotification @"RemoteObjectLoadFailed"
#ifdef DEBUG_REMOTE_OBJECT
#define STDebugRemoteLog(x,...) NSLog(x,##__VA_ARGS__)
#else
#define STDebugRemoteLog( x, ... )
#endif
// This is a NSURLConnection delegate (informal)
@interface STRemoteObject : NSObject {
@protected
NSURL* originalURL;
NSURL* resourceURL;
NSString* filename;
NSString* mimeType;
NSString* cacheFileName;
NSURLRequestCachePolicy cachePolicy;
@private
NSURLConnection* connection;
NSData* contentData;
NSMutableData* downloadDataStore;
NSMutableSet* duplicateObjects;
BOOL shouldCheckServer;
BOOL shouldCheckBundle;
}
-(id) initWithURL:(NSURL*) url;
-(void) fetch;
// subclasses can override these if they call super.
- (void) dataDidLoad;
- (void) dataLoadFailed:(NSError*)error;
- (void) cancel;
@property (nonatomic,readonly) NSString* mimeType;
@property (nonatomic,readonly) NSData* contentData;
@property (nonatomic,readonly) BOOL downloadInProgress;
@property (nonatomic,assign) BOOL shouldCheckServer;
@property (nonatomic,assign) BOOL shouldCheckBundle;
@property (nonatomic,readonly) NSURL* originalURL;
@property (nonatomic,readonly) NSURL* resourceURL;
@property (nonatomic,readonly) NSURL* cacheFileURL;
@property (nonatomic,retain) NSString* cacheFileName;
@property (nonatomic,readonly) NSMutableSet* duplicateObjects;
// mostly useful for debugging -- will delete everything in the App's cache directory
+(void) deleteAllCachedObjects;
@end