Container parser class that accepts multiple Parser objects (often RecordParser<> objects but they don't have to be) and automatically routes incoming records to the appropriate parser. More...
#include <parser.h>
Public Member Functions | |
void | Add (const std::string &dbname, Parser *parser) |
Adds given parser to list and takes ownership of it. | |
void | Add (RecordParserBase *parser) |
Adds given parser to list and takes ownership of it. | |
template<class RecordT > | |
void | Add (AllRecordStore &store) |
Creates a RecordParser<> object using the given record type and AllRecordStore. | |
template<class RecordT , class StorageT > | |
void | Add (StorageT *store) |
Two helper template functions that create the RecordParser<> automatically based on the function call. | |
bool | Add (const std::string &dbname, std::ostream &os) |
Creates a RecordParser<> object for the given database name, using DumpStore<> with the given stream for the output, and adds it to list. | |
bool | Add (const std::string &dbname, AllRecordStore &store) |
Creates a RecordParser<> object for the given database name, using the given store object. | |
virtual void | ParseRecord (const DBData &data, const IConverter *ic) |
Called to parse sub fields in the raw data packet. |
Container parser class that accepts multiple Parser objects (often RecordParser<> objects but they don't have to be) and automatically routes incoming records to the appropriate parser.
Note that this container owns *all* Parser objects, and will free them upon destruction.
Incoming records that have no matching parser are passed to the default parser object, if one exists, otherwise they are dropped silently. The default parser object is also owned by the container, and will be freed on destruction.
Do NOT derive your own personal parser classes from this, unless you are perfectly confident that you will catch future API changes on the devel tree without the compiler's help.
Definition at line 384 of file parser.h.
void Barry::MultiRecordParser::Add | ( | const std::string & | dbname, | |
Parser * | parser | |||
) |
void Barry::MultiRecordParser::Add | ( | RecordParserBase * | parser | ) |
bool Barry::MultiRecordParser::Add | ( | const std::string & | dbname, | |
AllRecordStore & | store | |||
) |
bool Barry::MultiRecordParser::Add | ( | const std::string & | dbname, | |
std::ostream & | os | |||
) |
void Barry::MultiRecordParser::Add | ( | StorageT * | store | ) | [inline] |
void Barry::MultiRecordParser::Add | ( | AllRecordStore & | store | ) | [inline] |
Creates a RecordParser<> object using the given record type and AllRecordStore.
Does NOT take ownership of the store object, since it can be used multiple times for multiple records.
void Barry::MultiRecordParser::ParseRecord | ( | const DBData & | data, | |
const IConverter * | ic | |||
) | [virtual] |
Called to parse sub fields in the raw data packet.
Implements Barry::Parser.
Definition at line 153 of file parser.cc.
References Barry::Parser::ParseRecord().