+/*!
+@def ARGPAR_ITEM_DESTROY_AND_RESET(_item)
+
+@brief
+ Calls argpar_item_destroy() with \p _item, and then sets \p _item
+ to \c NULL.
+
+@param[in] _item
+ Item to destroy and variable to reset
+ (<code>const struct argpar_item *</code> type).
+*/
+#define ARGPAR_ITEM_DESTROY_AND_RESET(_item) \
+ { \
+ argpar_item_destroy(_item); \
+ _item = NULL; \
+ }
+
+/// @}
+
+/*!
+@name Iterator API
+@{
+*/
+
+/*!
+@brief
+ Option descriptor
+
+argpar_iter_create() accepts an array of instances of such a type,
+terminated with #ARGPAR_OPT_DESCR_SENTINEL, as its \p descrs parameter.
+
+The typical usage is, for example:
+
+@code
+const struct argpar_opt_descr descrs[] = {
+ { 0, 'd', NULL, false },
+ { 1, '\0', "squeeze", true },
+ { 2, 'm', "meow", true },
+ ARGPAR_OPT_DESCR_SENTINEL,
+};
+@endcode
+*/
+struct argpar_opt_descr {
+ /// Numeric ID, to uniquely identify this descriptor
+ const int id;
+
+ /// Short option character, or <code>'\0'</code>
+ const char short_name;
+
+ /// Long option name (without the <code>\--</code> prefix), or \c NULL
+ const char * const long_name;
+
+ /// \c true if this option has an argument
+ const bool with_arg;
+};
+
+/*!
+@brief
+ Sentinel for an option descriptor array
+
+The typical usage is, for example:
+
+@code
+const struct argpar_opt_descr descrs[] = {
+ { 0, 'd', NULL, false },
+ { 1, '\0', "squeeze", true },
+ { 2, 'm', "meow", true },
+ ARGPAR_OPT_DESCR_SENTINEL,
+};
+@endcode
+*/
+#define ARGPAR_OPT_DESCR_SENTINEL { -1, '\0', NULL, false }
+
+/*!
+@struct argpar_iter
+
+@brief
+ Opaque argpar iterator type
+
+argpar_iter_create() returns a pointer to such a type.
+*/
+struct argpar_iter;
+
+/*!
+@brief
+ Creates and returns an argument parsing iterator to parse the
+ original arguments \p argv of which the count is \p argc using the
+ option descriptors \p descrs.
+
+This function initializes the returned structure, but doesn't actually
+start parsing the arguments.
+
+argpar considers \em all the elements of \p argv, including the first
+one, so that you would typically pass <code>(argc - 1)</code> as \p argc
+and <code>\&argv[1]</code> as \p argv from what <code>main()</code>
+receives, or ignore the parsing item of the first call to
+argpar_iter_next().
+
+\p *argv and \p *descrs must \em not change for the lifetime of the
+returned iterator (until you call argpar_iter_destroy()) and for the
+lifetime of any parsing item (until you call argpar_item_destroy())
+which argpar_iter_next() creates from the returned iterator.
+
+@param[in] argc
+ Number of original arguments to parse in \p argv.
+@param[in] argv
+ Original arguments to parse, of which the count is \p argc.
+@param[in] descrs
+ @parblock
+ Option descriptor array, terminated with #ARGPAR_OPT_DESCR_SENTINEL.
+
+ May contain duplicate entries.
+ @endparblock
+
+@returns
+ New argument parsing iterator, or \c NULL on memory error.
+
+@pre
+ \p argc is greater than 0.
+@pre
+ \p argv is not \c NULL.
+@pre
+ The first \p argc elements of \p argv are not \c NULL.
+@pre
+ \p descrs is not \c NULL.
+
+@sa
+ argpar_iter_destroy() -- Destroys an argument parsing iterator.
+*/
+/// @cond hidden_macro