blob: c4410adea0981b6463692b60bd56da6f62c2aa78 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
#ifndef DBENTRIES_H
#define DBENTRIES_H
#include <db4/db_cxx.h>
#include <tqstring.h>
#include <tqbuffer.h>
#include <tqmap.h>
#include <tqstringlist.h>
#include <tqdatetime.h>
class CatalogInfo
{
TQString author;
TQDateTime datetime;
TQString filename;
TQString filepath;
};
class ResultInfo
{
public:
//Common info
TQString original; //placeholder
//
//Multi reference info
TQValueList<CatalogInfo> catalogs;
TQString info;
};
class InputInfo
{
public:
unsigned int ref() {return 1;}
};
class DBItem : public Dbt
{
public:
virtual ~DBItem(){}
virtual bool isEmpty(){return empty;}
//void fromDbt(Dbt *dbt);
void set();
void get();
protected:
virtual void read(TQDataStream *s) = 0;
virtual void write(TQDataStream *s) = 0;
TQByteArray mydata;
bool empty;
};
class DBItemMainKey : public DBItem
{
public:
DBItemMainKey();
DBItemMainKey(TQString searchstring);
TQString getString(){ return sstr;}
private:
virtual void read(TQDataStream *s);
virtual void write(TQDataStream *s);
TQString sstr;
};
class DBItemMainData : public DBItem
{
public:
typedef TQMapIterator<TQString,TQValueList<unsigned int> > TranslationIterator;
typedef TQMap<TQString,TQValueList<unsigned int> > TranslationMap;
DBItemMainData();
TQStringList getTranslations();
TQValueList<unsigned int> getReferences(TQString str);
void clear();
//Add a translation with reference ref, if translation exists append
// ref to the list of references
void addTranslation(TQString str,unsigned int ref);
void removeTranslation(TQString str,unsigned int ref);
//remove any reference to ref, if ref is the only reference of a translation
// the translation is removed
void removeRef(unsigned int ref);
unsigned int getIndexnumber(){ return indexnumber; }
void setIndexnumber(int i){ indexnumber=i; }
private:
virtual void read(TQDataStream *s);
virtual void write(TQDataStream *s);
unsigned int indexnumber;
TranslationMap translations;
};
class DBItemMultiIndex : public DBItem
{
public:
typedef TQValueList<unsigned int> IndexList;
DBItemMultiIndex();
// DBItemMultiIndex(IndexList l);
void addEntry(unsigned int index);
void removeEntry(unsigned int index);
IndexList getList(){ return list;}
void clear() {list.clear();}
private:
virtual void read(TQDataStream *s);
virtual void write(TQDataStream *s);
IndexList list;
};
class DBItemNum : public Dbt
{
public:
DBItemNum(){
set_data(&num);
set_size(4);
num=0;
}
DBItemNum(unsigned int i){
set_data(&num);
set_size(4);
num=i;
}
unsigned int getNum(){ num=*(unsigned int *)get_data(); return num;}
private:
unsigned int num;
};
#endif
|