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 }
}
}
}