forked from nolanw/HTMLReader
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHTMLOrderedDictionary.h
More file actions
40 lines (31 loc) · 1.21 KB
/
HTMLOrderedDictionary.h
File metadata and controls
40 lines (31 loc) · 1.21 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
// HTMLOrderedDictionary.h
//
// Public domain. https://github.com/nolanw/HTMLReader
#import <Foundation/Foundation.h>
#import "HTMLSupport.h"
/**
* An HTMLOrderedDictionary is a mutable dictionary type that maintains its keys' insertion order.
*/
@interface HTMLOrderedDictionary : NSMutableDictionary
- (instancetype)initWithCapacity:(NSUInteger)numItems NS_DESIGNATED_INITIALIZER;
/**
* Returns the location of a key in the dictionary, or NSNotFound if the key is not present.
*/
- (NSUInteger)indexOfKey:(id)key;
/**
* Moves or inserts a key in the dictionary, then pairs an object with that key. Throws an exception if either object or key is nil, or if index is out of bounds.
*/
- (void)insertObject:(id)object forKey:(id <NSCopying>)key atIndex:(NSUInteger)index;
/**
* Returns the key at a particular index in the dictionary. Throws an exception if index is out of bounds.
*/
- (id)objectAtIndexedSubscript:(NSUInteger)index;
/**
* Returns the key at index 0 in the dictionary, or nil if the dictionary is empty.
*/
@property (readonly, nonatomic) id firstKey;
/**
* Returns the key at index (count - 1) in the dictionary, or nil if the dictionary is empty.
*/
@property (readonly, nonatomic) id lastKey;
@end