/
BookmarksManager.m
49 lines (41 loc) · 1.05 KB
/
BookmarksManager.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
//
// BookmarksManager.m
// SpeedDial
//
// Created by Peter Hosey on 2016-07-23.
// Copyright © 2016 Peter Hosey. All rights reserved.
//
#import "BookmarksManager.h"
@implementation BookmarksManager
{
NSMutableArray <VNCBookmark *> *_bookmarks;
}
- (instancetype)init {
if ((self = [super init])) {
_bookmarks = [NSMutableArray new];
}
return self;
}
- (NSUInteger) count {
return _bookmarks.count;
}
- (VNCBookmark *_Nonnull) objectAtIndexedSubscript:(NSUInteger)idx {
return [_bookmarks objectAtIndexedSubscript:idx];
}
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
objects:(__unsafe_unretained id _Nonnull *)buffer
count:(NSUInteger)len
{
return [_bookmarks countByEnumeratingWithState:state
objects:buffer
count:len];
}
- (VNCBookmark *_Nonnull) addNewEmptyBookmarkAtEnd {
VNCBookmark *_Nonnull const newBookmark = [VNCBookmark new];
[_bookmarks addObject:newBookmark];
return newBookmark;
}
- (void) removeBookmarksAtIndexes:(NSIndexSet *_Nonnull)indexes {
[_bookmarks removeObjectsAtIndexes:indexes];
}
@end