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

use crate::DOMCSSStyleSheet;
use crate::DOMDocument;
use crate::DOMDocumentType;
use crate::DOMHTMLDocument;
use crate::DOMObject;
use glib::object::IsA;
use glib::translate::*;
use std::fmt;
use std::ptr;

glib::wrapper! {
    #[doc(alias = "WebKitDOMDOMImplementation")]
    pub struct DOMDOMImplementation(Object<ffi::WebKitDOMDOMImplementation, ffi::WebKitDOMDOMImplementationClass>) @extends DOMObject;

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

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

pub trait DOMDOMImplementationExt: 'static {
    #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
    #[doc(alias = "webkit_dom_dom_implementation_create_css_style_sheet")]
    fn create_css_style_sheet(&self, title: &str, media: &str) -> Result<DOMCSSStyleSheet, glib::Error>;

    #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
    #[doc(alias = "webkit_dom_dom_implementation_create_document")]
    fn create_document(&self, namespaceURI: Option<&str>, qualifiedName: &str, doctype: Option<&impl IsA<DOMDocumentType>>) -> Result<DOMDocument, glib::Error>;

    #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
    #[doc(alias = "webkit_dom_dom_implementation_create_document_type")]
    fn create_document_type(&self, qualifiedName: &str, publicId: &str, systemId: &str) -> Result<DOMDocumentType, glib::Error>;

    #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
    #[doc(alias = "webkit_dom_dom_implementation_create_html_document")]
    fn create_html_document(&self, title: &str) -> Option<DOMHTMLDocument>;

    #[cfg_attr(feature = "v2_22", deprecated = "Since 2.22")]
    #[doc(alias = "webkit_dom_dom_implementation_has_feature")]
    fn has_feature(&self, feature: &str, version: &str) -> bool;
}

impl<O: IsA<DOMDOMImplementation>> DOMDOMImplementationExt for O {
    fn create_css_style_sheet(&self, title: &str, media: &str) -> Result<DOMCSSStyleSheet, glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let ret = ffi::webkit_dom_dom_implementation_create_css_style_sheet(self.as_ref().to_glib_none().0, title.to_glib_none().0, media.to_glib_none().0, &mut error);
            if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) }
        }
    }

    fn create_document(&self, namespaceURI: Option<&str>, qualifiedName: &str, doctype: Option<&impl IsA<DOMDocumentType>>) -> Result<DOMDocument, glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let ret = ffi::webkit_dom_dom_implementation_create_document(self.as_ref().to_glib_none().0, namespaceURI.to_glib_none().0, qualifiedName.to_glib_none().0, doctype.map(|p| p.as_ref()).to_glib_none().0, &mut error);
            if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) }
        }
    }

    fn create_document_type(&self, qualifiedName: &str, publicId: &str, systemId: &str) -> Result<DOMDocumentType, glib::Error> {
        unsafe {
            let mut error = ptr::null_mut();
            let ret = ffi::webkit_dom_dom_implementation_create_document_type(self.as_ref().to_glib_none().0, qualifiedName.to_glib_none().0, publicId.to_glib_none().0, systemId.to_glib_none().0, &mut error);
            if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) }
        }
    }

    fn create_html_document(&self, title: &str) -> Option<DOMHTMLDocument> {
        unsafe {
            from_glib_none(ffi::webkit_dom_dom_implementation_create_html_document(self.as_ref().to_glib_none().0, title.to_glib_none().0))
        }
    }

    fn has_feature(&self, feature: &str, version: &str) -> bool {
        unsafe {
            from_glib(ffi::webkit_dom_dom_implementation_has_feature(self.as_ref().to_glib_none().0, feature.to_glib_none().0, version.to_glib_none().0))
        }
    }
}

impl fmt::Display for DOMDOMImplementation {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("DOMDOMImplementation")
    }
}