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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
// This file was generated by gir (https://github.com/gtk-rs/gir)
// DO NOT EDIT

use crate::{SpaPod};
use glib::{translate::*};

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

    match fn {
        ref => |ptr| ffi::wp_spa_pod_parser_ref(ptr),
        unref => |ptr| ffi::wp_spa_pod_parser_unref(ptr),
        type_ => || ffi::wp_spa_pod_parser_get_type(),
    }
}

impl SpaPodParser {
    #[doc(alias = "wp_spa_pod_parser_new_struct")]
    pub fn new_struct(pod: &SpaPod) -> SpaPodParser {
        unsafe {
            from_glib_full(ffi::wp_spa_pod_parser_new_struct(pod.to_glib_none().0))
        }
    }

    #[doc(alias = "wp_spa_pod_parser_end")]
    pub fn end(&self) {
        unsafe {
            ffi::wp_spa_pod_parser_end(self.to_glib_none().0);
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_boolean")]
    #[doc(alias = "get_boolean")]
    pub fn boolean(&self) -> Option<bool> {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_boolean(self.to_glib_none().0, value.as_mut_ptr()));
            if ret { Some(from_glib(value.assume_init())) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_double")]
    #[doc(alias = "get_double")]
    pub fn double(&self) -> Option<f64> {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_double(self.to_glib_none().0, value.as_mut_ptr()));
            if ret { Some(value.assume_init()) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_fd")]
    #[doc(alias = "get_fd")]
    pub fn fd(&self) -> Option<i64> {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_fd(self.to_glib_none().0, value.as_mut_ptr()));
            if ret { Some(value.assume_init()) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_float")]
    #[doc(alias = "get_float")]
    pub fn float(&self) -> Option<f32> {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_float(self.to_glib_none().0, value.as_mut_ptr()));
            if ret { Some(value.assume_init()) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_fraction")]
    #[doc(alias = "get_fraction")]
    pub fn fraction(&self) -> Option<(u32, u32)> {
        unsafe {
            let mut num = std::mem::MaybeUninit::uninit();
            let mut denom = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_fraction(self.to_glib_none().0, num.as_mut_ptr(), denom.as_mut_ptr()));
            if ret { Some((num.assume_init(), denom.assume_init())) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_id")]
    #[doc(alias = "get_id")]
    pub fn id(&self) -> Option<u32> {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_id(self.to_glib_none().0, value.as_mut_ptr()));
            if ret { Some(value.assume_init()) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_int")]
    #[doc(alias = "get_int")]
    pub fn int(&self) -> Option<i32> {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_int(self.to_glib_none().0, value.as_mut_ptr()));
            if ret { Some(value.assume_init()) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_long")]
    #[doc(alias = "get_long")]
    pub fn long(&self) -> Option<i64> {
        unsafe {
            let mut value = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_long(self.to_glib_none().0, value.as_mut_ptr()));
            if ret { Some(value.assume_init()) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_pod")]
    #[doc(alias = "get_pod")]
    pub fn pod(&self) -> Option<SpaPod> {
        unsafe {
            from_glib_full(ffi::wp_spa_pod_parser_get_pod(self.to_glib_none().0))
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_rectangle")]
    #[doc(alias = "get_rectangle")]
    pub fn rectangle(&self) -> Option<(u32, u32)> {
        unsafe {
            let mut width = std::mem::MaybeUninit::uninit();
            let mut height = std::mem::MaybeUninit::uninit();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_rectangle(self.to_glib_none().0, width.as_mut_ptr(), height.as_mut_ptr()));
            if ret { Some((width.assume_init(), height.assume_init())) } else { None }
        }
    }

    #[doc(alias = "wp_spa_pod_parser_get_string")]
    #[doc(alias = "get_string")]
    pub fn string(&self) -> Option<glib::GString> {
        unsafe {
            let mut value = std::ptr::null();
            let ret = from_glib(ffi::wp_spa_pod_parser_get_string(self.to_glib_none().0, &mut value));
            if ret { Some(from_glib_full(value)) } else { None }
        }
    }
}