#ifndef ARABICA_XPATHIC_XPATH_RELATIONAL_HPP #define ARABICA_XPATHIC_XPATH_RELATIONAL_HPP #include "xpath_value.hpp" namespace Arabica { namespace XPath { namespace impl { template class EqualsOperator : public BinaryExpression { typedef BinaryExpression baseT; public: EqualsOperator(XPathExpression_impl* lhs, XPathExpression_impl* rhs) : BinaryExpression(lhs, rhs) { } virtual ValueType type() const { return BOOL; } virtual XPathValue evaluate(const DOM::Node& context, const ExecutionContext& executionContext) const { return BoolValue::createValue(areEqual(baseT::lhs()->evaluate(context, executionContext), baseT::rhs()->evaluate(context, executionContext))); } // evaluate }; // class EqualsOperator template class NotEqualsOperator : public BinaryExpression { typedef BinaryExpression baseT; public: NotEqualsOperator(XPathExpression_impl* lhs, XPathExpression_impl* rhs) : BinaryExpression(lhs, rhs) { } virtual ValueType type() const { return BOOL; } virtual XPathValue evaluate(const DOM::Node& context, const ExecutionContext& executionContext) const { return BoolValue::createValue(areNotEqual(baseT::lhs()->evaluate(context, executionContext), baseT::rhs()->evaluate(context, executionContext))); } // evaluate }; // class NotEqualsOperator template class LessThanOperator : public BinaryExpression { typedef BinaryExpression baseT; public: LessThanOperator(XPathExpression_impl* lhs, XPathExpression_impl* rhs) : BinaryExpression(lhs, rhs) { } virtual ValueType type() const { return BOOL; } virtual XPathValue evaluate(const DOM::Node& context, const ExecutionContext& executionContext) const { return BoolValue::createValue(isLessThan(baseT::lhs()->evaluate(context, executionContext), baseT::rhs()->evaluate(context, executionContext))); } // evaluate }; // class LessThanOperator template class LessThanEqualsOperator : public BinaryExpression { typedef BinaryExpression baseT; public: LessThanEqualsOperator(XPathExpression_impl* lhs, XPathExpression_impl* rhs) : BinaryExpression(lhs, rhs) { } virtual ValueType type() const { return BOOL; } virtual XPathValue evaluate(const DOM::Node& context, const ExecutionContext& executionContext) const { return BoolValue::createValue(isLessThanEquals(baseT::lhs()->evaluate(context, executionContext), baseT::rhs()->evaluate(context, executionContext))); } // evaluate }; // class LessThanEqualsOperator template class GreaterThanOperator : public BinaryExpression { typedef BinaryExpression baseT; public: GreaterThanOperator(XPathExpression_impl* lhs, XPathExpression_impl* rhs) : BinaryExpression(lhs, rhs) { } virtual ValueType type() const { return BOOL; } virtual XPathValue evaluate(const DOM::Node& context, const ExecutionContext& executionContext) const { return BoolValue::createValue(isGreaterThan(baseT::lhs()->evaluate(context, executionContext), baseT::rhs()->evaluate(context, executionContext))); } // evaluate }; // class GreaterThanOperator template class GreaterThanEqualsOperator : public BinaryExpression { typedef BinaryExpression baseT; public: GreaterThanEqualsOperator(XPathExpression_impl* lhs, XPathExpression_impl* rhs) : BinaryExpression(lhs, rhs) { } virtual ValueType type() const { return BOOL; } virtual XPathValue evaluate(const DOM::Node& context, const ExecutionContext& executionContext) const { return BoolValue::createValue(isGreaterThanEquals(baseT::lhs()->evaluate(context, executionContext), baseT::rhs()->evaluate(context, executionContext))); } // evaluate }; // class GreaterThanEqualsOperator } // namespace impl } // namespace XPath } // namespace Arabica #endif