michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "mozilla/FloatingPoint.h" michael@0: michael@0: #include "txExpr.h" michael@0: #include "txExprResult.h" michael@0: #include "txSingleNodeContext.h" michael@0: michael@0: bool michael@0: txUnionNodeTest::matches(const txXPathNode& aNode, michael@0: txIMatchContext* aContext) michael@0: { michael@0: uint32_t i, len = mNodeTests.Length(); michael@0: for (i = 0; i < len; ++i) { michael@0: if (mNodeTests[i]->matches(aNode, aContext)) { michael@0: return true; michael@0: } michael@0: } michael@0: michael@0: return false; michael@0: } michael@0: michael@0: double michael@0: txUnionNodeTest::getDefaultPriority() michael@0: { michael@0: NS_ERROR("Don't call getDefaultPriority on txUnionPattern"); michael@0: return mozilla::UnspecifiedNaN(); michael@0: } michael@0: michael@0: bool michael@0: txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext) michael@0: { michael@0: uint32_t i, len = mNodeTests.Length(); michael@0: for (i = 0; i < len; ++i) { michael@0: if (mNodeTests[i]->isSensitiveTo(aContext)) { michael@0: return true; michael@0: } michael@0: } michael@0: michael@0: return false; michael@0: } michael@0: michael@0: #ifdef TX_TO_STRING michael@0: void michael@0: txUnionNodeTest::toString(nsAString& aDest) michael@0: { michael@0: aDest.AppendLiteral("("); michael@0: for (uint32_t i = 0; i < mNodeTests.Length(); ++i) { michael@0: if (i != 0) { michael@0: aDest.AppendLiteral(" | "); michael@0: } michael@0: mNodeTests[i]->toString(aDest); michael@0: } michael@0: aDest.AppendLiteral(")"); michael@0: } michael@0: #endif