2005-08-04 20:42:30 +00:00
|
|
|
#ifndef ARABICA_XPATHIC_XPATH_RELATIONAL_HPP
|
|
|
|
#define ARABICA_XPATHIC_XPATH_RELATIONAL_HPP
|
|
|
|
|
|
|
|
#include "xpath_value.hpp"
|
|
|
|
|
|
|
|
namespace Arabica
|
|
|
|
{
|
|
|
|
namespace XPath
|
|
|
|
{
|
2005-08-22 15:04:27 +00:00
|
|
|
namespace impl
|
|
|
|
{
|
2005-08-04 20:42:30 +00:00
|
|
|
|
2005-08-17 12:24:25 +00:00
|
|
|
template<class string_type, class string_adaptor>
|
2007-12-21 15:56:04 +00:00
|
|
|
class EqualsOperator : public BinaryExpression<string_type, string_adaptor>
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-17 12:24:25 +00:00
|
|
|
typedef BinaryExpression<string_type, string_adaptor> baseT;
|
2005-08-04 20:42:30 +00:00
|
|
|
public:
|
2007-10-23 21:37:24 +00:00
|
|
|
EqualsOperator(XPathExpression_impl<string_type, string_adaptor>* lhs,
|
|
|
|
XPathExpression_impl<string_type, string_adaptor>* rhs) :
|
2005-08-17 12:24:25 +00:00
|
|
|
BinaryExpression<string_type, string_adaptor>(lhs, rhs) { }
|
2005-08-04 20:42:30 +00:00
|
|
|
|
2007-12-18 23:03:16 +00:00
|
|
|
virtual ValueType type() const { return BOOL; }
|
|
|
|
|
2007-10-22 17:42:50 +00:00
|
|
|
virtual XPathValue<string_type, string_adaptor> evaluate(const DOM::Node<string_type, string_adaptor>& context,
|
2005-08-17 12:24:25 +00:00
|
|
|
const ExecutionContext<string_type, string_adaptor>& executionContext) const
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-23 19:19:17 +00:00
|
|
|
return BoolValue<string_type, string_adaptor>::createValue(areEqual<string_type, string_adaptor>(baseT::lhs()->evaluate(context, executionContext),
|
2005-08-17 12:24:25 +00:00
|
|
|
baseT::rhs()->evaluate(context, executionContext)));
|
2005-08-04 20:42:30 +00:00
|
|
|
} // evaluate
|
|
|
|
}; // class EqualsOperator
|
|
|
|
|
2005-08-17 12:24:25 +00:00
|
|
|
template<class string_type, class string_adaptor>
|
2007-12-21 15:56:04 +00:00
|
|
|
class NotEqualsOperator : public BinaryExpression<string_type, string_adaptor>
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-17 12:24:25 +00:00
|
|
|
typedef BinaryExpression<string_type, string_adaptor> baseT;
|
2005-08-04 20:42:30 +00:00
|
|
|
public:
|
2007-10-23 21:37:24 +00:00
|
|
|
NotEqualsOperator(XPathExpression_impl<string_type, string_adaptor>* lhs,
|
|
|
|
XPathExpression_impl<string_type, string_adaptor>* rhs) :
|
2005-08-17 12:24:25 +00:00
|
|
|
BinaryExpression<string_type, string_adaptor>(lhs, rhs) { }
|
2005-08-04 20:42:30 +00:00
|
|
|
|
2007-12-18 23:03:16 +00:00
|
|
|
virtual ValueType type() const { return BOOL; }
|
|
|
|
|
2007-10-22 17:42:50 +00:00
|
|
|
virtual XPathValue<string_type, string_adaptor> evaluate(const DOM::Node<string_type, string_adaptor>& context,
|
2005-08-17 12:24:25 +00:00
|
|
|
const ExecutionContext<string_type, string_adaptor>& executionContext) const
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2007-07-19 17:01:31 +00:00
|
|
|
return BoolValue<string_type, string_adaptor>::createValue(areNotEqual<string_type, string_adaptor>(baseT::lhs()->evaluate(context, executionContext),
|
2005-08-17 12:24:25 +00:00
|
|
|
baseT::rhs()->evaluate(context, executionContext)));
|
2005-08-04 20:42:30 +00:00
|
|
|
} // evaluate
|
|
|
|
}; // class NotEqualsOperator
|
|
|
|
|
2005-08-17 12:24:25 +00:00
|
|
|
template<class string_type, class string_adaptor>
|
2007-12-21 15:56:04 +00:00
|
|
|
class LessThanOperator : public BinaryExpression<string_type, string_adaptor>
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-17 12:24:25 +00:00
|
|
|
typedef BinaryExpression<string_type, string_adaptor> baseT;
|
2005-08-04 20:42:30 +00:00
|
|
|
public:
|
2007-10-23 21:37:24 +00:00
|
|
|
LessThanOperator(XPathExpression_impl<string_type, string_adaptor>* lhs,
|
|
|
|
XPathExpression_impl<string_type, string_adaptor>* rhs) :
|
2005-08-17 12:24:25 +00:00
|
|
|
BinaryExpression<string_type, string_adaptor>(lhs, rhs) { }
|
2005-08-04 20:42:30 +00:00
|
|
|
|
2007-12-18 23:03:16 +00:00
|
|
|
virtual ValueType type() const { return BOOL; }
|
|
|
|
|
2007-10-22 17:42:50 +00:00
|
|
|
virtual XPathValue<string_type, string_adaptor> evaluate(const DOM::Node<string_type, string_adaptor>& context,
|
2005-08-17 12:24:25 +00:00
|
|
|
const ExecutionContext<string_type, string_adaptor>& executionContext) const
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-23 19:19:17 +00:00
|
|
|
return BoolValue<string_type, string_adaptor>::createValue(isLessThan<string_type, string_adaptor>(baseT::lhs()->evaluate(context, executionContext),
|
2005-08-17 12:24:25 +00:00
|
|
|
baseT::rhs()->evaluate(context, executionContext)));
|
2005-08-04 20:42:30 +00:00
|
|
|
} // evaluate
|
|
|
|
}; // class LessThanOperator
|
|
|
|
|
2005-08-17 12:24:25 +00:00
|
|
|
template<class string_type, class string_adaptor>
|
2007-12-21 15:56:04 +00:00
|
|
|
class LessThanEqualsOperator : public BinaryExpression<string_type, string_adaptor>
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-17 12:24:25 +00:00
|
|
|
typedef BinaryExpression<string_type, string_adaptor> baseT;
|
2005-08-04 20:42:30 +00:00
|
|
|
public:
|
2007-10-23 21:37:24 +00:00
|
|
|
LessThanEqualsOperator(XPathExpression_impl<string_type, string_adaptor>* lhs,
|
|
|
|
XPathExpression_impl<string_type, string_adaptor>* rhs) :
|
2005-08-17 12:24:25 +00:00
|
|
|
BinaryExpression<string_type, string_adaptor>(lhs, rhs) { }
|
2005-08-04 20:42:30 +00:00
|
|
|
|
2007-12-18 23:03:16 +00:00
|
|
|
virtual ValueType type() const { return BOOL; }
|
|
|
|
|
2007-10-22 17:42:50 +00:00
|
|
|
virtual XPathValue<string_type, string_adaptor> evaluate(const DOM::Node<string_type, string_adaptor>& context,
|
2005-08-17 12:24:25 +00:00
|
|
|
const ExecutionContext<string_type, string_adaptor>& executionContext) const
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-23 19:19:17 +00:00
|
|
|
return BoolValue<string_type, string_adaptor>::createValue(isLessThanEquals<string_type, string_adaptor>(baseT::lhs()->evaluate(context, executionContext),
|
2005-08-17 12:24:25 +00:00
|
|
|
baseT::rhs()->evaluate(context, executionContext)));
|
2005-08-04 20:42:30 +00:00
|
|
|
} // evaluate
|
|
|
|
}; // class LessThanEqualsOperator
|
|
|
|
|
2005-08-17 12:24:25 +00:00
|
|
|
template<class string_type, class string_adaptor>
|
2007-12-21 15:56:04 +00:00
|
|
|
class GreaterThanOperator : public BinaryExpression<string_type, string_adaptor>
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-17 12:24:25 +00:00
|
|
|
typedef BinaryExpression<string_type, string_adaptor> baseT;
|
2005-08-04 20:42:30 +00:00
|
|
|
public:
|
2007-10-23 21:37:24 +00:00
|
|
|
GreaterThanOperator(XPathExpression_impl<string_type, string_adaptor>* lhs,
|
|
|
|
XPathExpression_impl<string_type, string_adaptor>* rhs) :
|
2005-08-17 12:24:25 +00:00
|
|
|
BinaryExpression<string_type, string_adaptor>(lhs, rhs) { }
|
2005-08-04 20:42:30 +00:00
|
|
|
|
2007-12-18 23:03:16 +00:00
|
|
|
virtual ValueType type() const { return BOOL; }
|
|
|
|
|
2007-10-22 17:42:50 +00:00
|
|
|
virtual XPathValue<string_type, string_adaptor> evaluate(const DOM::Node<string_type, string_adaptor>& context,
|
2005-08-17 12:24:25 +00:00
|
|
|
const ExecutionContext<string_type, string_adaptor>& executionContext) const
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-23 19:19:17 +00:00
|
|
|
return BoolValue<string_type, string_adaptor>::createValue(isGreaterThan<string_type, string_adaptor>(baseT::lhs()->evaluate(context, executionContext),
|
2005-08-17 12:24:25 +00:00
|
|
|
baseT::rhs()->evaluate(context, executionContext)));
|
2005-08-04 20:42:30 +00:00
|
|
|
} // evaluate
|
|
|
|
}; // class GreaterThanOperator
|
|
|
|
|
2005-08-17 12:24:25 +00:00
|
|
|
template<class string_type, class string_adaptor>
|
2007-12-21 15:56:04 +00:00
|
|
|
class GreaterThanEqualsOperator : public BinaryExpression<string_type, string_adaptor>
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-17 12:24:25 +00:00
|
|
|
typedef BinaryExpression<string_type, string_adaptor> baseT;
|
2005-08-04 20:42:30 +00:00
|
|
|
public:
|
2007-10-23 21:37:24 +00:00
|
|
|
GreaterThanEqualsOperator(XPathExpression_impl<string_type, string_adaptor>* lhs,
|
|
|
|
XPathExpression_impl<string_type, string_adaptor>* rhs) :
|
2005-08-17 12:24:25 +00:00
|
|
|
BinaryExpression<string_type, string_adaptor>(lhs, rhs) { }
|
2005-08-04 20:42:30 +00:00
|
|
|
|
2007-12-18 23:03:16 +00:00
|
|
|
virtual ValueType type() const { return BOOL; }
|
|
|
|
|
2007-10-22 17:42:50 +00:00
|
|
|
virtual XPathValue<string_type, string_adaptor> evaluate(const DOM::Node<string_type, string_adaptor>& context,
|
2005-08-17 12:24:25 +00:00
|
|
|
const ExecutionContext<string_type, string_adaptor>& executionContext) const
|
2005-08-04 20:42:30 +00:00
|
|
|
{
|
2005-08-23 19:19:17 +00:00
|
|
|
return BoolValue<string_type, string_adaptor>::createValue(isGreaterThanEquals<string_type, string_adaptor>(baseT::lhs()->evaluate(context, executionContext),
|
2005-08-17 12:24:25 +00:00
|
|
|
baseT::rhs()->evaluate(context, executionContext)));
|
2005-08-04 20:42:30 +00:00
|
|
|
} // evaluate
|
|
|
|
}; // class GreaterThanEqualsOperator
|
|
|
|
|
2005-08-22 15:04:27 +00:00
|
|
|
} // namespace impl
|
2005-08-04 20:42:30 +00:00
|
|
|
} // namespace XPath
|
|
|
|
} // namespace Arabica
|
|
|
|
#endif
|