kpilot Library API Documentation

PilotDatabase Class Reference

Methods to access a database on the pilot. More...

#include <pilotDatabase.h>

Inheritance diagram for PilotDatabase:

QObject List of all members.

Public Types

enum  { MAX_APPINFO_SIZE = 8192 }

Public Member Functions

 PilotDatabase (QObject *, const char *)
virtual bool createDatabase (long creator=0, long type=0, int cardno=0, int flags=0, int version=0)=0
 Creates the database with the given creator, type and flags on the given card (default is RAM).

virtual int deleteDatabase ()=0
 Deletes the database (by name, as given in the constructor, the database name is stored depending on the implementation of PilotLocalDatabase and PilotSerialDatabas).

virtual int readAppBlock (unsigned char *buffer, int maxLen)=0
 Reads the application block info, returns size.

virtual int writeAppBlock (unsigned char *buffer, int len)=0
 Writes the application block info.

virtual int recordCount ()=0
 returns the number of records in the database

virtual QValueList< recordid_t > idList ()=0
 Returns a QValueList of all record ids in the database.

virtual PilotRecord * readRecordById (recordid_t id)=0
 Reads a record from database by id, returns record length.

virtual PilotRecord * readRecordByIndex (int index)=0
 Reads a record from database, returns the record length.

virtual PilotRecord * readNextRecInCategory (int category)=0
 Reads the next record from database in category 'category'.

virtual PilotRecord * readNextModifiedRec (int *ind=NULL)=0
 Reads the next record from database that has the dirty flag set.

virtual recordid_t writeRecord (PilotRecord *newRecord)=0
 Writes a new record to database (if 'id' == 0, one will be assigned to newRecord).

virtual int deleteRecord (recordid_t id, bool all=false)=0
 Deletes a record with the given recordid_t from the database, or all records, if all is set to true.

virtual int resetSyncFlags ()=0
 Resets all records in the database to not dirty.

virtual int resetDBIndex ()=0
 Resets next record index to beginning.

virtual int cleanup ()=0
 Purges all Archived/Deleted records from Palm Pilot database.

bool isDBOpen () const
virtual QString dbPathName () const=0
 Returns some sensible human-readable identifier for the database.


Static Public Member Functions

void listAppInfo (const struct CategoryAppInfo *)
 Here are some static utility functions.


Public Attributes

enum PilotDatabase:: { ... }  Constants

Protected Member Functions

virtual void openDatabase ()=0
virtual void closeDatabase ()=0
void setDBOpen (bool yesno)

Detailed Description

Methods to access a database on the pilot.

NOTE: It is the users responsibility to delete PilotRecords returned by PilotDatabase methods when finished with them!!

Definition at line 67 of file pilotDatabase.h.


Member Function Documentation

virtual bool PilotDatabase::createDatabase long  creator = 0,
long  type = 0,
int  cardno = 0,
int  flags = 0,
int  version = 0
[pure virtual]
 

Creates the database with the given creator, type and flags on the given card (default is RAM).

If the database already exists, this function does nothing.

virtual int PilotDatabase::deleteDatabase  )  [pure virtual]
 

Deletes the database (by name, as given in the constructor, the database name is stored depending on the implementation of PilotLocalDatabase and PilotSerialDatabas).

virtual int PilotDatabase::readAppBlock unsigned char *  buffer,
int  maxLen
[pure virtual]
 

Reads the application block info, returns size.

virtual int PilotDatabase::writeAppBlock unsigned char *  buffer,
int  len
[pure virtual]
 

Writes the application block info.

virtual int PilotDatabase::recordCount  )  [pure virtual]
 

returns the number of records in the database

virtual QValueList<recordid_t> PilotDatabase::idList  )  [pure virtual]
 

Returns a QValueList of all record ids in the database.

virtual PilotRecord* PilotDatabase::readRecordById recordid_t  id  )  [pure virtual]
 

Reads a record from database by id, returns record length.

virtual PilotRecord* PilotDatabase::readRecordByIndex int  index  )  [pure virtual]
 

Reads a record from database, returns the record length.

virtual PilotRecord* PilotDatabase::readNextRecInCategory int  category  )  [pure virtual]
 

Reads the next record from database in category 'category'.

virtual PilotRecord* PilotDatabase::readNextModifiedRec int *  ind = NULL  )  [pure virtual]
 

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).

virtual recordid_t PilotDatabase::writeRecord PilotRecord *  newRecord  )  [pure virtual]
 

Writes a new record to database (if 'id' == 0, one will be assigned to newRecord).

virtual int PilotDatabase::deleteRecord recordid_t  id,
bool  all = false
[pure virtual]
 

Deletes a record with the given recordid_t from the database, or all records, if all is set to true.

The recordid_t will be ignored in this case.

Return value is negative on error, 0 otherwise.

virtual int PilotDatabase::resetSyncFlags  )  [pure virtual]
 

Resets all records in the database to not dirty.

virtual int PilotDatabase::resetDBIndex  )  [pure virtual]
 

Resets next record index to beginning.

virtual int PilotDatabase::cleanup  )  [pure virtual]
 

Purges all Archived/Deleted records from Palm Pilot database.

virtual QString PilotDatabase::dbPathName  )  const [pure virtual]
 

Returns some sensible human-readable identifier for the database.

Serial databases get Pilot:, local databases return the full path.

void PilotDatabase::listAppInfo const struct CategoryAppInfo *   )  [static]
 

Here are some static utility functions.

listAppInfo() is primarily meant for debugging, and it dumps an appinfo block to stdout.

Definition at line 50 of file pilotDatabase.cc.


The documentation for this class was generated from the following files:
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Sun Feb 15 11:40:45 2004 by doxygen 1.3.5 written by Dimitri van Heesch, © 1997-2001