aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PropSet.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/PropSet.cxx')
-rw-r--r--src/PropSet.cxx40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/PropSet.cxx b/src/PropSet.cxx
index 3ceceb670..573991870 100644
--- a/src/PropSet.cxx
+++ b/src/PropSet.cxx
@@ -318,6 +318,46 @@ void PropSet::Clear() {
}
}
+// Called to initiate enumeration
+bool PropSet::GetFirst(char **key, char **val) {
+ for (int i=0; i<hashRoots; i++) {
+ for (Property *p = props[i]; p; p = p->next) {
+ if (p) {
+ *key = p->key;
+ *val = p->val;
+ enumnext = p->next; // GetNext will begin here ...
+ enumhash = i; // ... in this block
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+// Called to continue enumeration
+bool PropSet::GetNext(char ** key,char ** val) {
+ bool firstloop = true;
+
+ // search begins where we left it : in enumhash block
+ for (int i=enumhash; i<hashRoots; i++) {
+ if (!firstloop)
+ enumnext=props[i]; // Begin with first property in block
+ // else : begin where we left
+ firstloop=false;
+
+ for (Property *p = enumnext; p; p = p->next) {
+ if (p) {
+ *key = p->key;
+ *val = p->val;
+ enumnext = p->next; // for GetNext
+ enumhash = i;
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
static bool iswordsep(char ch, bool onlyLineEnds) {
if (!isspace(ch))
return false;