1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xslt/xpath/txUnionNodeTest.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#include "mozilla/FloatingPoint.h" 1.11 + 1.12 +#include "txExpr.h" 1.13 +#include "txExprResult.h" 1.14 +#include "txSingleNodeContext.h" 1.15 + 1.16 +bool 1.17 +txUnionNodeTest::matches(const txXPathNode& aNode, 1.18 + txIMatchContext* aContext) 1.19 +{ 1.20 + uint32_t i, len = mNodeTests.Length(); 1.21 + for (i = 0; i < len; ++i) { 1.22 + if (mNodeTests[i]->matches(aNode, aContext)) { 1.23 + return true; 1.24 + } 1.25 + } 1.26 + 1.27 + return false; 1.28 +} 1.29 + 1.30 +double 1.31 +txUnionNodeTest::getDefaultPriority() 1.32 +{ 1.33 + NS_ERROR("Don't call getDefaultPriority on txUnionPattern"); 1.34 + return mozilla::UnspecifiedNaN<double>(); 1.35 +} 1.36 + 1.37 +bool 1.38 +txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext) 1.39 +{ 1.40 + uint32_t i, len = mNodeTests.Length(); 1.41 + for (i = 0; i < len; ++i) { 1.42 + if (mNodeTests[i]->isSensitiveTo(aContext)) { 1.43 + return true; 1.44 + } 1.45 + } 1.46 + 1.47 + return false; 1.48 +} 1.49 + 1.50 +#ifdef TX_TO_STRING 1.51 +void 1.52 +txUnionNodeTest::toString(nsAString& aDest) 1.53 +{ 1.54 + aDest.AppendLiteral("("); 1.55 + for (uint32_t i = 0; i < mNodeTests.Length(); ++i) { 1.56 + if (i != 0) { 1.57 + aDest.AppendLiteral(" | "); 1.58 + } 1.59 + mNodeTests[i]->toString(aDest); 1.60 + } 1.61 + aDest.AppendLiteral(")"); 1.62 +} 1.63 +#endif