// This file was generated by gir (https://github.com/gtk-rs/gir)
// from
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::{Document, ffi};
use glib::translate::*;

glib::wrapper! {
    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
    pub struct IndexIter(Boxed<ffi::PopplerIndexIter>);

    match fn {
        copy => |ptr| ffi::poppler_index_iter_copy(mut_override(ptr)),
        free => |ptr| ffi::poppler_index_iter_free(ptr),
        type_ => || ffi::poppler_index_iter_get_type(),
    }
}

impl IndexIter {
    #[doc(alias = "poppler_index_iter_new")]
    pub fn new(document: &Document) -> IndexIter {
        unsafe { from_glib_full(ffi::poppler_index_iter_new(document.to_glib_none().0)) }
    }

    //#[doc(alias = "poppler_index_iter_get_action")]
    //#[doc(alias = "get_action")]
    //pub fn action(&mut self) -> /*Ignored*/Option<Action> {
    //    unsafe { TODO: call ffi:poppler_index_iter_get_action() }
    //}

    #[doc(alias = "poppler_index_iter_get_child")]
    #[doc(alias = "get_child")]
    #[must_use]
    pub fn child(&mut self) -> Option<IndexIter> {
        unsafe { from_glib_full(ffi::poppler_index_iter_get_child(self.to_glib_none_mut().0)) }
    }

    #[doc(alias = "poppler_index_iter_is_open")]
    pub fn is_open(&mut self) -> bool {
        unsafe { from_glib(ffi::poppler_index_iter_is_open(self.to_glib_none_mut().0)) }
    }

    #[doc(alias = "poppler_index_iter_next")]
    pub fn next(&mut self) -> bool {
        unsafe { from_glib(ffi::poppler_index_iter_next(self.to_glib_none_mut().0)) }
    }
}
