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
// This file was generated by gir (https://github.com/gtk-rs/gir)
// DO NOT EDIT

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

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

    match fn {
        ref => |ptr| ffi::wp_spa_json_builder_ref(ptr),
        unref => |ptr| ffi::wp_spa_json_builder_unref(ptr),
        type_ => || ffi::wp_spa_json_builder_get_type(),
    }
}

impl SpaJsonBuilder {
    #[doc(alias = "wp_spa_json_builder_new_array")]
    pub fn new_array() -> SpaJsonBuilder {
        unsafe {
            from_glib_full(ffi::wp_spa_json_builder_new_array())
        }
    }

    #[doc(alias = "wp_spa_json_builder_new_object")]
    pub fn new_object() -> SpaJsonBuilder {
        unsafe {
            from_glib_full(ffi::wp_spa_json_builder_new_object())
        }
    }

    #[doc(alias = "wp_spa_json_builder_add_boolean")]
    pub fn add_boolean(&self, value: bool) {
        unsafe {
            ffi::wp_spa_json_builder_add_boolean(self.to_glib_none().0, value.into_glib());
        }
    }

    #[doc(alias = "wp_spa_json_builder_add_float")]
    pub fn add_float(&self, value: f32) {
        unsafe {
            ffi::wp_spa_json_builder_add_float(self.to_glib_none().0, value);
        }
    }

    #[doc(alias = "wp_spa_json_builder_add_int")]
    pub fn add_int(&self, value: i32) {
        unsafe {
            ffi::wp_spa_json_builder_add_int(self.to_glib_none().0, value);
        }
    }

    #[doc(hidden)]
    #[doc(alias = "wp_spa_json_builder_add_json")]
    #[doc(alias = "add_json")]
    pub fn add_spa_json(&self, json: &SpaJson) {
        unsafe {
            ffi::wp_spa_json_builder_add_json(self.to_glib_none().0, json.to_glib_none().0);
        }
    }

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

    #[doc(alias = "wp_spa_json_builder_add_property")]
    pub fn add_property(&self, key: &str) {
        unsafe {
            ffi::wp_spa_json_builder_add_property(self.to_glib_none().0, key.to_glib_none().0);
        }
    }

    #[doc(alias = "wp_spa_json_builder_add_string")]
    pub fn add_string(&self, value: &str) {
        unsafe {
            ffi::wp_spa_json_builder_add_string(self.to_glib_none().0, value.to_glib_none().0);
        }
    }

    #[doc(alias = "wp_spa_json_builder_end")]
    pub fn end(&self) -> SpaJson {
        unsafe {
            from_glib_full(ffi::wp_spa_json_builder_end(self.to_glib_none().0))
        }
    }
}