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
// 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, ResolutionUnit};
use glib::{prelude::*, translate::*};

glib::wrapper! {
    ///
    ///
    /// # Implements
    ///
    /// [`MetadataExt`][trait@crate::prelude::MetadataExt]
    #[doc(alias = "GeglMetadata")]
    pub struct Metadata(Interface<ffi::GeglMetadata, ffi::GeglMetadataInterface>);

    match fn {
        type_ => || ffi::gegl_metadata_get_type(),
    }
}

impl Metadata {
    pub const NONE: Option<&'static Metadata> = None;
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Metadata>> Sealed for T {}
}

/// Trait containing all [`struct@Metadata`] methods.
///
/// # Implementors
///
/// [`MetadataHash`][struct@crate::MetadataHash], [`MetadataStore`][struct@crate::MetadataStore], [`Metadata`][struct@crate::Metadata]
pub trait MetadataExt: IsA<Metadata> + sealed::Sealed + 'static {
    //#[doc(alias = "gegl_metadata_iter_get_value")]
    //fn iter_get_value(&self, iter: /*Ignored*/&mut MetadataIter, value: &mut glib::Value) -> bool {
    //    unsafe { TODO: call ffi:gegl_metadata_iter_get_value() }
    //}

    //#[doc(alias = "gegl_metadata_iter_init")]
    //fn iter_init(&self, iter: /*Ignored*/&mut MetadataIter) {
    //    unsafe { TODO: call ffi:gegl_metadata_iter_init() }
    //}

    //#[doc(alias = "gegl_metadata_iter_lookup")]
    //fn iter_lookup(&self, iter: /*Ignored*/&mut MetadataIter, key: &str) -> bool {
    //    unsafe { TODO: call ffi:gegl_metadata_iter_lookup() }
    //}

    //#[doc(alias = "gegl_metadata_iter_next")]
    //fn iter_next(&self, iter: /*Ignored*/&mut MetadataIter) -> Option<glib::GString> {
    //    unsafe { TODO: call ffi:gegl_metadata_iter_next() }
    //}

    //#[doc(alias = "gegl_metadata_iter_set_value")]
    //fn iter_set_value(&self, iter: /*Ignored*/&mut MetadataIter, value: &glib::Value) -> bool {
    //    unsafe { TODO: call ffi:gegl_metadata_iter_set_value() }
    //}

    //#[doc(alias = "gegl_metadata_register_map")]
    //fn register_map(&self, file_module: &str, flags: u32, map: /*Ignored*/&[MetadataMap]) {
    //    unsafe { TODO: call ffi:gegl_metadata_register_map() }
    //}

    /// Set resolution retrieved from image file's metadata. Intended for use by
    /// the image file reader. If resolution is not supported by the application or
    /// if the operation fails [`false`] is returned and the values are ignored.
    /// ## `unit`
    /// Specify [`ResolutionUnit`][crate::ResolutionUnit]
    /// ## `x`
    /// X resolution
    /// ## `y`
    /// Y resolution
    ///
    /// # Returns
    ///
    /// [`true`] if successful.
    #[doc(alias = "gegl_metadata_set_resolution")]
    fn set_resolution(&self, unit: ResolutionUnit, x: f32, y: f32) -> bool {
        unsafe {
            from_glib(ffi::gegl_metadata_set_resolution(
                self.as_ref().to_glib_none().0,
                unit.into_glib(),
                x,
                y,
            ))
        }
    }

    /// Unregister the file module mappings and any further mappings added or
    /// modified by the application. This should be called after the file module
    /// completes operations.
    #[doc(alias = "gegl_metadata_unregister_map")]
    fn unregister_map(&self) {
        unsafe {
            ffi::gegl_metadata_unregister_map(self.as_ref().to_glib_none().0);
        }
    }
}

impl<O: IsA<Metadata>> MetadataExt for O {}