kpilot/lib
DatabaseInterpreter< kdetype, pilottype, mapper > Class Template Reference
#include <pilotDatabase.h>
Detailed Description
template<class kdetype, class pilottype, class mapper>
class DatabaseInterpreter< kdetype, pilottype, mapper >
A template class for reading and interpreting a database.
This removes the need for a lot of boilerplate code that does the conversions. Parameters are two interpretation classes: one for the KDE side of things (e.g. Event) and one that interprets the Pilot's records into a more sensible structure (e.g. PilotDatebookEntry). The mapping from the KDE type to the Pilot type and vice-versa is done by the mapper class's convert() functions.
To interpret a database as pilot-link interpretations (e.g. as PilotDatebookEntry records, not as Events) use the NullMapper class below in combination with a template instantiation with kdetype==pilottype.
The database interpreter intentionally has an interface similar to that of a PilotDatabase, but it isn't one.
Definition at line 188 of file pilotDatabase.h.
Public Member Functions | |
DatabaseInterpreter (PilotDatabase *d) | |
kdetype * | readRecordById (recordid_t id) |
kdetype * | readRecordByIndex (int index) |
kdetype * | readNextRecInCategory (int category) |
kdetype * | readNextModifiedRec (int *ind=NULL) |
PilotDatabase * | db () const |
Protected Attributes | |
PilotDatabase * | fDB |
Constructor & Destructor Documentation
DatabaseInterpreter< kdetype, pilottype, mapper >::DatabaseInterpreter | ( | PilotDatabase * | d | ) | [inline] |
Member Function Documentation
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readRecordById | ( | recordid_t | id | ) | [inline] |
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readRecordByIndex | ( | int | index | ) | [inline] |
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readNextRecInCategory | ( | int | category | ) | [inline] |
Reads the next record from database in category category
.
Definition at line 229 of file pilotDatabase.h.
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readNextModifiedRec | ( | int * | ind = NULL |
) | [inline] |
Reads the next record from database that has the dirty flag set.
If ind
is non-NULL, *ind is set to the index of the current record (i.e. before the record pointer moves to the next modified record).
Definition at line 240 of file pilotDatabase.h.
PilotDatabase* DatabaseInterpreter< kdetype, pilottype, mapper >::db | ( | ) | const [inline] |
Retrieve the database pointer; this is useful to just pass around DatabaseInterpreter objects as if they are databases, and then perform DB operations on the database it wraps.
Definition at line 250 of file pilotDatabase.h.
The documentation for this class was generated from the following file: