use crate::ffi;
use glib::translate::*;
glib::wrapper! {
#[doc(alias = "GeglOperation")]
pub struct Operation(Object<ffi::GeglOperation>);
match fn {
type_ => || ffi::gegl_operation_get_type(),
}
}
impl Operation {
#[doc(alias = "gegl_operation_find_property")]
pub fn find_property(operation_type: &str, property_name: &str) -> Option<glib::ParamSpec> {
unsafe {
from_glib_none(ffi::gegl_operation_find_property(
operation_type.to_glib_none().0,
property_name.to_glib_none().0,
))
}
}
#[doc(alias = "gegl_operation_get_key")]
#[doc(alias = "get_key")]
pub fn key(operation_type: &str, key_name: &str) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::gegl_operation_get_key(
operation_type.to_glib_none().0,
key_name.to_glib_none().0,
))
}
}
#[doc(alias = "gegl_operation_get_op_version")]
#[doc(alias = "get_op_version")]
pub fn op_version(op_name: &str) -> Option<glib::GString> {
unsafe { from_glib_none(ffi::gegl_operation_get_op_version(op_name.to_glib_none().0)) }
}
#[doc(alias = "gegl_operation_get_property_key")]
#[doc(alias = "get_property_key")]
pub fn property_key(
operation_type: &str,
property_name: &str,
property_key_name: &str,
) -> Option<glib::GString> {
unsafe {
from_glib_none(ffi::gegl_operation_get_property_key(
operation_type.to_glib_none().0,
property_name.to_glib_none().0,
property_key_name.to_glib_none().0,
))
}
}
#[doc(alias = "gegl_operation_list_keys")]
pub fn list_keys(operation_type: &str) -> Vec<glib::GString> {
unsafe {
let mut n_keys = std::mem::MaybeUninit::uninit();
let ret = FromGlibContainer::from_glib_container_num(
ffi::gegl_operation_list_keys(operation_type.to_glib_none().0, n_keys.as_mut_ptr()),
n_keys.assume_init() as _,
);
ret
}
}
#[doc(alias = "gegl_operation_list_properties")]
pub fn list_properties(operation_type: &str) -> Vec<glib::ParamSpec> {
unsafe {
let mut n_properties_p = std::mem::MaybeUninit::uninit();
let ret = FromGlibContainer::from_glib_container_num(
ffi::gegl_operation_list_properties(
operation_type.to_glib_none().0,
n_properties_p.as_mut_ptr(),
),
n_properties_p.assume_init() as _,
);
ret
}
}
#[doc(alias = "gegl_operation_list_property_keys")]
pub fn list_property_keys(operation_type: &str, property_name: &str) -> Vec<glib::GString> {
unsafe {
let mut n_keys = std::mem::MaybeUninit::uninit();
let ret = FromGlibContainer::from_glib_container_num(
ffi::gegl_operation_list_property_keys(
operation_type.to_glib_none().0,
property_name.to_glib_none().0,
n_keys.as_mut_ptr(),
),
n_keys.assume_init() as _,
);
ret
}
}
}