kpilot/lib
pilotDatabase.cc00001
00002
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 "options.h"
00033
00034 #include <time.h>
00035 #include <pi-appinfo.h>
00036
00037 #include <qstringlist.h>
00038
00039 #include <kglobal.h>
00040
00041 #include "pilotDatabase.h"
00042 #include "pilotRecord.h"
00043
00044 static int creationCount = 0;
00045 static QStringList *createdNames = 0L;
00046
00047 PilotDatabase::PilotDatabase(const QString &s) :
00048 fDBOpen(false),
00049 fName(s)
00050 {
00051 FUNCTIONSETUP;
00052 creationCount++;
00053 if (!createdNames)
00054 {
00055 createdNames = new QStringList();
00056 }
00057 createdNames->append(s.isEmpty() ? CSL1("<empty>") : s);
00058 }
00059
00060 PilotDatabase::~PilotDatabase()
00061 {
00062 FUNCTIONSETUP;
00063 creationCount--;
00064 if (createdNames)
00065 {
00066 createdNames->remove(fName.isEmpty() ? CSL1("<empty>") : fName);
00067 }
00068 }
00069
00070 int PilotDatabase::instanceCount()
00071 {
00072 FUNCTIONSETUP;
00073 DEBUGLIBRARY << fname << ": " << creationCount << " databases." << endl;
00074 if (createdNames)
00075 {
00076 DEBUGLIBRARY << fname << ": "
00077 << createdNames->join(CSL1(",")) << endl;
00078 }
00079 return creationCount;
00080 }
00081
00082 Pilot::RecordIDList PilotDatabase::idList()
00083 {
00084 Pilot::RecordIDList l;
00085
00086 for (unsigned int i = 0 ; ; i++)
00087 {
00088 PilotRecord *r = readRecordByIndex(i);
00089 if (!r) break;
00090 l.append(r->id());
00091 delete r;
00092 }
00093
00094 return l;
00095 }
00096
00097 Pilot::RecordIDList PilotDatabase::modifiedIDList()
00098 {
00099 Pilot::RecordIDList l;
00100
00101 resetDBIndex();
00102 while(1)
00103 {
00104 PilotRecord *r = readNextModifiedRec();
00105 if (!r) break;
00106 l.append(r->id());
00107 delete r;
00108 }
00109
00110 return l;
00111 }
00112
|