forked from saurabhg/dragon_rador
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Friend.m
74 lines (60 loc) · 1.5 KB
/
Friend.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
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
//
// Friend.m
// DragonRador
//
// Created by Motohiro Takayama on 6/15/09.
// Copyright 2009 deadbeaf.org. All rights reserved.
//
#import "Friend.h"
@implementation Friend
@synthesize name, image_url, image, location, last_update;
- (id) initWithName:(NSString *)nm
{
if (self = [super init]) {
self.name = nm;
}
return self;
}
- (void) dealloc
{
[name release];
if (image) [image release];
if (location) [location release];
if (last_update) [last_update release];
[super dealloc];
}
#pragma mark NSCoding
- (id) initWithCoder:(NSCoder *) decoder
{
self.name = [decoder decodeObjectForKey:@"name"];
self.image_url = [decoder decodeObjectForKey:@"image_url"];
self.location = [decoder decodeObjectForKey:@"location"];
self.last_update = [decoder decodeObjectForKey:@"last_update"];
return self;
}
- (void) encodeWithCoder:(NSCoder *)encoder
{
[encoder encodeObject:name forKey:@"name"];
[encoder encodeObject:image_url forKey:@"image_url"];
[encoder encodeObject:location forKey:@"location"];
[encoder encodeObject:last_update forKey:@"last_update"];
}
#pragma mark --
- (void) update
{
}
- (void) cacheImage
{
}
- (BOOL) isEqual:(id) other
{
NSLog(@"Friend:isEqual");
Friend *other_friend = (Friend *)other;
return [name isEqualToString:other_friend.name];
}
- (NSString *) description
{
return [NSString stringWithFormat:@"Friend %p: name=%@", self, name];
//return [NSString stringWithFormat:@"Friend %p: name=%@", self, @"hoge"];
}
@end