Line data Source code
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 0 : txUnionNodeTest::matches(const txXPathNode& aNode, txIMatchContext* aContext,
15 : bool& aMatched)
16 : {
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 :
22 0 : if (aMatched) {
23 0 : return NS_OK;
24 : }
25 : }
26 :
27 0 : aMatched = false;
28 0 : return NS_OK;
29 : }
30 :
31 : double
32 0 : txUnionNodeTest::getDefaultPriority()
33 : {
34 0 : NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
35 0 : return mozilla::UnspecifiedNaN<double>();
36 : }
37 :
38 : bool
39 0 : txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext)
40 : {
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 : }
46 : }
47 :
48 0 : return false;
49 : }
50 :
51 : #ifdef TX_TO_STRING
52 : void
53 0 : txUnionNodeTest::toString(nsAString& aDest)
54 : {
55 0 : aDest.Append('(');
56 0 : for (uint32_t i = 0; i < mNodeTests.Length(); ++i) {
57 0 : if (i != 0) {
58 0 : aDest.AppendLiteral(" | ");
59 : }
60 0 : mNodeTests[i]->toString(aDest);
61 : }
62 0 : aDest.Append(')');
63 0 : }
64 : #endif
|