blob: fde8cd2500c8ca54858acedeb29eb3c5d5509f5e (
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
|
/* vi: ts=8 sts=4 sw=4
*
* This file is part of the KDE project, module kdesu.
* Copyright (C) 1999,2000 Geert Jansen <[email protected]>
*/
#ifndef __Repo_h_included__
#define __Repo_h_included__
#include <qmap.h>
#include <qcstring.h>
/**
* Used internally.
*/
struct Data_entry
{
QCString value;
QCString group;
unsigned int timeout;
};
/**
* String repository.
*
* This class implements a string repository with expiration.
*/
class Repository {
public:
Repository();
~Repository();
/** Remove data elements which are expired. */
int expire();
/** Add a data element */
void add(const QCString& key, Data_entry& data);
/** Delete a data element. */
int remove(const QCString& key);
/** Delete all data entries having the given group. */
int removeGroup(const QCString& group);
/** Delete all data entries based on key. */
int removeSpecialKey(const QCString& key );
/** Checks for the existence of the specified group. */
int hasGroup(const QCString &group) const;
/** Return a data value. */
QCString find(const QCString& key) const;
/** Returns the key values for the given group. */
QCString findKeys(const QCString& group, const char *sep= "-") const;
private:
QMap<QCString,Data_entry> repo;
typedef QMap<QCString,Data_entry>::Iterator RepoIterator;
typedef QMap<QCString,Data_entry>::ConstIterator RepoCIterator;
unsigned head_time;
};
#endif
|