libdivecomputer/doc/man/dc_descriptor_iterator.3
2017-01-07 13:41:07 +01:00

79 lines
2.1 KiB
Groff

.\"
.\" libdivecomputer
.\"
.\" Copyright (C) 2017 Kristaps Dzonsons <kristaps@bsd.lv>
.\"
.\" This library is free software; you can redistribute it and/or
.\" modify it under the terms of the GNU Lesser General Public
.\" License as published by the Free Software Foundation; either
.\" version 2.1 of the License, or (at your option) any later version.
.\"
.\" This library is distributed in the hope that it will be useful,
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
.\" Lesser General Public License for more details.
.\"
.\" You should have received a copy of the GNU Lesser General Public
.\" License along with this library; if not, write to the Free Software
.\" Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
.\" MA 02110-1301 USA
.\"
.Dd January 5, 2017
.Dt DC_DESCRIPTOR_ITERATOR 3
.Os
.Sh NAME
.Nm dc_descriptor_iterator
.Nd get all supported dive computers
.Sh LIBRARY
.Lb libdivecomputer
.Sh SYNOPSIS
.In libdivecomputer/descriptor.h
.Ft dc_status_t
.Fo dc_descriptor_iterator
.Fa "dc_iterator_t **iterator"
.Fc
.Sh DESCRIPTION
Gets all descriptors available to
.Lb libdivecomputer .
It must be matched with
.Xr dc_iterator_free 3
if the return value is
.Dv DC_STATUS_SUCCESS .
The
.Xr dc_iterator_next 3
function must be used to iterate over the iterator.
You must use
.Xr dc_descriptor_free 3
on the returned descriptor value.
.Sh RETURN VALUES
This returns
.Dv DC_STATUS_SUCCESS
and fills in the
.Fa iterator
pointer on success.
.Sh EXAMPLES
The following iterates over all descriptors, printing the vendor, then
frees the iterator.
It does no error checking.
.Bd -literal
dc_descriptor_iterator(&iter));
while (dc_iterator_next(iter, &desc) == DC_STATUS_SUCCESS) {
printf("%s\en", dc_descriptor_get_vendor(desc));
dc_descriptor_free(desc);
}
dc_iterator_free(iter);
.Ed
.Sh SEE ALSO
.Xr dc_descriptor_free 3 ,
.Xr dc_iterator_free 3 ,
.Xr dc_iterator_next 3
.Sh AUTHORS
The
.Lb libdivecomputer
library was written by
.An Jef Driesen ,
.Mt jef@libdivecomputer.org .
The manpages were written by
.An Kristaps Dzonsons ,
.Mt kristaps@bsd.lv .