dom/xslt/xpath/txUnionNodeTest.cpp

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:5bdd798d41f4
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7 #include "mozilla/FloatingPoint.h"
8
9 #include "txExpr.h"
10 #include "txExprResult.h"
11 #include "txSingleNodeContext.h"
12
13 bool
14 txUnionNodeTest::matches(const txXPathNode& aNode,
15 txIMatchContext* aContext)
16 {
17 uint32_t i, len = mNodeTests.Length();
18 for (i = 0; i < len; ++i) {
19 if (mNodeTests[i]->matches(aNode, aContext)) {
20 return true;
21 }
22 }
23
24 return false;
25 }
26
27 double
28 txUnionNodeTest::getDefaultPriority()
29 {
30 NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
31 return mozilla::UnspecifiedNaN<double>();
32 }
33
34 bool
35 txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext)
36 {
37 uint32_t i, len = mNodeTests.Length();
38 for (i = 0; i < len; ++i) {
39 if (mNodeTests[i]->isSensitiveTo(aContext)) {
40 return true;
41 }
42 }
43
44 return false;
45 }
46
47 #ifdef TX_TO_STRING
48 void
49 txUnionNodeTest::toString(nsAString& aDest)
50 {
51 aDest.AppendLiteral("(");
52 for (uint32_t i = 0; i < mNodeTests.Length(); ++i) {
53 if (i != 0) {
54 aDest.AppendLiteral(" | ");
55 }
56 mNodeTests[i]->toString(aDest);
57 }
58 aDest.AppendLiteral(")");
59 }
60 #endif

mercurial