Repository navigation
Expand file tree
/
Copy pathDBDeltaEntry.m
More file actions
executable file
·63 lines (50 loc) · 1.56 KB
/
Copy pathDBDeltaEntry.m
File metadata and controls
executable file
·63 lines (50 loc) · 1.56 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
//
// DBDeltaEntry.m
// DropboxSDK
//
// Created by Brian Smith on 3/25/12.
// Copyright (c) 2012 Dropbox, Inc. All rights reserved.
//
#import "DBDeltaEntry.h"
@implementation DBDeltaEntry
@synthesize lowercasePath;
@synthesize metadata;
- (id)initWithArray:(NSArray *)array {
if ((self = [super init])) {
lowercasePath = [[array objectAtIndex:0] retain];
NSObject *maybeMetadata = [array objectAtIndex:1];
if (maybeMetadata != [NSNull null]) {
metadata = [[DBMetadata alloc] initWithDictionary:[array objectAtIndex:1]];
}
}
return self;
}
- (void)dealloc {
[lowercasePath release];
[metadata release];
[super dealloc];
}
- (BOOL)isEqualToDeltaEntry:(DBDeltaEntry *)entry {
if (self == entry) return YES;
return
(lowercasePath == entry.lowercasePath || [lowercasePath isEqual:entry.lowercasePath]) &&
(metadata == entry.metadata || [metadata isEqual:entry.metadata]);
}
- (BOOL)isEqual:(id)other {
if (other == self) return YES;
if (!other || ![other isKindOfClass:[self class]]) return NO;
return [self isEqualToDeltaEntry:other];
}
#pragma mark NSCoding methods
- (id)initWithCoder:(NSCoder*)coder {
if ((self = [super init])) {
lowercasePath = [[coder decodeObjectForKey:@"lowercasePath"] retain];
metadata = [[coder decodeObjectForKey:@"metadata"] retain];
}
return self;
}
- (void)encodeWithCoder:(NSCoder*)coder {
[coder encodeObject:lowercasePath forKey:@"lowercasePath"];
[coder encodeObject:metadata forKey:@"metadata"];
}
@end