DC_DESCRIPTOR_ITERATOR(3) Library Functions Manual DC_DESCRIPTOR_ITERATOR(3)

dc_descriptor_iterator
get all supported dive computers

library “libdivecomputer”

#include <libdivecomputer/descriptor.h>
dc_status_t
dc_descriptor_iterator(dc_iterator_t **iterator);

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.

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

The following iterates over all descriptors, printing the vendor, then frees the iterator. It does no error checking.
dc_descriptor_iterator(&iter)); 
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);

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

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 Debian