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