DC_DESCRIPTOR_ITERATOR(3)

DC_DESCRIPTOR_ITERATOR(3) | Library Functions Manual | DC_DESCRIPTOR_ITERATOR(3)

# NAME

`dc_descriptor_iterator_new` — get all supported dive computers

# LIBRARY

library “libdivecomputer”

# SYNOPSIS

`#include <libdivecomputer/descriptor.h>`

dc_status_t
`dc_descriptor_iterator_new`(dc_iterator_t **iterator, dc_descriptor_t *descriptor);

# DESCRIPTION

Gets all descriptors available to library “libdivecomputer”. It must be matched with dc_iterator_free(3) if the return value is `DC_STATUS_SUCCESS`. The dc_iterator_next(3) function must be used to iterate over the iterator. You must use dc_descriptor_free(3) on the returned descriptor value.

# RETURN VALUES

This returns `DC_STATUS_SUCCESS` and fills in the iterator pointer on success.

# EXAMPLES

The following iterates over all descriptors, printing the vendor, then frees the iterator. It does no error checking.

    dc_descriptor_iterator_new(&iter, context));
    while (dc_iterator_next(iter, &desc) == DC_STATUS_SUCCESS) {
    	printf("%s\n", dc_descriptor_get_vendor(desc));
    	dc_descriptor_free(desc);
    }
    dc_iterator_free(iter);

# SEE ALSO

dc_descriptor_free(3), dc_iterator_free(3), dc_iterator_next(3)

# AUTHORS

The library “libdivecomputer” library was written by Jef Driesen, jef@libdivecomputer.org. The manpages were written by
Kristaps Dzonsons, kristaps@bsd.lv.

January 5, 2017 | NetBSD 11.0