kpilot/lib

DatabaseInterpreter< kdetype, pilottype, mapper > Class Template Reference

#include <pilotDatabase.h>

List of all members.


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)
PilotDatabasedb () const

Protected Attributes

PilotDatabasefDB

Constructor & Destructor Documentation

template<class kdetype, class pilottype, class mapper>
DatabaseInterpreter< kdetype, pilottype, mapper >::DatabaseInterpreter ( PilotDatabase d  )  [inline]

Constructor.

Interpret the database d.

Definition at line 214 of file pilotDatabase.h.


Member Function Documentation

template<class kdetype, class pilottype, class mapper>
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readRecordById ( recordid_t  id  )  [inline]

Reads a record from database by id.

Definition at line 217 of file pilotDatabase.h.

template<class kdetype, class pilottype, class mapper>
kdetype* DatabaseInterpreter< kdetype, pilottype, mapper >::readRecordByIndex ( int  index  )  [inline]

Reads a record from database with index index.

Definition at line 223 of file pilotDatabase.h.

template<class kdetype, class pilottype, class mapper>
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.

template<class kdetype, class pilottype, class mapper>
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.

template<class kdetype, class pilottype, class mapper>
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:
KDE Home | KDE Accessibility Home | Description of Access Keys