Template class for easy creation of specific parser objects. More...
#include <parser.h>
Public Member Functions | |
RecordParser (StorageT &storage) | |
Constructor that references an externally managed storage object. | |
RecordParser (StorageT *storage) | |
Constructor that references a locally managed storage object. | |
virtual void | Clear () |
Reset and prepare for a new raw data packet. | |
virtual void | SetIds (uint8_t RecType, uint32_t UniqueId) |
Stores the IDs. | |
virtual void | ParseHeader (const Data &data, size_t &offset) |
Called to parse the header portion of the raw data packet. | |
virtual void | ParseFields (const Data &data, size_t &offset, const IConverter *ic) |
Called to parse sub fields in the raw data packet. | |
virtual void | Store () |
Called at the very end of record parsing, and used to store the final packet somewhere, either in memory, disk, etc. |
Template class for easy creation of specific parser objects.
This template takes the following template arguments:
Example LoadDatabase() call:
struct StoreContact { std::vector<Contact> &array; StoreContact(std::vector<Contact> &a) : array(a) {} void operator() (const Contact &c) { array.push_back(c); } };
Controller con(probeResult); con.OpenMode(Controller::Desktop); std::vector<Contact> contactList; StoreContact storage(contactList); RecordParser<Contact, StoreContact> parser(storage); con.LoadDatabase(con.GetDBID("Address Book"), parser);
Definition at line 158 of file parser.h.
Barry::RecordParser< RecordT, StorageT >::RecordParser | ( | StorageT & | storage | ) | [inline] |
Barry::RecordParser< RecordT, StorageT >::RecordParser | ( | StorageT * | storage | ) | [inline] |
virtual void Barry::RecordParser< RecordT, StorageT >::Clear | ( | ) | [inline, virtual] |
Reset and prepare for a new raw data packet.
Implements Barry::Parser.
virtual void Barry::RecordParser< RecordT, StorageT >::ParseFields | ( | const Data & | data, | |
size_t & | offset, | |||
const IConverter * | ic | |||
) | [inline, virtual] |
Called to parse sub fields in the raw data packet.
The same data is passed as was passed in ParseHeader, only the offset will be updated if it was advanced during the header parsing.
Implements Barry::Parser.
virtual void Barry::RecordParser< RecordT, StorageT >::ParseHeader | ( | const Data & | data, | |
size_t & | offset | |||
) | [inline, virtual] |
Called to parse the header portion of the raw data packet.
data contains the entire packet, and offset contains the location at which to start parsing.
Implements Barry::Parser.
virtual void Barry::RecordParser< RecordT, StorageT >::SetIds | ( | uint8_t | RecType, | |
uint32_t | UniqueId | |||
) | [inline, virtual] |
virtual void Barry::RecordParser< RecordT, StorageT >::Store | ( | ) | [inline, virtual] |
Called at the very end of record parsing, and used to store the final packet somewhere, either in memory, disk, etc.
Implements Barry::Parser.