1 using System;
2 using System.Collections;
3
4
5
6
7
8 namespace System.XPath
9 {
10 public class XPathDebugInfo
11 {
12 static XPathDebugInfo() : instance(new XPathDebugInfo())
13 {
14 }
15 private XPathDebugInfo() :
16 debugParsing(false), debugQuery(false), queryDuration(0), executeDuration(0)
17 {
18 }
19 public bool DebugParsing() const
20 {
21 return debugParsing;
22 }
23 public void SetDebugParsing()
24 {
25 debugParsing = true;
26 }
27 public bool DebugQuery() const
28 {
29 return debugQuery;
30 }
31 public void SetDebugQuery()
32 {
33 debugQuery = true;
34 }
35 public void SetQueryDom(UniquePtr<System.Dom.Node>&& queryDom_)
36 {
37 queryDom = Rvalue(queryDom_);
38 }
39 public UniquePtr<System.Dom.Node> GetQueryDom()
40 {
41 return Rvalue(queryDom);
42 }
43 public void SetQueryDuration(Duration duration)
44 {
45 queryDuration = duration;
46 }
47 public Duration GetQueryDuration() const
48 {
49 return queryDuration;
50 }
51 public void SetExecuteDuration(Duration duration)
52 {
53 executeDuration = duration;
54 }
55 public Duration GetExecuteDuration() const
56 {
57 return executeDuration;
58 }
59 public static UniquePtr<XPathDebugInfo> instance;
60 public static XPathDebugInfo& Instance()
61 {
62 return *instance;
63 }
64 private bool debugParsing;
65 private bool debugQuery;
66 private UniquePtr<System.Dom.Node> queryDom;
67 private Duration queryDuration;
68 private Duration executeDuration;
69 }
70 public bool XPathDebugParsing()
71 {
72 return XPathDebugInfo.Instance().DebugParsing();
73 }
74 public void SetXPathDebugParsing()
75 {
76 XPathDebugInfo.Instance().SetDebugParsing();
77 }
78 public bool XPathDebugQuery()
79 {
80 return XPathDebugInfo.Instance().DebugQuery();
81 }
82 public void SetXPathDebugQuery()
83 {
84 XPathDebugInfo.Instance().SetDebugQuery();
85 }
86 public void SetXPathQueryDom(UniquePtr<System.Dom.Node>&& queryDom)
87 {
88 XPathDebugInfo.Instance().SetQueryDom(Rvalue(queryDom));
89 }
90 public UniquePtr<System.Dom.Node> GetXPathQueryDom()
91 {
92 return XPathDebugInfo.Instance().GetQueryDom();
93 }
94 public void SetXPathQueryDuration(Duration duration)
95 {
96 XPathDebugInfo.Instance().SetQueryDuration(duration);
97 }
98 public Duration XPathQueryDuration()
99 {
100 return XPathDebugInfo.Instance().GetQueryDuration();
101 }
102 public void SetXPathExecuteDuration(Duration duration)
103 {
104 XPathDebugInfo.Instance().SetExecuteDuration(duration);
105 }
106 public Duration XPathExecuteDuration()
107 {
108 return XPathDebugInfo.Instance().GetExecuteDuration();
109 }
110 }