kpilot
pilotLocalDatabase.hGo to the documentation of this file.00001 #ifndef _KPILOT_PILOTLOCALDATABASE_H
00002 #define _KPILOT_PILOTLOCALDATABASE_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include "pilotDatabase.h"
00033
00043 class KDE_EXPORT PilotLocalDatabase : public PilotDatabase
00044 {
00045 public:
00057 PilotLocalDatabase( const QString& path,
00058 const QString& name, bool useDefaultPath=true);
00059
00064 PilotLocalDatabase(const QString &name);
00065
00066 virtual ~PilotLocalDatabase();
00067
00072 virtual bool createDatabase(long creator=0,
00073 long type=0, int cardno=0, int flags=0, int version=0);
00074
00075
00076
00080 virtual int deleteDatabase();
00081
00082
00083 virtual int readAppBlock(unsigned char* buffer, int maxLen);
00084
00085 virtual int writeAppBlock(unsigned char* buffer, int len);
00086
00087 virtual unsigned int recordCount() const;
00088
00089 virtual QValueList<recordid_t> idList();
00090
00091 virtual PilotRecord* readRecordById(recordid_t id);
00092
00093 virtual PilotRecord* readRecordByIndex(int index);
00094
00095 virtual PilotRecord* readNextRecInCategory(int category);
00105 const PilotRecord *findNextNewRecord();
00106
00112 virtual PilotRecord* readNextModifiedRec(int *ind=0L);
00113
00114 virtual recordid_t writeRecord(PilotRecord* newRecord);
00120 virtual int deleteRecord(recordid_t id, bool all=false);
00121
00122 virtual int resetSyncFlags();
00123
00124 virtual int resetDBIndex();
00125
00126 virtual int cleanup();
00127
00128
00133 virtual recordid_t updateID(recordid_t id);
00134
00135
00137 QString getDBName() const { return fDBName; }
00138
00144 virtual QString dbPathName() const;
00145
00149 int appInfoSize() const
00150 { if (isOpen()) return fAppLen; else return -1; } ;
00151 char *appInfo() { return fAppInfo; } ;
00152
00153 const struct DBInfo &getDBInfo() const { return fDBInfo; }
00154 void setDBInfo(const struct DBInfo &dbi) {fDBInfo=dbi; }
00155
00156 virtual DBType dbType() const;
00157
00169 static bool infoFromFile( const QString &path, DBInfo *d );
00170
00171 protected:
00172
00173 void fixupDBName();
00174 virtual void openDatabase();
00175 virtual void closeDatabase();
00176
00177 private:
00178 struct DBInfo fDBInfo;
00179 QString fPathName,fDBName;
00180 char* fAppInfo;
00181 size_t fAppLen;
00182
00183 class Private;
00184 Private *d;
00185
00186 public:
00192 static void setDBPath(const QString &);
00196 static const QString &getDBPath() { return *fPathBase; } ;
00197 private:
00198 static QString *fPathBase;
00199 };
00200
00201 #endif
|