-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDBQuota.m
More file actions
52 lines (40 loc) · 1.28 KB
/
DBQuota.m
File metadata and controls
52 lines (40 loc) · 1.28 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
//
// DBQuotaInfo.m
// DropboxSDK
//
// Created by Brian Smith on 5/3/10.
// Copyright 2010 Dropbox, Inc. All rights reserved.
//
#import "DBQuota.h"
@implementation DBQuota
- (id)initWithDictionary:(NSDictionary*)dict {
if ((self = [super init])) {
normalConsumedBytes = [[dict objectForKey:@"normal"] longLongValue];
sharedConsumedBytes = [[dict objectForKey:@"shared"] longLongValue];
totalBytes = [[dict objectForKey:@"quota"] longLongValue];
}
return self;
}
- (void)dealloc {
[super dealloc];
}
@synthesize normalConsumedBytes;
@synthesize sharedConsumedBytes;
@synthesize totalBytes;
- (long long)totalConsumedBytes {
return normalConsumedBytes + sharedConsumedBytes;
}
#pragma mark NSCoding methods
- (void)encodeWithCoder:(NSCoder*)coder {
[coder encodeInt64:normalConsumedBytes forKey:@"normalConsumedBytes"];
[coder encodeInt64:sharedConsumedBytes forKey:@"sharedConsumedBytes"];
[coder encodeInt64:totalBytes forKey:@"totalBytes"];
}
- (id)initWithCoder:(NSCoder*)coder {
self = [super init];
normalConsumedBytes = [coder decodeInt64ForKey:@"normalConsumedBytes"];
sharedConsumedBytes = [coder decodeInt64ForKey:@"sharedConsumedBytes"];
totalBytes = [coder decodeInt64ForKey:@"totalBytes"];
return self;
}
@end