[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/kdelibs4_kconfig/kdecore/kconfig
From: Thomas Braxton <brax108 () cox ! net>
Date: 2006-07-26 3:04:53
Message-ID: 1153883093.158059.521.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 566422 by braxton:
implement a search function in KEntryMap
M +34 -0 kconfigdata.h
--- branches/work/kdelibs4_kconfig/kdecore/kconfig/kconfigdata.h #566421:566422
@@ -129,7 +129,41 @@
*/
class KEntryMap : public QMap<KEntryKey, KEntry>
{
+ public:
+ enum SearchFlag {
+ SearchDefaults=1,
+ SearchLocalized=2
+ };
+ Q_DECLARE_FLAGS(SearchFlags, SearchFlag);
+
+ bool hasEntry(const char* group, const char* key=0, SearchFlags flags=0) const
+ {
+ const ConstIterator theEnd = constEnd();
+ KEntryKey theKey(group, key);
+ theKey.bDefault = (flags&SearchDefaults);
+
+ // try the localized key first
+ if (flags&SearchLocalized) {
+ theKey.bLocal = true;
+ const ConstIterator it = find(theKey);
+ if (it != theEnd) {
+ if (!key) // group marker
+ return it->mValue.isNull();
+ return !it->bDeleted;
+ }
+ theKey.bLocal = false;
+ }
+
+ // try the non-localized key
+ const ConstIterator it = find(theKey);
+ if (it == theEnd)
+ return false;
+ if (!key) // group marker
+ return it->mValue.isNull();
+ return !it->bDeleted;
+ }
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(KEntryMap::SearchFlags)
/**
* \relates KEntry
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic