-
Notifications
You must be signed in to change notification settings - Fork 0
/
HFRequest.h
77 lines (58 loc) · 2.17 KB
/
HFRequest.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
71
72
73
74
75
76
77
//
// HFRequest.h
// HFConnection
//
// Created by LiQiu Yu on 15-9-28.
// Copyright (c) 2015年 LiQiu Yu. All rights reserved.
//
#import <Foundation/Foundation.h>
//for arc and non-arc
#ifndef LW_STRONG
#if __has_feature(objc_arc)
#define LW_STRONG strong
#else
#define LW_STRONG retain
#endif
#endif
#ifndef LW_WEAK
#if __has_feature(objc_arc_weak)
#define LW_WEAK weak
#elif __has_feature(objc_arc)
#define LW_WEAK unsafe_unretained
#else
#define LW_WEAK assign
#endif
#endif
#if __has_feature(objc_arc)
#define LW_AUTORELEASE(exp) exp
#define LW_RELEASE(exp) exp
#define LW_RETAIN(exp) exp
#else
#define LW_AUTORELEASE(exp) [exp autorelease]
#define LW_RELEASE(exp) [exp release]
#define LW_RETAIN(exp) [exp retain]
#endif
#define DELEGATE_TYPE 0
#define BLOCK_TYPE 1
#define NOT_SAVE 0
#define SAVE_TO_FILE 1
@class HFConnectionOpertation;
@class HFResponse;
@protocol HFConnectionDelegate;
typedef void(^didFinishBlock) (HFResponse *re);
typedef void(^inProgressBlock) (HFResponse *re);
@interface HFRequest : NSObject
@property (nonatomic, LW_STRONG) NSString *requestTarget;
@property (nonatomic, LW_STRONG) NSString *requestURL;
@property (nonatomic, LW_STRONG) NSMutableURLRequest*request;
@property (nonatomic,copy) didFinishBlock finishBlock;
@property (nonatomic,copy) inProgressBlock inprogressBlock;
@property (nonatomic) int callBackType;
@property (nonatomic) int persistentType;
@property (nonatomic, LW_WEAK) id<HFConnectionDelegate> delegate;
- (id)initWithTraget:(NSString *)target requestURL:(NSString *)url delegate:(id<HFConnectionDelegate>)delegate_;
- (id)initWithTraget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer delegate:(id<HFConnectionDelegate>)delegate_;
- (id)initWithTarget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer finishHandler:(didFinishBlock)finishBlock_ inProgressHandler:(inProgressBlock)progressBlock_;
- (id)initWithTarget:(NSString *)target requestURL:(NSString *)url isPersistance:(BOOL) isPer delegate:(id<HFConnectionDelegate>)delegate_ finishHandler:(didFinishBlock)finishBlock_ inProgressHandler:(inProgressBlock)progressBlock_;
- (void)setFileOffSet:(unsigned long long) startOffset;
@end