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
143
144
145
146
// Generated by gir (https://github.com/gtk-rs/gir @ d7c0763cacbc)
// from gir-files (https://github.com/gtk-rs/gir-files @ 4d1189172a70)
// DO NOT EDIT

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 {
    /// ## `operation_type`
    /// the name of the operation type we want to locate a property on.
    /// ## `property_name`
    /// the name of the property we seek.
    ///
    /// # Returns
    ///
    /// The paramspec of the matching property - or
    /// NULL if there as no match.
    #[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)) }
    }

    /// ## `operation_type`
    /// the name of the operation type we want to query to property keys for.
    /// ## `property_name`
    /// the property to query a key for.
    /// ## `property_key_name`
    /// the property mata data key to query
    ///
    /// # Returns
    ///
    /// NULL or a string with the meta-data value for the operation
    /// key.
    #[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,
            ))
        }
    }

    /// ## `operation_type`
    /// the name of the operation type we want to query to property keys for.
    ///
    /// # Returns
    ///
    /// An allocated NULL
    /// terminated array of operation-key names. The list should be freed with g_free after use.
    #[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
        }
    }

    /// ## `operation_type`
    /// the name of the operation type we want to query to properties of.
    ///
    /// # Returns
    ///
    /// An allocated array of `GParamSpecs` describing the properties
    /// of the operation available when a node has operation_type set. The list should be freed with g_free after use.
    #[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
        }
    }

    /// ## `operation_type`
    /// the name of the operation type we want to query to property keys for.
    /// ## `property_name`
    /// the property to query a key for.
    ///
    /// # Returns
    ///
    /// An allocated NULL terminated array of property-key names. The list should be freed with g_free after use.
    #[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
        }
    }
}