summaryrefslogtreecommitdiffstats
path: root/kdesu/kdesud/repo.h
diff options
context:
space:
mode:
authortoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
committertoma <toma@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2009-11-25 17:56:58 +0000
commit4aed2c8219774f5d797760606b8489a92ddc5163 (patch)
tree3f8c130f7d269626bf6a9447407ef6c35954426a /kdesu/kdesud/repo.h
downloadtdebase-4aed2c8219774f5d797760606b8489a92ddc5163.tar.gz
tdebase-4aed2c8219774f5d797760606b8489a92ddc5163.zip
Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features.
BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebase@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kdesu/kdesud/repo.h')
-rw-r--r--kdesu/kdesud/repo.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/kdesu/kdesud/repo.h b/kdesu/kdesud/repo.h
new file mode 100644
index 000000000..fde8cd250
--- /dev/null
+++ b/kdesu/kdesud/repo.h
@@ -0,0 +1,68 @@
+/* vi: ts=8 sts=4 sw=4
+ *
+ * This file is part of the KDE project, module kdesu.
+ * Copyright (C) 1999,2000 Geert Jansen <jansen@kde.org>
+ */
+
+#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