forked from svn2github/FDM
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathCsvParser.h
34 lines (29 loc) · 1.02 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
/*
Free Download Manager Copyright (c) 2003-2016 FreeDownloadManager.ORG
*/
#ifndef CSVPARSER_INCLUDED_FILE
#define CSVPARSER_INCLUDED_FILE
class CCsvParser
{
public:
CCsvParser();
virtual ~CCsvParser();
void Init(const CStringA& sStr, const CStringA& sTextQulifier, const CStringA& sDelimiter);
bool ParseNextRecord();
bool GetNextField(CStringA& sValue);
private:
void Sgets();
int findDelimiter(bool& bIsQuote, int& nClosingQuotePos);
int countQuote(int nStartChar, const CStringA& sValue);
void procLastField(bool bIsQuote, int nClosingQuotePos, CStringA& sValue);
void procLastButOneField(bool bIsQuote, int nClosingQuotePos, CStringA& sValue);
void procField(int nDelimPos, bool bIsQuote, int nClosingQuotePos, CStringA& sValue);
void decodeValue(bool bIsQuote, int nClosingQuotePos, CStringA& sValue);
int findSingleQuote(int nStartChar, const CStringA& sValue);
CStringA m_sCsvContent;
CStringA m_sRow;
CStringA m_sTextQulifier;
CStringA m_sDelimiter;
int m_nPos;
};
#endif