#include <FlatFileParser.h>
Public Types | |
enum | RowStatus { NO_STATUS = 0, INCOMPLETE_COLUMN, ROW_TOO_LARGE, NO_COLUMN_DELIM, TOO_FEW_COLUMNS, TOO_MANY_COLUMNS } |
Status of row parsing. More... | |
Public Member Functions | |
FlatFileRowParseResult () | |
void | reset () |
uint | getReadCount () |
Gets the number of fields read. | |
char * | getColumn (uint iColumn) |
Gets a column value. | |
uint | getRawColumnSize (uint iColumn) |
Gets the size of a column, before removing escape and quote chars. | |
uint | getColumnSize (uint iColumn) |
Gets the size of a column, after removing escape and quote chars. | |
void | clear () |
Clear the row result. | |
void | resize (uint nColumns) |
Resize the row result. | |
void | setColumn (uint iColumn, uint offset, uint size) |
Sets a column value in the row result. | |
void | setNull (uint iColumn) |
Nullifies a column value in the row result. | |
void | addColumn (uint offset, uint size) |
Pushes a column onto the end of the row result. | |
Public Attributes | |
RowStatus | status |
Reports errors encountered during row parsing. | |
VectorOfUint | offsets |
Offsets to column values within the buffer. | |
VectorOfUint | sizes |
Sizes of column values. | |
VectorOfUint | strippedSizes |
Sizes of stripped column values. | |
char * | current |
Reference to the current row. | |
char * | next |
Reference to the next row to be parsed. | |
uint | nRowDelimsRead |
Ongoing count of row delimiters read. |
Definition at line 77 of file FlatFileParser.h.
Status of row parsing.
Definition at line 81 of file FlatFileParser.h.
00081 { 00085 NO_STATUS = 0, 00090 INCOMPLETE_COLUMN, 00094 ROW_TOO_LARGE, 00099 NO_COLUMN_DELIM, 00103 TOO_FEW_COLUMNS, 00107 TOO_MANY_COLUMNS 00108 };
FlatFileRowParseResult::FlatFileRowParseResult | ( | ) | [explicit] |
void FlatFileRowParseResult::reset | ( | ) |
Definition at line 71 of file FlatFileParser.cpp.
References current, next, NO_STATUS, nRowDelimsRead, and status.
Referenced by FlatFileRowParseResult(), and FlatFileExecStreamImpl::open().
00072 { 00073 status = NO_STATUS; 00074 current = next = NULL; 00075 nRowDelimsRead = 0; 00076 }
uint FlatFileRowParseResult::getReadCount | ( | ) | [inline] |
Gets the number of fields read.
Definition at line 152 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::handleTuple(), FlatFileExecStreamImpl::open(), and FlatFileParser::stripQuoting().
00153 { 00154 return offsets.size(); 00155 }
char* FlatFileRowParseResult::getColumn | ( | uint | iColumn | ) | [inline] |
Gets a column value.
The column value may initially contain escape quote characters. These may be later be removed in place. NULL is returned when the initial column size is zero. By contrast, empty quotes ("") represents the empty string.
Definition at line 163 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::handleTuple(), FlatFileExecStreamImpl::open(), and FlatFileParser::stripQuoting().
00164 { 00165 if (sizes[iColumn] == 0) { 00166 return NULL; 00167 } 00168 return current + offsets[iColumn]; 00169 }
Gets the size of a column, before removing escape and quote chars.
Definition at line 174 of file FlatFileParser.h.
Referenced by FlatFileParser::stripQuoting().
00175 { 00176 return sizes[iColumn]; 00177 }
Gets the size of a column, after removing escape and quote chars.
Definition at line 182 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::handleTuple(), and FlatFileExecStreamImpl::open().
00183 { 00184 return strippedSizes[iColumn]; 00185 }
void FlatFileRowParseResult::clear | ( | ) | [inline] |
Clear the row result.
Definition at line 190 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
void FlatFileRowParseResult::resize | ( | uint | nColumns | ) | [inline] |
Resize the row result.
Definition at line 199 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
Sets a column value in the row result.
Definition at line 208 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
void FlatFileRowParseResult::setNull | ( | uint | iColumn | ) | [inline] |
Nullifies a column value in the row result.
Definition at line 217 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
00218 { 00219 setColumn(iColumn, 0, 0); 00220 }
Pushes a column onto the end of the row result.
Definition at line 225 of file FlatFileParser.h.
Referenced by FlatFileParser::scanRow().
Reports errors encountered during row parsing.
Definition at line 116 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::execute(), FlatFileExecStreamImpl::handleTuple(), FlatFileExecStreamImpl::logError(), FlatFileExecStreamImpl::open(), reset(), FlatFileParser::scanRow(), and FlatFileParser::scanRowEnd().
Sizes of stripped column values.
Definition at line 131 of file FlatFileParser.h.
Referenced by FlatFileParser::stripQuoting().
Reference to the current row.
Definition at line 136 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::logError(), reset(), and FlatFileParser::scanRow().
Reference to the next row to be parsed.
After a row parse, this will be set to the first unread character, regardless of errors.
Definition at line 142 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::execute(), FlatFileExecStreamImpl::logError(), FlatFileExecStreamImpl::open(), reset(), and FlatFileParser::scanRow().
Ongoing count of row delimiters read.
Definition at line 147 of file FlatFileParser.h.
Referenced by FlatFileExecStreamImpl::checkRowDelimiter(), reset(), and FlatFileParser::scanRowEnd().