FlatFileRowParseResult Class Reference

Result of scanning for a row in a flat file format buffer. More...

#include <FlatFileParser.h>

List of all members.

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.


Detailed Description

Result of scanning for a row in a flat file format buffer.

Definition at line 77 of file FlatFileParser.h.


Member Enumeration Documentation

enum FlatFileRowParseResult::RowStatus

Status of row parsing.

Enumerator:
NO_STATUS  Row was parsed successfully.
INCOMPLETE_COLUMN  A column in the row was not delimited by either a column or row delimiter.
ROW_TOO_LARGE  Row did not fit into buffer.
NO_COLUMN_DELIM  Row delimiter was hit, before any column delimiters, when multiple columns were expected.
TOO_FEW_COLUMNS  Column delimiters were encountered, but row had too few columns.
TOO_MANY_COLUMNS  Row had too many columns, or column values were too long,.

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     };


Constructor & Destructor Documentation

FlatFileRowParseResult::FlatFileRowParseResult (  )  [explicit]

Definition at line 66 of file FlatFileParser.cpp.

References reset().

00067 {
00068     reset();
00069 }


Member Function Documentation

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     }

uint FlatFileRowParseResult::getRawColumnSize ( uint  iColumn  )  [inline]

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     }

uint FlatFileRowParseResult::getColumnSize ( uint  iColumn  )  [inline]

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().

00191     {
00192         offsets.clear();
00193         sizes.clear();
00194     }

void FlatFileRowParseResult::resize ( uint  nColumns  )  [inline]

Resize the row result.

Definition at line 199 of file FlatFileParser.h.

Referenced by FlatFileParser::scanRow().

00200     {
00201         offsets.resize(nColumns);
00202         sizes.resize(nColumns);
00203     }

void FlatFileRowParseResult::setColumn ( uint  iColumn,
uint  offset,
uint  size 
) [inline]

Sets a column value in the row result.

Definition at line 208 of file FlatFileParser.h.

Referenced by FlatFileParser::scanRow().

00209     {
00210         offsets[iColumn] = offset;
00211         sizes[iColumn] = size;
00212     }

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     }

void FlatFileRowParseResult::addColumn ( uint  offset,
uint  size 
) [inline]

Pushes a column onto the end of the row result.

Definition at line 225 of file FlatFileParser.h.

Referenced by FlatFileParser::scanRow().

00226     {
00227         offsets.push_back(offset);
00228         sizes.push_back(size);
00229     }


Member Data Documentation

RowStatus FlatFileRowParseResult::status

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().

VectorOfUint FlatFileRowParseResult::offsets

Offsets to column values within the buffer.

Definition at line 121 of file FlatFileParser.h.

VectorOfUint FlatFileRowParseResult::sizes

Sizes of column values.

Definition at line 126 of file FlatFileParser.h.

VectorOfUint FlatFileRowParseResult::strippedSizes

Sizes of stripped column values.

Definition at line 131 of file FlatFileParser.h.

Referenced by FlatFileParser::stripQuoting().

char* FlatFileRowParseResult::current

Reference to the current row.

Definition at line 136 of file FlatFileParser.h.

Referenced by FlatFileExecStreamImpl::logError(), reset(), and FlatFileParser::scanRow().

char* FlatFileRowParseResult::next

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().

uint FlatFileRowParseResult::nRowDelimsRead

Ongoing count of row delimiters read.

Definition at line 147 of file FlatFileParser.h.

Referenced by FlatFileExecStreamImpl::checkRowDelimiter(), reset(), and FlatFileParser::scanRowEnd().


The documentation for this class was generated from the following files:
Generated on Mon Jun 22 04:00:32 2009 for Fennel by  doxygen 1.5.1