# Barry::DeviceParser Class Reference

`#include <m_desktop.h>`

Inheritance diagram for Barry::DeviceParser:

[legend]
Collaboration diagram for Barry::DeviceParser:

[legend]

List of all members.

## Detailed Description

A parser class that "parses" raw data into a device.

Basically this is a pipe-oriented way to call SaveDatabase().

Note that this is a multi-record parser. For each incoming DBData that has a new DBName, a new save will be started. There is no way to filter out records, except via the callback, so the easiest way to filter out records by database name is on the Builder side.

Definition at line 249 of file m_desktop.h.

## Public Types

enum | WriteMode { ERASE_ALL_WRITE_ALL, INDIVIDUAL_OVERWRITE, ADD_BUT_NO_OVERWRITE, ADD_WITH_NEW_ID, DECIDE_BY_CALLBACK, DROP_RECORD }

## Public Member Functions

virtual WriteMode | DecideWrite (const DBData &record) const
| Callback.
virtual void | ParseRecord (const DBData &data, const IConverter *ic)
| Parser overrides.

## Member Enumeration Documentation

enum Barry::DeviceParser::WriteMode

Enumerator:

  ERASE_ALL_WRITE_ALL | Similar to SaveDatabase(). Erases all records from the existing database and then uploads all new records.
  INDIVIDUAL_OVERWRITE | Adds any new records, and for records with Unique IDs that already exist, overwrite them.
  ADD_BUT_NO_OVERWRITE | Adds any new records, but if a record exists with the current Unique ID, skip that record and don't write it to the device.
  ADD_WITH_NEW_ID | Adds all incoming records as brand new records, generating a new Unique ID for each one, and leaving any existing records intact.
  DECIDE_BY_CALLBACK | Calls the virtual function DecideWrite(. ..) for each record, passing in the data. DecideWrite() returns one of these WriteMode values.
  DROP_RECORD | Primarily used by DecideWrite(), and causes the current record to not be written.

Definition at line 252 of file m_desktop.h.

## Member Function Documentation

virtual WriteMode Barry::DeviceParser::DecideWrite | ( | const DBData & | record | ) | const`[inline, virtual]`

Callback.

.. you must derive and override this if you use the DECIDE_BY_CALLBACK mode. May be called multiple times per record.

Definition at line 300 of file m_desktop.h.

void Barry::DeviceParser::ParseRecord | ( | const DBData & | data,
|  | const IConverter * | ic |
| ) |  |  | `[virtual]`

Parser overrides.

Implements Barry::Parser.

Definition at line 766 of file m_desktop.cc.

References Barry::DBData::GetDBName().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- m_desktop.h
- m_desktop.cc