not part of build, code by axel@pike.org, r=peterv; code by peterv@netscape.com, r=me. Fixing 59937, xpath function lib complete, 59649, 60059, 47720; building windows standalone, 46640; general code cleanup, fixing warnings; XPathProcessor and XSLTProcessor available to JS (work in progress)

git-svn-id: svn://10.0.0.236/trunk@84878 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
axel%pike.org
2001-01-12 20:06:48 +00:00
parent 96b31ddf6b
commit 8d208bdc0b
75 changed files with 2597 additions and 256 deletions

View File

@@ -25,7 +25,7 @@
* Nisheeth Ranjan, nisheeth@netscape.com
* -- implemented rint function, which was not available on Windows.
*
* $Id: NumberFunctionCall.cpp,v 1.9 2001-01-10 11:48:47 axel%pike.org Exp $
* $Id: NumberFunctionCall.cpp,v 1.10 2001-01-12 20:06:36 axel%pike.org Exp $
*/
/*
@@ -58,6 +58,9 @@ NumberFunctionCall::NumberFunctionCall(short type) : FunctionCall() {
case FLOOR :
FunctionCall::setName(XPathNames::FLOOR_FN);
break;
case SUM :
FunctionCall::setName(XPathNames::SUM_FN);
break;
case NUMBER :
default :
FunctionCall::setName(XPathNames::NUMBER_FN);
@@ -130,6 +133,26 @@ ExprResult* NumberFunctionCall::evaluate(Node* context, ContextState* cs) {
else result->setValue(0.0);
break;
case SUM :
double numResult;
numResult = 0 ;
if ( requireParams(1, 1, cs) ) {
param = (Expr*)iter->next();
ExprResult* exprResult = param->evaluate(context, cs);
if ( exprResult->getResultType() == ExprResult::NODESET ) {
NodeSet *lNList = (NodeSet *)exprResult;
NodeSet tmp;
for (int i=0; i<lNList->size(); i++){
tmp.add(0,lNList->get(i));
numResult += tmp.numberValue();
};
};
delete exprResult;
exprResult=0;
};
result = new NumberResult(numResult);
break;
case NUMBER :
default : //-- number( object? )
if ( requireParams(0, 1, cs) ) {