kpilot
DatabaseInterpreter< kdetype, pilottype, mapper > Class Template Reference
A template class for reading and interpreting a database. More...
#include <pilotDatabase.h>
Public Member Functions | |
DatabaseInterpreter (PilotDatabase *d) | |
PilotDatabase * | db () const |
kdetype * | readNextModifiedRec (int *ind=NULL) |
kdetype * | readNextRecInCategory (int category) |
kdetype * | readRecordById (recordid_t id) |
kdetype * | readRecordByIndex (int index) |
Protected Attributes | |
PilotDatabase * | fDB |
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 192 of file pilotDatabase.h.
Constructor & Destructor Documentation
DatabaseInterpreter< kdetype, pilottype, mapper >::DatabaseInterpreter | ( | PilotDatabase * | d | ) | [inline] |
Member Function Documentation
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 254 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 244 of file pilotDatabase.h.
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readNextRecInCategory | ( | int | category | ) | [inline] |
Reads the next record from database in category category
.
Definition at line 233 of file pilotDatabase.h.
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readRecordById | ( | recordid_t | id | ) | [inline] |
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readRecordByIndex | ( | int | index | ) | [inline] |
Member Data Documentation
PilotDatabase* DatabaseInterpreter< kdetype, pilottype, mapper >::fDB [protected] |
Definition at line 257 of file pilotDatabase.h.
The documentation for this class was generated from the following file: