-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathPort.m
56 lines (43 loc) · 1018 Bytes
/
Port.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
//
// Port.m
// KnockOnD
//
// Created by Oleksandr Tymoshenko on 09-09-12.
// Copyright 2009 BluezBox. All rights reserved.
//
#import "Port.h"
@implementation Port
@synthesize proto;
@synthesize port;
- (id) initWithPortNumber: (NSUInteger)num proto:(NSString*)protocol
{
self = [super init];
NSNumber *n = [[NSNumber alloc] initWithUnsignedLong:num];
[self setPort:n];
[self setProto:protocol];
return self;
}
- (id) initWithPort:(Port*) portObj
{
if (self = [super init])
{
[self setPort:[portObj port]];
[self setProto:[portObj proto]];
}
return self;
}
- (id) initWithCoder: (NSCoder *)coder
{
if (self = [super init])
{
[self setPort:[coder decodeObjectForKey:@"port"]];
[self setProto:[coder decodeObjectForKey:@"proto"]];
}
return self;
}
- (void) encodeWithCoder: (NSCoder *)coder
{
[coder encodeObject:self.port forKey:@"port"];
[coder encodeObject:self.proto forKey:@"proto"];
}
@end