forked from p2/quicklook-csv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSVRowObject.m
56 lines (39 loc) · 1.01 KB
/
CSVRowObject.m
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
//
// CSVRowObject.m
// QuickLookCSV
//
// Created by Pascal Pfiffner on 03.07.09.
// This sourcecode is released under the Apache License, Version 2.0
// http://www.apache.org/licenses/LICENSE-2.0.html
//
#import "CSVRowObject.h"
@implementation CSVRowObject
/**
* Instantiates an object with the given row-dictionary.
*/
+ (CSVRowObject *)newWithDictionary:(NSMutableDictionary *)dict
{
CSVRowObject *row = [CSVRowObject new];
if (dict) {
row.columns = dict;
}
return row;
}
#pragma mark Returning Columns
- (NSString *)columns:(NSArray *)columnKeys combinedByString:(NSString *)sepString
{
NSString *rowString = nil;
if ((nil != columnKeys) && (nil != _columns)) {
rowString = [[_columns objectsForKeys:columnKeys notFoundMarker:@""] componentsJoinedByString:sepString];
}
return rowString;
}
- (NSString *)columnForKey:(NSString *)columnKey
{
NSString *cellString = nil;
if ((nil != columnKey) && (nil != _columns)) {
cellString = _columns[columnKey];
}
return cellString;
}
@end