OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2005 Frerich Raabe <raabe@kde.org> | 2 * Copyright 2005 Frerich Raabe <raabe@kde.org> |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 19 matching lines...) Expand all Loading... |
30 #if ENABLE(XPATH) | 30 #if ENABLE(XPATH) |
31 | 31 |
32 #include <wtf/RefCounted.h> | 32 #include <wtf/RefCounted.h> |
33 #include "XPathValue.h" | 33 #include "XPathValue.h" |
34 | 34 |
35 namespace WebCore { | 35 namespace WebCore { |
36 | 36 |
37 typedef int ExceptionCode; | 37 typedef int ExceptionCode; |
38 | 38 |
39 class EventListener; | 39 class EventListener; |
40 class Node; | 40 class EventTargetNode; |
41 class Node; | 41 class Node; |
42 class String; | 42 class String; |
43 | 43 |
44 class XPathResult : public RefCounted<XPathResult> { | 44 class XPathResult : public RefCounted<XPathResult> { |
45 public: | 45 public: |
46 enum XPathResultType { | 46 enum XPathResultType { |
47 ANY_TYPE = 0, | 47 ANY_TYPE = 0, |
48 NUMBER_TYPE = 1, | 48 NUMBER_TYPE = 1, |
49 STRING_TYPE = 2, | 49 STRING_TYPE = 2, |
50 BOOLEAN_TYPE = 3, | 50 BOOLEAN_TYPE = 3, |
51 UNORDERED_NODE_ITERATOR_TYPE = 4, | 51 UNORDERED_NODE_ITERATOR_TYPE = 4, |
52 ORDERED_NODE_ITERATOR_TYPE = 5, | 52 ORDERED_NODE_ITERATOR_TYPE = 5, |
53 UNORDERED_NODE_SNAPSHOT_TYPE = 6, | 53 UNORDERED_NODE_SNAPSHOT_TYPE = 6, |
54 ORDERED_NODE_SNAPSHOT_TYPE = 7, | 54 ORDERED_NODE_SNAPSHOT_TYPE = 7, |
55 ANY_UNORDERED_NODE_TYPE = 8, | 55 ANY_UNORDERED_NODE_TYPE = 8, |
56 FIRST_ORDERED_NODE_TYPE = 9 | 56 FIRST_ORDERED_NODE_TYPE = 9 |
57 }; | 57 }; |
58 | 58 |
59 static PassRefPtr<XPathResult> create(Node* eventTarget, const XPath::Va
lue& value) { return adoptRef(new XPathResult(eventTarget, value)); } | 59 static PassRefPtr<XPathResult> create(EventTargetNode* eventTarget, cons
t XPath::Value& value) { return adoptRef(new XPathResult(eventTarget, value)); } |
60 ~XPathResult(); | 60 ~XPathResult(); |
61 | 61 |
62 void convertTo(unsigned short type, ExceptionCode&); | 62 void convertTo(unsigned short type, ExceptionCode&); |
63 | 63 |
64 unsigned short resultType() const; | 64 unsigned short resultType() const; |
65 | 65 |
66 double numberValue(ExceptionCode&) const; | 66 double numberValue(ExceptionCode&) const; |
67 String stringValue(ExceptionCode&) const; | 67 String stringValue(ExceptionCode&) const; |
68 bool booleanValue(ExceptionCode&) const; | 68 bool booleanValue(ExceptionCode&) const; |
69 Node* singleNodeValue(ExceptionCode&) const; | 69 Node* singleNodeValue(ExceptionCode&) const; |
70 | 70 |
71 bool invalidIteratorState() const; | 71 bool invalidIteratorState() const; |
72 unsigned long snapshotLength(ExceptionCode&) const; | 72 unsigned long snapshotLength(ExceptionCode&) const; |
73 Node* iterateNext(ExceptionCode&); | 73 Node* iterateNext(ExceptionCode&); |
74 Node* snapshotItem(unsigned long index, ExceptionCode&); | 74 Node* snapshotItem(unsigned long index, ExceptionCode&); |
75 | 75 |
76 void invalidateIteratorState(); | 76 void invalidateIteratorState(); |
77 | 77 |
78 private: | 78 private: |
79 XPathResult(Node*, const XPath::Value&); | 79 XPathResult(EventTargetNode*, const XPath::Value&); |
80 | 80 |
81 XPath::Value m_value; | 81 XPath::Value m_value; |
82 unsigned m_nodeSetPosition; | 82 unsigned m_nodeSetPosition; |
83 XPath::NodeSet m_nodeSet; // FIXME: why duplicate the node set stored in
m_value? | 83 XPath::NodeSet m_nodeSet; // FIXME: why duplicate the node set stored in
m_value? |
84 unsigned short m_resultType; | 84 unsigned short m_resultType; |
85 bool m_invalidIteratorState; | 85 bool m_invalidIteratorState; |
86 RefPtr<Node> m_eventTarget; | 86 RefPtr<EventTargetNode> m_eventTarget; |
87 RefPtr<EventListener> m_eventListener; | 87 RefPtr<EventListener> m_eventListener; |
88 }; | 88 }; |
89 | 89 |
90 } | 90 } |
91 | 91 |
92 #endif // ENABLE(XPATH) | 92 #endif // ENABLE(XPATH) |
93 | 93 |
94 #endif // XPathResult_h | 94 #endif // XPathResult_h |
OLD | NEW |