2006-11-10 23:44:08 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2006-11-10 23:44:08 +03:00
|
|
|
|
2012-01-23 15:43:16 +04:00
|
|
|
#include "mozilla/FloatingPoint.h"
|
|
|
|
|
2006-11-10 23:44:08 +03:00
|
|
|
#include "txExpr.h"
|
|
|
|
#include "txExprResult.h"
|
|
|
|
#include "txSingleNodeContext.h"
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2006-11-10 23:44:08 +03:00
|
|
|
txUnionNodeTest::matches(const txXPathNode& aNode,
|
|
|
|
txIMatchContext* aContext)
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i, len = mNodeTests.Length();
|
2006-11-10 23:44:08 +03:00
|
|
|
for (i = 0; i < len; ++i) {
|
|
|
|
if (mNodeTests[i]->matches(aNode, aContext)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2006-11-10 23:44:08 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2006-11-10 23:44:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
double
|
|
|
|
txUnionNodeTest::getDefaultPriority()
|
|
|
|
{
|
|
|
|
NS_ERROR("Don't call getDefaultPriority on txUnionPattern");
|
2014-02-27 19:23:16 +04:00
|
|
|
return mozilla::UnspecifiedNaN<double>();
|
2006-11-10 23:44:08 +03:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool
|
2006-11-10 23:44:08 +03:00
|
|
|
txUnionNodeTest::isSensitiveTo(Expr::ContextSensitivity aContext)
|
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t i, len = mNodeTests.Length();
|
2006-11-10 23:44:08 +03:00
|
|
|
for (i = 0; i < len; ++i) {
|
|
|
|
if (mNodeTests[i]->isSensitiveTo(aContext)) {
|
2011-10-17 18:59:28 +04:00
|
|
|
return true;
|
2006-11-10 23:44:08 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-17 18:59:28 +04:00
|
|
|
return false;
|
2006-11-10 23:44:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef TX_TO_STRING
|
|
|
|
void
|
|
|
|
txUnionNodeTest::toString(nsAString& aDest)
|
|
|
|
{
|
2014-05-22 07:48:51 +04:00
|
|
|
aDest.Append('(');
|
2012-08-22 19:56:38 +04:00
|
|
|
for (uint32_t i = 0; i < mNodeTests.Length(); ++i) {
|
2006-11-10 23:44:08 +03:00
|
|
|
if (i != 0) {
|
|
|
|
aDest.AppendLiteral(" | ");
|
|
|
|
}
|
|
|
|
mNodeTests[i]->toString(aDest);
|
|
|
|
}
|
2014-05-22 07:48:51 +04:00
|
|
|
aDest.Append(')');
|
2006-11-10 23:44:08 +03:00
|
|
|
}
|
|
|
|
#endif
|