/
CHCSVParser.h
42 lines (29 loc) · 1.09 KB
/
CHCSVParser.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
//
// CHCSVParser.h
// CHCSVParser
//
// Created by Dave DeLong on 9/22/12.
//
//
#import <Foundation/Foundation.h>
@class CHCSVParser;
@protocol CHCSVParserDelegate <NSObject>
@optional
- (void)parserDidBeginDocument:(CHCSVParser *)parser;
- (void)parserDidEndDocument:(CHCSVParser *)parser;
- (void)parser:(CHCSVParser *)parser didBeginLine:(NSUInteger)recordNumber;
- (void)parser:(CHCSVParser *)parser didEndLine:(NSUInteger)recordNumber;
- (void)parser:(CHCSVParser *)parser didReadField:(NSString *)field;
- (void)parser:(CHCSVParser *)parser didFailWithError:(NSError *)error;
@end
@interface CHCSVParser : NSObject
@property (assign) id<CHCSVParserDelegate> delegate;
@property (assign) BOOL recognizesBackslashesAsEscapes; // default is YES
@property (assign) BOOL sanitizesFields; // default is NO
// designated initializer
- (id)initWithInputStream:(NSInputStream *)stream usedEncoding:(NSStringEncoding *)encoding delimiter:(unichar)delimiter;
- (id)initWithCSVString:(NSString *)csv;
- (id)initWithContentsOfCSVFile:(NSString *)csvFilePath;
- (void)parse;
- (void)cancelParsing;
@end