Vindaar/nimhdf5

add `contains` proc for file and groups

Vindaar opened this issue · 1 comments

If we add the contains proc for the H5FileObj and H5Group (maybe H5Attributes as well?), we can simply use the Nim in and notin keywords, which would be very handy.

Somewhat related to #2.

Added by commit 315ad7e

Note that currently it is not possible to look up elements in subgroups, if contains is called on a group.
For example:

# assuming we have an open file h5f, which contains "/group/in/group/dset"
let g = h5f["/group".grp_str]
# the following works
doAssert "in" in g == true
doAssert "/group/in" in g == true
# this does not, despite there being such a dataset
doAssert "in/group/dset" in g == true
# checking on the file works
doAssert "/group/in/group/dset" in h5f == true

This is due to the way H5Group objects are created.