summaryrefslogtreecommitdiff
path: root/noncore/apps/tableviewer/db/datacache.h
Unidiff
Diffstat (limited to 'noncore/apps/tableviewer/db/datacache.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tableviewer/db/datacache.h24
1 files changed, 15 insertions, 9 deletions
diff --git a/noncore/apps/tableviewer/db/datacache.h b/noncore/apps/tableviewer/db/datacache.h
index c5dc637..e38050c 100644
--- a/noncore/apps/tableviewer/db/datacache.h
+++ b/noncore/apps/tableviewer/db/datacache.h
@@ -24,15 +24,21 @@
24 * otherwise any other data headings are allowed. 24 * otherwise any other data headings are allowed.
25 */ 25 */
26 26
27#ifndef __DATACACHE_H__ 27#ifndef __DATACACHE_H__
28#define __DATACACHE_H__ 28#define __DATACACHE_H__
29 29
30#include "common.h"
31
32/* OPIE */
33#include <opie2/odebug.h>
34using namespace Opie::Core;
35
36/* QT */
30#include <qstring.h> 37#include <qstring.h>
31#include <qvector.h> 38#include <qvector.h>
32#include "common.h"
33 39
34class DBStore; 40class DBStore;
35 41
36/*! Abstract class that defines how database stuff can be accessed */ 42/*! Abstract class that defines how database stuff can be accessed */
37class DBAccess { 43class DBAccess {
38public: 44public:
@@ -42,18 +48,18 @@ public:
42 48
43 virtual QString type() { 49 virtual QString type() {
44 return QString(); 50 return QString();
45 } 51 }
46 52
47 virtual bool openSource(QIODevice *) { 53 virtual bool openSource(QIODevice *) {
48 qWarning("DBAccess::openSource not yet implemented"); 54 owarn << "DBAccess::openSource not yet implemented" << oendl;
49 return false; 55 return false;
50 } 56 }
51 57
52 virtual bool saveSource(QIODevice *) { 58 virtual bool saveSource(QIODevice *) {
53 qWarning("DBAccess::saveSource(QString) not yet implemented"); 59 owarn << "DBAccess::saveSource(QString) not yet implemented" << oendl;
54 return false; 60 return false;
55 } 61 }
56 62
57protected: 63protected:
58 DBStore *dstore; 64 DBStore *dstore;
59 QString source_name; 65 QString source_name;
@@ -67,13 +73,13 @@ public:
67 bool openSource(QIODevice *, const QString &source); 73 bool openSource(QIODevice *, const QString &source);
68 bool saveSource(QIODevice *, const QString &source); 74 bool saveSource(QIODevice *, const QString &source);
69 75
70 // Add an item 76 // Add an item
71 void addItem(DataElem *); 77 void addItem(DataElem *);
72 void addItemInternal(DataElem *); 78 void addItemInternal(DataElem *);
73 void removeItem(DataElem *); 79 void removeItem(DataElem *);
74 80
75 // Set the name of the database 81 // Set the name of the database
76 void setName(const QString &name); 82 void setName(const QString &name);
77 83
78 // Get the name of the database 84 // Get the name of the database
79 QString getName(); 85 QString getName();
@@ -103,28 +109,28 @@ public:
103 109
104// Access functions.. iterator type stuff 110// Access functions.. iterator type stuff
105 111
106 void first(); 112 void first();
107 void last(); 113 void last();
108 114
109 bool next(); 115 bool next();
110 bool previous(); 116 bool previous();
111 117
112 DataElem* getCurrentData(); 118 DataElem* getCurrentData();
113 119
114private: 120private:
115 /* does the work of freeing used memory */ 121 /* does the work of freeing used memory */
116 void freeTable(); 122 void freeTable();
117 QString name; 123 QString name;
118 124
119 QVector<DataElem> master_table; 125 QVector<DataElem> master_table;
120 DBAccess *archive; 126 DBAccess *archive;
121 127
122 KeyList *kRep; 128 KeyList *kRep;
123 129
124 unsigned int number_elems; 130 unsigned int number_elems;
125 unsigned int table_size; /* should always be a power of 2 */ 131 unsigned int table_size; /* should always be a power of 2 */
126 bool full; /* since because we are using an int for indexing there is 132 bool full; /* since because we are using an int for indexing there is
127 an upper limit on the number of items we can store. */ 133 an upper limit on the number of items we can store. */
128 unsigned int current_elem; 134 unsigned int current_elem;
129}; 135};
130#endif 136#endif