1 module libwasm.bindings.TreeWalker;
2 
3 import libwasm.types;
4 
5 import memutils.ct: tuple;
6 import libwasm.bindings.Node;
7 import libwasm.bindings.NodeFilter;
8 
9 @safe:
10 nothrow:
11 
12 struct TreeWalker {
13   nothrow:
14   JsHandle handle;
15   alias handle this;
16   this(Handle h) {
17     this.handle = JsHandle(h);
18   }
19   auto root()() {
20     return Node(Object_Getter__Handle(this.handle, "root"));
21   }
22   uint whatToShow()() {
23     return Object_Getter__uint(this.handle, "whatToShow");
24   }
25   auto filter()() {
26     return recastOpt!(NodeFilter)(Object_Getter__OptionalHandle(this.handle, "filter"));
27   }
28   void currentNode()(scope ref Node currentNode) {
29     Object_Call_Handle__void(this.handle, "currentNode", currentNode.handle);
30   }
31   auto currentNode()() {
32     return Node(Object_Getter__Handle(this.handle, "currentNode"));
33   }
34   auto parentNode()() {
35     return recastOpt!(Node)(Object_Getter__OptionalHandle(this.handle, "parentNode"));
36   }
37   auto firstChild()() {
38     return recastOpt!(Node)(Object_Getter__OptionalHandle(this.handle, "firstChild"));
39   }
40   auto lastChild()() {
41     return recastOpt!(Node)(Object_Getter__OptionalHandle(this.handle, "lastChild"));
42   }
43   auto previousSibling()() {
44     return recastOpt!(Node)(Object_Getter__OptionalHandle(this.handle, "previousSibling"));
45   }
46   auto nextSibling()() {
47     return recastOpt!(Node)(Object_Getter__OptionalHandle(this.handle, "nextSibling"));
48   }
49   auto previousNode()() {
50     return recastOpt!(Node)(Object_Getter__OptionalHandle(this.handle, "previousNode"));
51   }
52   auto nextNode()() {
53     return recastOpt!(Node)(Object_Getter__OptionalHandle(this.handle, "nextNode"));
54   }
55 }
56 
57