kpilot Library API Documentation

pilotDatabase.h

00001 #ifndef _KPILOT_PILOTDATABASE_H
00002 #define _KPILOT_PILOTDATABASE_H
00003 /* pilotDatabase.h          KPilot
00004 **
00005 ** Copyright (C) 1998-2001 by Dan Pilone
00006 **
00007 ** This is the abstract base class for databases, which is used both
00008 ** by local databases and by the serial databases held in the Pilot.
00009 */
00010 
00011 /*
00012 ** This program is free software; you can redistribute it and/or modify
00013 ** it under the terms of the GNU Lesser General Public License as published by
00014 ** the Free Software Foundation; either version 2.1 of the License, or
00015 ** (at your option) any later version.
00016 **
00017 ** This program is distributed in the hope that it will be useful,
00018 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00020 ** GNU Lesser General Public License for more details.
00021 **
00022 ** You should have received a copy of the GNU Lesser General Public License
00023 ** along with this program in a file called COPYING; if not, write to
00024 ** the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
00025 ** MA 02111-1307, USA.
00026 */
00027 
00028 /*
00029 ** Bug reports and questions can be sent to kde-pim@kde.org
00030 */
00031 
00032 #ifdef HAVE_CONFIG_H
00033 #include "config.h"
00034 #endif
00035 
00036 #include <qobject.h>
00037 #include <qvaluelist.h>
00038 
00039 // Handle all time.h variations properly.
00040 // Required because pi-macros.h sometimes forgets it.
00041 //
00042 #ifdef TIME_WITH_SYS_TIME
00043 # include <sys/time.h>
00044 # include <time.h>
00045 #else
00046 # ifdef HAVE_SYS_TIME_H
00047 #  include <sys/time.h>
00048 # else
00049 #  include <time.h>
00050 # endif
00051 #endif
00052 
00053 #include <pi-macros.h>
00054 
00055 #include "pilotRecord.h"
00056 
00057 
00058 
00067 class PilotDatabase : public QObject
00068 {
00069 Q_OBJECT
00070 public:
00071     PilotDatabase(QObject *,const char *);
00072     virtual ~PilotDatabase();
00073 
00074     enum { MAX_APPINFO_SIZE=8192 
00075         } Constants;
00076 
00082     virtual bool createDatabase(long creator=0, long type=0, 
00083         int cardno=0, int flags=0, int version=0) = 0;
00084     
00090     virtual int deleteDatabase()=0;
00091     
00093     virtual int readAppBlock(unsigned char* buffer, int maxLen) = 0;
00094 
00096     virtual int writeAppBlock(unsigned char* buffer, int len) = 0;
00097 
00099     virtual int recordCount()=0;
00100     
00102      virtual QValueList<recordid_t> idList()=0;
00103 
00105     virtual PilotRecord* readRecordById(recordid_t id) = 0;
00106 
00108     virtual PilotRecord* readRecordByIndex(int index) = 0;
00109 
00111     virtual PilotRecord* readNextRecInCategory(int category) = 0;
00112 
00119     virtual PilotRecord* readNextModifiedRec(int *ind=NULL) = 0;
00120 
00125     virtual recordid_t writeRecord(PilotRecord* newRecord) = 0;
00126 
00134     virtual int deleteRecord(recordid_t id, bool all=false) = 0;
00135     
00137     virtual int resetSyncFlags() = 0;
00138 
00140     virtual int resetDBIndex() = 0;
00141 
00143     virtual int cleanup() = 0;
00144 
00145     bool isDBOpen() const { return fDBOpen; }
00146 
00151     virtual QString dbPathName() const = 0;
00152 
00157     static void listAppInfo(const struct CategoryAppInfo *);
00158     
00159 protected:
00160     virtual void openDatabase() = 0;
00161     virtual void closeDatabase() = 0;
00162 
00163     void setDBOpen(bool yesno) { fDBOpen = yesno; }
00164 
00165 private:
00166     bool fDBOpen;
00167 };
00168 
00169 #endif
KDE Logo
This file is part of the documentation for kpilot Library Version 3.2.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat May 1 11:36:48 2004 by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2003