-
Notifications
You must be signed in to change notification settings - Fork 17
/
MPWSmallStringTable.h
64 lines (50 loc) · 1.72 KB
/
MPWSmallStringTable.h
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
//
// MPWSmallStringTable.h
// MPWFoundation
//
// Created by Marcel Weiher on 29/3/07.
// Copyright 2007-2017 by Marcel Weiher. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <MPWFoundation/MPWObject.h>
#import <MPWFoundation/AccessorMacros.h>
typedef id (*LOOKUPIMP)(id, SEL, char*, int);
typedef struct {
int index;
int length;
int offset;
int next;
} StringTableIndex;
@interface MPWSmallStringTable : NSDictionary {
int __retainCount;
int flags;
int tableLength;
unsigned char *table;
__strong id *tableValues;
StringTableIndex *tableIndex;
int *chainStarts;
int *tableOffsetsPerLength;
int maxLen;
id defaultValue;
BOOL caseInsensitive;
@public
LOOKUPIMP __stringTableLookupFun;
}
//extern IMP __stringTableLookupFun;
-initWithKeys:(NSArray*)keys values:(NSArray*)values;
-(NSUInteger)count;
-objectForKey:(NSString*)key;
-objectAtIndex:(NSUInteger)anIndex;
-objectForCString:(const char*)cstr length:(int)len;
-objectForCString:(const char*)cstr;
-(int)offsetForCString:(const char*)cstr length:(int)len;
-(int)offsetForCString:(const char*)cstr;
-keyAtIndex:(NSUInteger)anIndex;
-(void)setObject:anObject forKey:aKey;
-(void)setObject:anObject forCString:(const char*)aKey length:(int)len;
-(void)replaceObjectAtIndex:(NSUInteger)anIndex withObject:(id)anObject;
-(int)offsetForKey:(NSString*)key;
idAccessor_h( defaultValue, setDefaultValue )
#define OBJECTFORSTRINGLENGTH( table, str, stlen ) (table->__stringTableLookupFun( table, @selector(objectForCString:length:) , (char*)str, (int)stlen ))
#define OBJECTFORCONSTANTSTRING( table, str ) OBJECTFORSTRINGLENGTH( table, str, (sizeof str) -1 )
@end