#include "../config/pathan_config.h" /* * Copyright (c) 2001, DecisionSoft Limited All rights reserved. * Please see LICENSE.TXT for more information. */ #include #include #include #include #include #include /*static*/ const XMLCh LessThanEqual::name[]={ XERCES_CPP_NAMESPACE_QUALIFIER chLatin_l, XERCES_CPP_NAMESPACE_QUALIFIER chLatin_e, XERCES_CPP_NAMESPACE_QUALIFIER chNull }; LessThanEqual::LessThanEqual(const VectorOfDataItems &args, XPath2MemoryManager* memMgr) : DataItemOperator(name, args, memMgr) { } /*static*/ bool LessThanEqual::less_than_equal(const Item* arg1, const Item* arg2, DynamicContext* context) { // define "le" as "!gt" return !GreaterThan::greater_than(arg1,arg2,context); } Sequence LessThanEqual::collapseTreeInternal(DynamicContext* context, int flags) const { XPath2MemoryManager* memMgr = context->getMemoryManager(); Sequence newArgs = getComparisonOperatorArguments(context); if(newArgs.getLength() < 2) return Sequence(memMgr); const Item* arg1 = newArgs.first(); const Item* arg2 = newArgs.second(); assert(arg1->isAtomicValue() && arg2->isAtomicValue()); bool result=less_than_equal(arg1,arg2,context); return Sequence(DatatypeFactory::POD2AT::createBoolean(memMgr, result, context), memMgr); }