1 module webkit2webextension.DOMXPathExpression; 2 3 private import glib.ErrorG; 4 private import glib.GException; 5 private import gobject.ObjectG; 6 private import webkit2webextension.DOMNode; 7 private import webkit2webextension.DOMObject; 8 private import webkit2webextension.DOMXPathResult; 9 private import webkit2webextension.c.functions; 10 public import webkit2webextension.c.types; 11 12 13 /** */ 14 public class DOMXPathExpression : DOMObject 15 { 16 /** the main Gtk struct */ 17 protected WebKitDOMXPathExpression* webKitDOMXPathExpression; 18 19 /** Get the main Gtk struct */ 20 public WebKitDOMXPathExpression* getDOMXPathExpressionStruct(bool transferOwnership = false) 21 { 22 if (transferOwnership) 23 ownedRef = false; 24 return webKitDOMXPathExpression; 25 } 26 27 /** the main Gtk struct as a void* */ 28 protected override void* getStruct() 29 { 30 return cast(void*)webKitDOMXPathExpression; 31 } 32 33 /** 34 * Sets our main struct and passes it to the parent class. 35 */ 36 public this (WebKitDOMXPathExpression* webKitDOMXPathExpression, bool ownedRef = false) 37 { 38 this.webKitDOMXPathExpression = webKitDOMXPathExpression; 39 super(cast(WebKitDOMObject*)webKitDOMXPathExpression, ownedRef); 40 } 41 42 43 /** */ 44 public static GType getType() 45 { 46 return webkit_dom_xpath_expression_get_type(); 47 } 48 49 /** 50 * 51 * 52 * Deprecated: Use JavaScriptCore API instead 53 * 54 * Params: 55 * contextNode = A #WebKitDOMNode 56 * type = A #gushort 57 * inResult = A #WebKitDOMXPathResult 58 * 59 * Returns: A #WebKitDOMXPathResult 60 * 61 * Throws: GException on failure. 62 */ 63 public DOMXPathResult evaluate(DOMNode contextNode, ushort type, DOMXPathResult inResult) 64 { 65 GError* err = null; 66 67 auto __p = webkit_dom_xpath_expression_evaluate(webKitDOMXPathExpression, (contextNode is null) ? null : contextNode.getDOMNodeStruct(), type, (inResult is null) ? null : inResult.getDOMXPathResultStruct(), &err); 68 69 if (err !is null) 70 { 71 throw new GException( new ErrorG(err) ); 72 } 73 74 if(__p is null) 75 { 76 return null; 77 } 78 79 return ObjectG.getDObject!(DOMXPathResult)(cast(WebKitDOMXPathResult*) __p, true); 80 } 81 }