#315 closed defect (fixed)
psMetadataIteratorSet
| Reported by: | Owned by: | eugene | |
|---|---|---|---|
| Priority: | high | Milestone: | |
| Component: | PSLib SDRS | Version: | unspecified |
| Severity: | normal | Keywords: | |
| Cc: |
Description
Iterating using regex seems a bit awkward, as there is no good way to set the
iterator at the first match of regex. If you use psMetadataIteratorSet(md,0),
you can set the iterator to the first on the list, but you need to know if that
matches the regular expression, and if not, call psMetadataGetAndIncrement to
search for the first matching occurrance.
I think that psMetadataIteratorSet should take a regex parameter just like
psMetadataGetAndIncrement. PS_LIST_HEAD would position to the first matching
regex, PS_LIST_TAIL would position to the last matching regex, and n>0 would
position to the (n-1)th matching occurrance.
In other words, regex would be used to virtually subset the list and one could
consider oneself iterating over that subset.
psMetadataIteratorSet(psListIterator* iter, int location, const char* regex);
-rdd
Change History (5)
comment:1 by , 21 years ago
| Owner: | changed from to |
|---|
comment:2 by , 21 years ago
comment:3 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
I like this; it seems like a reasonable improvement over the original API
let's go with this model.
comment:4 by , 21 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
The latest SDRS does not match what I thought we agreed upon here, namely regex
is not an input of psMetadataIteratorAlloc but is still in
psMetadataGetAndIncrement/Decrement.
Rel5 has what I thought was agreed upon here; please review that and tell me if
that looks to be what was expected.
-rdd
comment:5 by , 21 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
the rel5 implementation is what we agreed to. I've fixed the working version of
the SDRS and will include this fix in the next update.

I was pondering this last-night and concluded that maybe the best thing would be
to make a psMetadataIterator struct like this:
typedef struct {
} psMetadataIterator;
and then have a allocator like this:
psMetadataIterator(psMetadata* md, const char* regex, int location);
and then drop the regex from the other psMetadataIterator functions, i.e.,
psMetadataGetAndIncrement, etc.
If there was a desire to have a mutable iterator, one could add that in if
psMetadataIterator had its own set of functions as opposed to using
psListIterator functions.
-rdd