1 module webkit2webextension.DOMXPathResult;
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.DOMNode;
8 private import webkit2webextension.DOMObject;
9 private import webkit2webextension.c.functions;
10 public  import webkit2webextension.c.types;
11 
12 
13 /** */
14 public class DOMXPathResult : DOMObject
15 {
16 	/** the main Gtk struct */
17 	protected WebKitDOMXPathResult* webKitDOMXPathResult;
18 
19 	/** Get the main Gtk struct */
20 	public WebKitDOMXPathResult* getDOMXPathResultStruct(bool transferOwnership = false)
21 	{
22 		if (transferOwnership)
23 			ownedRef = false;
24 		return webKitDOMXPathResult;
25 	}
26 
27 	/** the main Gtk struct as a void* */
28 	protected override void* getStruct()
29 	{
30 		return cast(void*)webKitDOMXPathResult;
31 	}
32 
33 	/**
34 	 * Sets our main struct and passes it to the parent class.
35 	 */
36 	public this (WebKitDOMXPathResult* webKitDOMXPathResult, bool ownedRef = false)
37 	{
38 		this.webKitDOMXPathResult = webKitDOMXPathResult;
39 		super(cast(WebKitDOMObject*)webKitDOMXPathResult, ownedRef);
40 	}
41 
42 
43 	/** */
44 	public static GType getType()
45 	{
46 		return webkit_dom_xpath_result_get_type();
47 	}
48 
49 	/**
50 	 *
51 	 *
52 	 * Deprecated: Use JavaScriptCore API instead
53 	 *
54 	 * Returns: A #gboolean
55 	 *
56 	 * Throws: GException on failure.
57 	 */
58 	public bool getBooleanValue()
59 	{
60 		GError* err = null;
61 
62 		auto __p = webkit_dom_xpath_result_get_boolean_value(webKitDOMXPathResult, &err) != 0;
63 
64 		if (err !is null)
65 		{
66 			throw new GException( new ErrorG(err) );
67 		}
68 
69 		return __p;
70 	}
71 
72 	/**
73 	 *
74 	 *
75 	 * Deprecated: Use JavaScriptCore API instead
76 	 *
77 	 * Returns: A #gboolean
78 	 */
79 	public bool getInvalidIteratorState()
80 	{
81 		return webkit_dom_xpath_result_get_invalid_iterator_state(webKitDOMXPathResult) != 0;
82 	}
83 
84 	/**
85 	 *
86 	 *
87 	 * Deprecated: Use JavaScriptCore API instead
88 	 *
89 	 * Returns: A #gdouble
90 	 *
91 	 * Throws: GException on failure.
92 	 */
93 	public double getNumberValue()
94 	{
95 		GError* err = null;
96 
97 		auto __p = webkit_dom_xpath_result_get_number_value(webKitDOMXPathResult, &err);
98 
99 		if (err !is null)
100 		{
101 			throw new GException( new ErrorG(err) );
102 		}
103 
104 		return __p;
105 	}
106 
107 	/**
108 	 *
109 	 *
110 	 * Deprecated: Use JavaScriptCore API instead
111 	 *
112 	 * Returns: A #gushort
113 	 */
114 	public ushort getResultType()
115 	{
116 		return webkit_dom_xpath_result_get_result_type(webKitDOMXPathResult);
117 	}
118 
119 	/**
120 	 *
121 	 *
122 	 * Deprecated: Use JavaScriptCore API instead
123 	 *
124 	 * Returns: A #WebKitDOMNode
125 	 *
126 	 * Throws: GException on failure.
127 	 */
128 	public DOMNode getSingleNodeValue()
129 	{
130 		GError* err = null;
131 
132 		auto __p = webkit_dom_xpath_result_get_single_node_value(webKitDOMXPathResult, &err);
133 
134 		if (err !is null)
135 		{
136 			throw new GException( new ErrorG(err) );
137 		}
138 
139 		if(__p is null)
140 		{
141 			return null;
142 		}
143 
144 		return ObjectG.getDObject!(DOMNode)(cast(WebKitDOMNode*) __p);
145 	}
146 
147 	/**
148 	 *
149 	 *
150 	 * Deprecated: Use JavaScriptCore API instead
151 	 *
152 	 * Returns: A #gulong
153 	 *
154 	 * Throws: GException on failure.
155 	 */
156 	public gulong getSnapshotLength()
157 	{
158 		GError* err = null;
159 
160 		auto __p = webkit_dom_xpath_result_get_snapshot_length(webKitDOMXPathResult, &err);
161 
162 		if (err !is null)
163 		{
164 			throw new GException( new ErrorG(err) );
165 		}
166 
167 		return __p;
168 	}
169 
170 	/**
171 	 *
172 	 *
173 	 * Deprecated: Use JavaScriptCore API instead
174 	 *
175 	 * Returns: A #gchar
176 	 *
177 	 * Throws: GException on failure.
178 	 */
179 	public string getStringValue()
180 	{
181 		GError* err = null;
182 
183 		auto retStr = webkit_dom_xpath_result_get_string_value(webKitDOMXPathResult, &err);
184 
185 		if (err !is null)
186 		{
187 			throw new GException( new ErrorG(err) );
188 		}
189 
190 		scope(exit) Str.freeString(retStr);
191 		return Str.toString(retStr);
192 	}
193 
194 	/**
195 	 *
196 	 *
197 	 * Deprecated: Use JavaScriptCore API instead
198 	 *
199 	 * Returns: A #WebKitDOMNode
200 	 *
201 	 * Throws: GException on failure.
202 	 */
203 	public DOMNode iterateNext()
204 	{
205 		GError* err = null;
206 
207 		auto __p = webkit_dom_xpath_result_iterate_next(webKitDOMXPathResult, &err);
208 
209 		if (err !is null)
210 		{
211 			throw new GException( new ErrorG(err) );
212 		}
213 
214 		if(__p is null)
215 		{
216 			return null;
217 		}
218 
219 		return ObjectG.getDObject!(DOMNode)(cast(WebKitDOMNode*) __p);
220 	}
221 
222 	/**
223 	 *
224 	 *
225 	 * Deprecated: Use JavaScriptCore API instead
226 	 *
227 	 * Params:
228 	 *     index = A #gulong
229 	 *
230 	 * Returns: A #WebKitDOMNode
231 	 *
232 	 * Throws: GException on failure.
233 	 */
234 	public DOMNode snapshotItem(gulong index)
235 	{
236 		GError* err = null;
237 
238 		auto __p = webkit_dom_xpath_result_snapshot_item(webKitDOMXPathResult, index, &err);
239 
240 		if (err !is null)
241 		{
242 			throw new GException( new ErrorG(err) );
243 		}
244 
245 		if(__p is null)
246 		{
247 			return null;
248 		}
249 
250 		return ObjectG.getDObject!(DOMNode)(cast(WebKitDOMNode*) __p);
251 	}
252 }