forked from enormego/egodatabase
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EGODatabaseRequestBlock.m
44 lines (34 loc) · 978 Bytes
/
EGODatabaseRequestBlock.m
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
//
// EGODatabaseRequestBlock.m
//
// Created by Constantine Mureev on 9/1/11.
//
#import "EGODatabaseRequestBlock.h"
@interface OperationCallback ()
@property (readwrite, nonatomic, copy) id successBlock;
@property (readwrite, nonatomic, copy) id errorBlock;
@end
@implementation OperationCallback
@synthesize successBlock = _successBlock;
@synthesize errorBlock = _errorBlock;
+ (id)blockWithSuccess:(id)success error:(id)error {
id callback = [[[self alloc] init] autorelease];
[callback setSuccessBlock:success];
[callback setErrorBlock:error];
return callback;
}
- (id)init {
if ([self class] == [OperationCallback class]) {
[NSException raise:NSInternalInconsistencyException format:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)];
}
return [super init];
}
- (void)dealloc {
[_successBlock release];
[_errorBlock release];
[super dealloc];
}
@end
@implementation EGODatabaseRequestBlock
@dynamic successBlock, errorBlock;
@end