forked from jlongster/objective-c-csv-parser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSVParser.h
42 lines (36 loc) · 1.21 KB
/
CSVParser.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
//
// CSV Parser implementation copied from the following blog post.
//
// http://cocoawithlove.com/2009/11/writing-parser-using-nsscanner-csv.html
//
// ***
//
// Created by Matt Gallagher on 2009/11/30.
// Copyright 2009 Matt Gallagher. All rights reserved.
//
// Permission is given to use this source code file, free of charge, in any
// project, commercial or otherwise, entirely at your risk, with the condition
// that any redistribution (in part or whole) of source code must retain
// this copyright and permission notice. Attribution in compiled projects is
// appreciated but not required.
//
#import <Foundation/Foundation.h>
@interface CSVParser : NSObject {
FILE *file;
NSScanner *scanner;
NSString *separator;
NSMutableArray *fieldNames;
NSCharacterSet *endTextCharacterSet;
BOOL separatorIsSingleChar;
}
- (id)initWithString:(NSString *)aCSVString
separator:(NSString *)aSeparatorString
hasHeader:(BOOL)header
fieldNames:(NSArray *)names;
- (id)initWithFile:(NSString *)filename
separator:(NSString *)aSeparatorString
hasHeader:(BOOL)header
fieldNames:(NSArray *)names;
- (NSArray *)rows;
- (NSDictionary *)nextRow;
@end