tlp::CSVSimpleParser Class Reference
Parse a csv data and send each tokens to the given CSVContentHandler object.
More...
#include <CSVParser.h>
List of all members.
Public Member Functions
Protected Member Functions
- virtual std::string treatToken (const std::string &token, int row, int column)
Detailed Description
Parse a csv data and send each tokens to the given CSVContentHandler object.
Parse a csv data and send each tokens to the given CSVContentHandler object. Get each line of the file in the given range and parse them. This object skip empty lines. Send the found tokens to the CSVContentHandler interface.
CSVParser parser(fileName,";","\"","UTF-8",true);
\/\/Automatically remove quotes.
CSVContentHandler * handler ;
parser.parse(handler);
Constructor & Destructor Documentation
tlp::CSVSimpleParser::CSVSimpleParser |
( |
const std::string & |
fileName, |
|
|
const std::string & |
separator = std::string(";") , |
|
|
char |
textDelimiter = '"' , |
|
|
const std::string & |
fileEncoding = std::string("UTF-8") , |
|
|
unsigned int |
firstLine = 0 , |
|
|
unsigned int |
lastLine = UINT_MAX | |
|
) |
| | |
Construct a csv simple file parser.
- Parameters:
-
| filename | The path to the file to import. |
| separator | The separator to use. |
| textDelimiter | If a token is sourrounded by this charater we ignore all the separators found in this token. Useful if a token contains the separator. |
| firstLine | The number of the first line to read. The first line is 0. |
| lastLine | The number of the last line to read. |
virtual tlp::CSVSimpleParser::~CSVSimpleParser |
( |
|
) |
[virtual] |
Member Function Documentation
std::string tlp::CSVSimpleParser::fileEncoding |
( |
|
) |
const [inline] |
std::string tlp::CSVSimpleParser::fileName |
( |
|
) |
const [inline] |
bool tlp::CSVSimpleParser::parse |
( |
CSVContentHandler * |
handler, |
|
|
tlp::PluginProgress * |
progress = NULL | |
|
) |
| | [virtual] |
Parse the data and send the tokens found to the CSVContentHandler.
Notify the progression of the parsing with the progress object.
Implements tlp::CSVParser.
std::string tlp::CSVSimpleParser::separator |
( |
|
) |
const [inline] |
void tlp::CSVSimpleParser::setFileEncoding |
( |
const std::string & |
fileEncoding |
) |
[inline] |
void tlp::CSVSimpleParser::setFileName |
( |
const std::string & |
fileName |
) |
[inline] |
void tlp::CSVSimpleParser::setSeparator |
( |
const std::string & |
separator |
) |
[inline] |
void tlp::CSVSimpleParser::setTextDelimiter |
( |
char |
delimiter |
) |
[inline] |
char tlp::CSVSimpleParser::textDelimiter |
( |
|
) |
const [inline] |
virtual std::string tlp::CSVSimpleParser::treatToken |
( |
const std::string & |
token, |
|
|
int |
row, |
|
|
int |
column | |
|
) |
| | [protected, virtual] |