Repository navigation
Expand file tree
/
Copy pathFindContext.h
More file actions
75 lines (58 loc) · 1.91 KB
/
Copy pathFindContext.h
File metadata and controls
75 lines (58 loc) · 1.91 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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//
// FindContext.h
// iTerm
//
// Created by George Nachman on 10/26/13.
//
//
#import <Foundation/Foundation.h>
#define FindOptCaseInsensitive (1 << 0)
#define FindOptBackwards (1 << 1)
#define FindOptRegex (1 << 2)
#define FindMultipleResults (1 << 3)
typedef enum {
Searching,
Matched,
NotFound
} FindContextStatus;
@interface FindContext : NSObject {
int absBlockNum_;
NSString* substring_;
int options_;
int dir_;
int offset_;
int stopAt_;
FindContextStatus status_;
int matchLength_;
NSMutableArray* results_;
BOOL hasWrapped_;
NSTimeInterval maxTime_;
};
// Current absolute block number being searched.
@property(nonatomic, assign) int absBlockNum;
// The substring to search for.
@property(nonatomic, copy) NSString *substring;
// A bitwise OR of the options defined above.
@property(nonatomic, assign) int options;
// 1: search forward. -1: search backward.
@property(nonatomic, assign) int dir;
// The offset within a block to begin searching. -1 means the end of the
// block.
@property(nonatomic, assign) int offset;
// The offset within a block at which to stop searching. No results
// with an offset at or beyond this position will be returned.
@property(nonatomic, assign) int stopAt;
// Searching: a search is in progress and this context can be used to search.
// Matched: At least one result has been found. This context can be used to
// search again.
// NotFound: No results were found and the end of the buffer was reached.
@property(nonatomic, assign) FindContextStatus status;
@property(nonatomic, assign) int matchLength;
// used for multiple results
@property(nonatomic, retain) NSMutableArray *results;
// for client use. Not read or written by LineBuffer.
@property(nonatomic, assign) BOOL hasWrapped;
@property(nonatomic, assign) NSTimeInterval maxTime;
- (void)copyFromFindContext:(FindContext *)other;
- (void)reset;
@end