/src/mozilla-central/dom/xslt/xpath/txUnionNodeTest.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | nsresult |
14 | | txUnionNodeTest::matches(const txXPathNode& aNode, txIMatchContext* aContext, |
15 | | bool& aMatched) |
16 | 0 | { |
17 | 0 | uint32_t i, len = mNodeTests.Length(); |
18 | 0 | for (i = 0; i < len; ++i) { |
19 | 0 | nsresult rv = mNodeTests[i]->matches(aNode, aContext, aMatched); |
20 | 0 | NS_ENSURE_SUCCESS(rv, rv); |
21 | 0 |
|
22 | 0 | if (aMatched) { |
23 | 0 | return NS_OK; |
24 | 0 | } |
25 | 0 | } |
26 | 0 |
|
27 | 0 | aMatched = false; |
28 | 0 | return NS_OK; |
29 | 0 | } |
30 | | |
31 | | double |
32 | | txUnionNodeTest::getDefaultPriority() |
33 | 0 | { |
34 | 0 | NS_ERROR("Don't call getDefaultPriority on txUnionPattern"); |
35 | 0 | return mozilla::UnspecifiedNaN<double>(); |
36 | 0 | } |
37 | | |
38 | | bool |
39 | | txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext) |
40 | 0 | { |
41 | 0 | uint32_t i, len = mNodeTests.Length(); |
42 | 0 | for (i = 0; i < len; ++i) { |
43 | 0 | if (mNodeTests[i]->isSensitiveTo(aContext)) { |
44 | 0 | return true; |
45 | 0 | } |
46 | 0 | } |
47 | 0 |
|
48 | 0 | return false; |
49 | 0 | } |
50 | | |
51 | | #ifdef TX_TO_STRING |
52 | | void |
53 | | txUnionNodeTest::toString(nsAString& aDest) |
54 | | { |
55 | | aDest.Append('('); |
56 | | for (uint32_t i = 0; i < mNodeTests.Length(); ++i) { |
57 | | if (i != 0) { |
58 | | aDest.AppendLiteral(" | "); |
59 | | } |
60 | | mNodeTests[i]->toString(aDest); |
61 | | } |
62 | | aDest.Append(')'); |
63 | | } |
64 | | #endif |