-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCSVtokenlist.h
More file actions
64 lines (43 loc) · 975 Bytes
/
Copy pathCSVtokenlist.h
File metadata and controls
64 lines (43 loc) · 975 Bytes
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
#ifndef __SDR_ETC_CSVTOKENLIST_H__
#define __SDR_ETC_CSVTOKENLIST_H__
#include <string>
#include <vector>
namespace SDR
{
namespace etc
{
extern const int FS, COMMA;
class CSVtokenlist
{
public:
explicit CSVtokenlist(const std::string& ="", int D = ',');
bool no_EOL_DQUOTE() const { return _no_EOL_DQUOTE; }
int size() const
{
return tokens.size();
}
std::string operator[](int idx) const;
const std::string& base() const
{
return L;
}
public:
// utility : replace '"' with '\'', and delimit with '"' if embedded ','
static std::string unscan(std::string);
std::string unscanD(std::string, const char useDelim);
private:
std::string L;
typedef std::pair<std::string::size_type, std::string::size_type> TokenPos;
std::vector<TokenPos> tokens;
bool _no_EOL_DQUOTE;
private: // parser implementation
void next_token();
private:
std::string::const_iterator B, E;
int DELIM;
};
}
}
using SDR::etc::FS;
using SDR::etc::COMMA;
#endif