Rudiments
Public Member Functions | Protected Member Functions | List of all members
csvsax Class Reference

#include <csvsax.h>

Inherits sax.

Inherited by csvdom.

Public Member Functions

 csvsax ()
 
virtual ~csvsax ()
 
void setQuote (char quote)
 
char getQuote ()
 
void setDelimiter (char delimiter)
 
char getDelimiter ()
 
- Public Member Functions inherited from sax
 sax ()
 
virtual ~sax ()
 
void setIgnoreHeaderLines (uint64_t lines)
 
uint64_t getIgnoreHeaderLines ()
 
void setIgnoreFooterLines (uint64_t lines)
 
uint64_t getIgnoreFooterLines ()
 
virtual bool parse (input *in)
 
virtual bool parseFile (const char *filename)
 
virtual bool parseString (const char *string)
 
const chargetError ()
 
- Public Member Functions inherited from object
virtual ~object ()
 

Protected Member Functions

virtual bool headerStart ()
 
virtual bool column (const char *name, bool quoted)
 
virtual bool headerEnd ()
 
virtual bool bodyStart ()
 
virtual bool recordStart ()
 
virtual bool field (const char *value, bool quoted)
 
virtual bool recordEnd ()
 
virtual bool bodyEnd ()
 

Detailed Description

The csvsax class is a base class for an SAX-style parser for CSV data. To use this class, you should create a class that inherits from it and implements its protected virtual methods.

Constructor & Destructor Documentation

◆ csvsax()

csvsax::csvsax ( )

Creates an instance of the csvsax class.

◆ ~csvsax()

virtual csvsax::~csvsax ( )
virtual

Deletes this instance of the csvsax class.

Member Function Documentation

◆ bodyEnd()

virtual bool csvsax::bodyEnd ( )
protectedvirtual

Gets called when the end of the body is encountered.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ bodyStart()

virtual bool csvsax::bodyStart ( )
protectedvirtual

Gets called when the start of the body is encountered.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ column()

virtual bool csvsax::column ( const char * name,
bool quoted )
protectedvirtual

Gets called when a column name is parsed.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ field()

virtual bool csvsax::field ( const char * value,
bool quoted )
protectedvirtual

Gets called when a field is parsed.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ getDelimiter()

char csvsax::getDelimiter ( )

Returns the character that separates columns and fields.

◆ getQuote()

char csvsax::getQuote ( )

Returns the character that optionally surrounds columns and fields.

◆ headerEnd()

virtual bool csvsax::headerEnd ( )
protectedvirtual

Gets called when the end of the header is encountered.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ headerStart()

virtual bool csvsax::headerStart ( )
protectedvirtual

Gets called when the start of the header is encountered.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ recordEnd()

virtual bool csvsax::recordEnd ( )
protectedvirtual

Gets called when the end of a record is encountered.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ recordStart()

virtual bool csvsax::recordStart ( )
protectedvirtual

Gets called when the start of a record is encountered.

Returns true on success and false if an error occurred. Parsing stops if this method returns false.

This implementation just returns true by a child class may override this method to do something else.

Reimplemented in csvdom.

◆ setDelimiter()

void csvsax::setDelimiter ( char delimiter)

Sets the character that separates columns and fields to "delimiter".

◆ setQuote()

void csvsax::setQuote ( char quote)

Sets the character that optionally surrounds columns and fields to "quote".