Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: Source/core/xml/XPathNodeSet.h

Issue 344553002: Fix style erros in XPath-related files. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/xml/XPathGrammar.y ('k') | Source/core/xml/XPathNodeSet.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 2 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution. 11 * documentation and/or other materials provided with the distribution.
12 * 12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #ifndef XPathNodeSet_h 26 #ifndef XPathNodeSet_h
27 #define XPathNodeSet_h 27 #define XPathNodeSet_h
28 28
29 #include "core/dom/Node.h"
29 #include "wtf/Forward.h" 30 #include "wtf/Forward.h"
30 #include "wtf/Vector.h" 31 #include "wtf/Vector.h"
31 32
32 #include "core/dom/Node.h"
33
34 namespace WebCore { 33 namespace WebCore {
35 34
36 namespace XPath { 35 namespace XPath {
37 36
38 class NodeSet : public NoBaseWillBeGarbageCollected<NodeSet> { 37 class NodeSet : public NoBaseWillBeGarbageCollected<NodeSet> {
39 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED; 38 WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED;
40 public: 39 public:
41 static PassOwnPtrWillBeRawPtr<NodeSet> create() { return adoptPtrWil lBeNoop(new NodeSet); } 40 static PassOwnPtrWillBeRawPtr<NodeSet> create() { return adoptPtrWillBeNoop( new NodeSet); }
42 static PassOwnPtrWillBeRawPtr<NodeSet> create(const NodeSet&); 41 static PassOwnPtrWillBeRawPtr<NodeSet> create(const NodeSet&);
43 void trace(Visitor* visitor) { visitor->trace(m_nodes); } 42 void trace(Visitor* visitor) { visitor->trace(m_nodes); }
44 43
45 size_t size() const { return m_nodes.size(); } 44 size_t size() const { return m_nodes.size(); }
46 bool isEmpty() const { return !m_nodes.size(); } 45 bool isEmpty() const { return !m_nodes.size(); }
47 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); } 46 Node* operator[](unsigned i) const { return m_nodes.at(i).get(); }
48 void reserveCapacity(size_t newCapacity) { m_nodes.reserveCapacity(n ewCapacity); } 47 void reserveCapacity(size_t newCapacity) { m_nodes.reserveCapacity(newCapaci ty); }
49 void clear() { m_nodes.clear(); } 48 void clear() { m_nodes.clear(); }
50 void swap(NodeSet& other) { std::swap(m_isSorted, other.m_isSorted); std::swap(m_subtreesAreDisjoint, other.m_subtreesAreDisjoint); m_nodes.swap(oth er.m_nodes); } 49 void swap(NodeSet& other) { std::swap(m_isSorted, other.m_isSorted); std::sw ap(m_subtreesAreDisjoint, other.m_subtreesAreDisjoint); m_nodes.swap(other.m_nod es); }
51 50
52 // NodeSet itself does not verify that nodes in it are unique. 51 // NodeSet itself does not verify that nodes in it are unique.
53 void append(PassRefPtrWillBeRawPtr<Node> node) { m_nodes.append(node ); } 52 void append(PassRefPtrWillBeRawPtr<Node> node) { m_nodes.append(node); }
54 void append(const NodeSet& nodeSet) { m_nodes.appendVector(nodeSet.m _nodes); } 53 void append(const NodeSet& nodeSet) { m_nodes.appendVector(nodeSet.m_nodes); }
55 54
56 // Returns the set's first node in document order, or 0 if the set i s empty. 55 // Returns the set's first node in document order, or 0 if the set is empty.
57 Node* firstNode() const; 56 Node* firstNode() const;
58 57
59 // Returns 0 if the set is empty. 58 // Returns 0 if the set is empty.
60 Node* anyNode() const; 59 Node* anyNode() const;
61 60
62 // NodeSet itself doesn't check if it contains nodes in document ord er - the caller should tell it if it does not. 61 // NodeSet itself doesn't check if it contains nodes in document order - the
63 void markSorted(bool isSorted) { m_isSorted = isSorted; } 62 // caller should tell it if it does not.
64 bool isSorted() const { return m_isSorted || m_nodes.size() < 2; } 63 void markSorted(bool isSorted) { m_isSorted = isSorted; }
64 bool isSorted() const { return m_isSorted || m_nodes.size() < 2; }
65 65
66 void sort() const; 66 void sort() const;
67 67
68 // No node in the set is ancestor of another. Unlike m_isSorted, thi s is assumed to be false, unless the caller sets it to true. 68 // No node in the set is ancestor of another. Unlike m_isSorted, this is
69 void markSubtreesDisjoint(bool disjoint) { m_subtreesAreDisjoint = d isjoint; } 69 // assumed to be false, unless the caller sets it to true.
70 bool subtreesAreDisjoint() const { return m_subtreesAreDisjoint || m _nodes.size() < 2; } 70 void markSubtreesDisjoint(bool disjoint) { m_subtreesAreDisjoint = disjoint; }
71 bool subtreesAreDisjoint() const { return m_subtreesAreDisjoint || m_nodes.s ize() < 2; }
71 72
72 void reverse(); 73 void reverse();
73 74
74 private: 75 private:
75 NodeSet() : m_isSorted(true), m_subtreesAreDisjoint(false) { } 76 NodeSet() : m_isSorted(true), m_subtreesAreDisjoint(false) { }
76 void traversalSort() const; 77 void traversalSort() const;
77 78
78 bool m_isSorted; 79 bool m_isSorted;
79 bool m_subtreesAreDisjoint; 80 bool m_subtreesAreDisjoint;
80 WillBeHeapVector<RefPtrWillBeMember<Node> > m_nodes; 81 WillBeHeapVector<RefPtrWillBeMember<Node> > m_nodes;
81 }; 82 };
82 83
83 }
84 } 84 }
85 85
86 }
86 #endif // XPathNodeSet_h 87 #endif // XPathNodeSet_h
OLDNEW
« no previous file with comments | « Source/core/xml/XPathGrammar.y ('k') | Source/core/xml/XPathNodeSet.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698