diff options
author | nyamatongwe <unknown> | 2001-03-21 11:23:32 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2001-03-21 11:23:32 +0000 |
commit | ff2392c6c36dc4f5acbed3505ae584c97e63792a (patch) | |
tree | 9f24efb946d0bc37f5eecf09b92bba57a2659b41 | |
parent | cb058f017b74f6fcfa13d992723446e1bb8871f3 (diff) | |
download | scintilla-mirror-ff2392c6c36dc4f5acbed3505ae584c97e63792a.tar.gz |
Enumeration interface from Laurent.
-rw-r--r-- | src/PropSet.cxx | 40 |
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; |