blob: 6c3bea808895b7f528d20fd9fcd26be33a4ee029 (
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
|
// Copyright (c) 2003,2004 Charles Samuels <charles@kde.org>
// See the file COPYING for redistribution terms.
#ifndef BASE_H
#define BASE_H
// ;)
#define unless(e) if(!(e))
#include <tqstring.h>
#include <tqobject.h>
#include <tqptrlist.h>
class File;
class Slice;
typedef unsigned int FileId;
class Base : public TQObject
{
Q_OBJECT
struct Private;
Private *d; // not for BC, but for compile times :)
friend class Slice;
friend class File;
unsigned int mFormatVersion;
public:
Base(const TQString &file);
~Base();
File add(const TQString &file);
File find(FileId id);
void clear();
/**
* get the highest FileID
**/
FileId high() const;
/**
* @return first item after the given id (inclusive)
**/
File first(FileId id=1);
TQString property(FileId id, const TQString &property) const;
void setProperty(FileId id, const TQString &key, const TQString &value);
TQStringList properties(FileId id) const;
void clearProperty(FileId, const TQString &key);
/**
* same as File::remove
**/
void remove(File f);
/**
* change the id of a file
**/
void move(FileId oldid, FileId newid);
void dump();
TQPtrList<Slice> slices();
Slice *addSlice(const TQString &name);
Slice *defaultSlice();
Slice *sliceById(int id);
unsigned int formatVersion() const { return mFormatVersion; }
void resetFormatVersion();
public slots:
void notifyChanged(const File &file);
signals:
void added(File file);
void removed(File file);
void modified(File file);
void addedTo(Slice *slice, File file);
void removedFrom(Slice *slice, File file);
/**
* emitted when something of the slices gets modified
* @ref Slice calls this itself via a friendship
**/
void slicesModified();
private:
void loadIntoCache(FileId id) const;
private: // friends for Slice
void removeSlice(Slice *slice);
private:
/**
* load the xml that lives at the head of the db and contains
* potentially lots of structured data
**/
void loadMetaXML(const TQString &xml);
TQString saveMetaXML();
};
#endif
|