1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// 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, Layer};
use glib::translate::*;

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

    match fn {
        copy => |ptr| ffi::poppler_layers_iter_copy(mut_override(ptr)),
        free => |ptr| ffi::poppler_layers_iter_free(ptr),
        type_ => || ffi::poppler_layers_iter_get_type(),
    }
}

impl LayersIter {
    /// ## `document`
    /// a [`Document`][crate::Document]
    #[doc(alias = "poppler_layers_iter_new")]
    pub fn new(document: &Document) -> LayersIter {
        unsafe { from_glib_full(ffi::poppler_layers_iter_new(document.to_glib_none().0)) }
    }

    /// Returns a newly created child of `self`, or [`None`] if the iter has no child.
    /// See [`new()`][Self::new()] for more information on this function.
    ///
    /// # Returns
    ///
    /// a new [`LayersIter`][crate::LayersIter], or [`None`]
    #[doc(alias = "poppler_layers_iter_get_child")]
    #[doc(alias = "get_child")]
    #[must_use]
    pub fn child(&mut self) -> Option<LayersIter> {
        unsafe {
            from_glib_full(ffi::poppler_layers_iter_get_child(
                self.to_glib_none_mut().0,
            ))
        }
    }

    /// Returns the [`Layer`][crate::Layer] associated with `self`.
    ///
    /// # Returns
    ///
    /// a new [`Layer`][crate::Layer], or [`None`] if
    /// there isn't any layer associated with `self`
    #[doc(alias = "poppler_layers_iter_get_layer")]
    #[doc(alias = "get_layer")]
    pub fn layer(&mut self) -> Option<Layer> {
        unsafe {
            from_glib_full(ffi::poppler_layers_iter_get_layer(
                self.to_glib_none_mut().0,
            ))
        }
    }

    /// Returns the title associated with `self`. It must be freed with
    /// `g_free()`.
    ///
    /// # Returns
    ///
    /// a new string containing the `self`'s title or [`None`] if `self` doesn't have a title.
    /// The returned string should be freed with `g_free()` when no longer needed.
    #[doc(alias = "poppler_layers_iter_get_title")]
    #[doc(alias = "get_title")]
    pub fn title(&mut self) -> Option<glib::GString> {
        unsafe {
            from_glib_full(ffi::poppler_layers_iter_get_title(
                self.to_glib_none_mut().0,
            ))
        }
    }

    /// Sets `self` to point to the next action at the current level, if valid. See
    /// [`new()`][Self::new()] for more information.
    ///
    /// # Returns
    ///
    /// [`true`], if `self` was set to the next action
    #[doc(alias = "poppler_layers_iter_next")]
    pub fn next(&mut self) -> bool {
        unsafe { from_glib(ffi::poppler_layers_iter_next(self.to_glib_none_mut().0)) }
    }
}