delay a few things on startup, such as setting the visibility mode, which ensures...
[personal-kdebase.git] / runtime / kdesu / kdesud / repo.h
blobe49eb45da30e41567d90c999fb625d5b77eecf07
1 /* vi: ts=8 sts=4 sw=4
3 * This file is part of the KDE project, module kdesu.
4 * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
5 */
7 #ifndef __Repo_h_included__
8 #define __Repo_h_included__
11 #include <QMap>
12 #include <QByteArray>
15 /**
16 * Used internally.
18 struct Data_entry
20 QByteArray value;
21 QByteArray group;
22 unsigned int timeout;
26 /**
27 * String repository.
29 * This class implements a string repository with expiration.
31 class Repository {
32 public:
33 Repository();
34 ~Repository();
36 /** Remove data elements which are expired. */
37 int expire();
39 /** Add a data element */
40 void add(const QByteArray& key, Data_entry& data);
42 /** Delete a data element. */
43 int remove(const QByteArray& key);
45 /** Delete all data entries having the given group. */
46 int removeGroup(const QByteArray& group);
48 /** Delete all data entries based on key. */
49 int removeSpecialKey(const QByteArray& key );
51 /** Checks for the existence of the specified group. */
52 int hasGroup(const QByteArray &group) const;
54 /** Return a data value. */
55 QByteArray find(const QByteArray& key) const;
57 /** Returns the key values for the given group. */
58 QByteArray findKeys(const QByteArray& group, const char *sep= "-") const;
60 private:
62 QMap<QByteArray,Data_entry> repo;
63 typedef QMap<QByteArray,Data_entry>::Iterator RepoIterator;
64 typedef QMap<QByteArray,Data_entry>::ConstIterator RepoCIterator;
65 unsigned head_time;
68 #endif