/
NeoVimWindow.m
52 lines (41 loc) · 1.36 KB
/
NeoVimWindow.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
//
// Created by Tae Won Ha on 22/10/16.
// Copyright (c) 2016 Tae Won Ha. All rights reserved.
//
#import "NeoVimWindow.h"
#import "NeoVimBuffer.h"
@implementation NeoVimWindow
- (instancetype)initWithHandle:(NSInteger)handle buffer:(NeoVimBuffer *)buffer currentInTab:(bool)current {
self = [super init];
if (self == nil) {
return nil;
}
_handle = handle;
_buffer = buffer;
_isCurrentInTab = current;
return self;
}
- (NSString *)description {
NSMutableString *description = [NSMutableString stringWithFormat:@"<%@: ", NSStringFromClass([self class])];
[description appendFormat:@"self.handle=%li", self.handle];
[description appendFormat:@", self.buffer=%@", self.buffer];
[description appendFormat:@", self.currentInTab=%d", self.isCurrentInTab];
[description appendString:@">"];
return description;
}
- (void)encodeWithCoder:(NSCoder *)coder {
[coder encodeObject:@(self.handle) forKey:@"handle"];
[coder encodeObject:self.buffer forKey:@"buffer"];
[coder encodeBool:self.isCurrentInTab forKey:@"currentInTab"];
}
- (instancetype)initWithCoder:(NSCoder *)coder {
self = [super init];
if (self) {
NSNumber *objHandle = [coder decodeObjectForKey:@"handle"];
_handle = objHandle.integerValue;
_buffer = [coder decodeObjectForKey:@"buffer"];
_isCurrentInTab = [coder decodeBoolForKey:@"currentInTab"];
}
return self;
}
@end