1 module webkit2webextension.DOMAttr;
2 
3 private import glib.ErrorG;
4 private import glib.GException;
5 private import glib.Str;
6 private import gobject.ObjectG;
7 private import webkit2webextension.DOMElement;
8 private import webkit2webextension.DOMNode;
9 private import webkit2webextension.c.functions;
10 public  import webkit2webextension.c.types;
11 
12 
13 /** */
14 public class DOMAttr : DOMNode
15 {
16 	/** the main Gtk struct */
17 	protected WebKitDOMAttr* webKitDOMAttr;
18 
19 	/** Get the main Gtk struct */
20 	public WebKitDOMAttr* getDOMAttrStruct(bool transferOwnership = false)
21 	{
22 		if (transferOwnership)
23 			ownedRef = false;
24 		return webKitDOMAttr;
25 	}
26 
27 	/** the main Gtk struct as a void* */
28 	protected override void* getStruct()
29 	{
30 		return cast(void*)webKitDOMAttr;
31 	}
32 
33 	/**
34 	 * Sets our main struct and passes it to the parent class.
35 	 */
36 	public this (WebKitDOMAttr* webKitDOMAttr, bool ownedRef = false)
37 	{
38 		this.webKitDOMAttr = webKitDOMAttr;
39 		super(cast(WebKitDOMNode*)webKitDOMAttr, ownedRef);
40 	}
41 
42 
43 	/** */
44 	public static GType getType()
45 	{
46 		return webkit_dom_attr_get_type();
47 	}
48 
49 	/**
50 	 *
51 	 *
52 	 * Deprecated: Use JavaScriptCore API instead
53 	 *
54 	 * Returns: A #gchar
55 	 *
56 	 * Since: 2.14
57 	 */
58 	public override string getLocalName()
59 	{
60 		auto retStr = webkit_dom_attr_get_local_name(webKitDOMAttr);
61 
62 		scope(exit) Str.freeString(retStr);
63 		return Str.toString(retStr);
64 	}
65 
66 	/**
67 	 *
68 	 *
69 	 * Deprecated: Use JavaScriptCore API instead
70 	 *
71 	 * Returns: A #gchar
72 	 */
73 	public string getName()
74 	{
75 		auto retStr = webkit_dom_attr_get_name(webKitDOMAttr);
76 
77 		scope(exit) Str.freeString(retStr);
78 		return Str.toString(retStr);
79 	}
80 
81 	/**
82 	 *
83 	 *
84 	 * Deprecated: Use JavaScriptCore API instead
85 	 *
86 	 * Returns: A #gchar
87 	 *
88 	 * Since: 2.14
89 	 */
90 	public override string getNamespaceUri()
91 	{
92 		auto retStr = webkit_dom_attr_get_namespace_uri(webKitDOMAttr);
93 
94 		scope(exit) Str.freeString(retStr);
95 		return Str.toString(retStr);
96 	}
97 
98 	/**
99 	 *
100 	 *
101 	 * Deprecated: Use JavaScriptCore API instead
102 	 *
103 	 * Returns: A #WebKitDOMElement
104 	 */
105 	public DOMElement getOwnerElement()
106 	{
107 		auto __p = webkit_dom_attr_get_owner_element(webKitDOMAttr);
108 
109 		if(__p is null)
110 		{
111 			return null;
112 		}
113 
114 		return ObjectG.getDObject!(DOMElement)(cast(WebKitDOMElement*) __p);
115 	}
116 
117 	/**
118 	 *
119 	 *
120 	 * Deprecated: Use JavaScriptCore API instead
121 	 *
122 	 * Returns: A #gchar
123 	 *
124 	 * Since: 2.14
125 	 */
126 	public override string getPrefix()
127 	{
128 		auto retStr = webkit_dom_attr_get_prefix(webKitDOMAttr);
129 
130 		scope(exit) Str.freeString(retStr);
131 		return Str.toString(retStr);
132 	}
133 
134 	/**
135 	 *
136 	 *
137 	 * Deprecated: Use JavaScriptCore API instead
138 	 *
139 	 * Returns: A #gboolean
140 	 */
141 	public bool getSpecified()
142 	{
143 		return webkit_dom_attr_get_specified(webKitDOMAttr) != 0;
144 	}
145 
146 	/**
147 	 *
148 	 *
149 	 * Deprecated: Use JavaScriptCore API instead
150 	 *
151 	 * Returns: A #gchar
152 	 */
153 	public string getValue()
154 	{
155 		auto retStr = webkit_dom_attr_get_value(webKitDOMAttr);
156 
157 		scope(exit) Str.freeString(retStr);
158 		return Str.toString(retStr);
159 	}
160 
161 	/**
162 	 *
163 	 *
164 	 * Deprecated: Use JavaScriptCore API instead
165 	 *
166 	 * Params:
167 	 *     value = A #gchar
168 	 *
169 	 * Throws: GException on failure.
170 	 */
171 	public void setValue(string value)
172 	{
173 		GError* err = null;
174 
175 		webkit_dom_attr_set_value(webKitDOMAttr, Str.toStringz(value), &err);
176 
177 		if (err !is null)
178 		{
179 			throw new GException( new ErrorG(err) );
180 		}
181 	}
182 }