From a4c4ed0147ff7cc15eb51d6ffb66a6ab23f32c53 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Wed, 21 Mar 2001 11:23:32 +0000 Subject: Enumeration interface from Laurent. --- src/PropSet.cxx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src') 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; inext) { + 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; inext) { + 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; -- cgit v1.2.3