You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2002/04/26 08:51:13 UTC
cvs commit: xml-xalan/c/src/XalanEXSLT XalanEXSLTCommon.cpp XalanEXSLTCommon.hpp XalanEXSLTCommonImpl.hpp XalanEXSLTDefinitions.hpp XalanEXSLTMath.cpp XalanEXSLTMath.hpp XalanEXSLTMathImpl.hpp XalanEXSLTSet.cpp XalanEXSLTSet.hpp XalanEXSLTSetImpl.hpp XalanEXSLTString.cpp XalanEXSLTString.hpp XalanEXSLTStringImpl.hpp
dbertoni 02/04/25 23:51:13
Added: c/src/XalanEXSLT XalanEXSLTCommon.cpp XalanEXSLTCommon.hpp
XalanEXSLTCommonImpl.hpp XalanEXSLTDefinitions.hpp
XalanEXSLTMath.cpp XalanEXSLTMath.hpp
XalanEXSLTMathImpl.hpp XalanEXSLTSet.cpp
XalanEXSLTSet.hpp XalanEXSLTSetImpl.hpp
XalanEXSLTString.cpp XalanEXSLTString.hpp
XalanEXSLTStringImpl.hpp
Log:
Initial revision.
Revision Changes Path
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTCommon.cpp
Index: XalanEXSLTCommon.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanEXSLTCommon.hpp"
#include "XalanEXSLTCommonImpl.hpp"
#include <PlatformSupport/XalanUnicode.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathEnvSupportDefault.hpp>
const XalanDOMChar XalanEXSLTFunctionObjectType::s_booleanString[] =
{
XalanUnicode::charLetter_b,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_n,
0
};
const XalanDOMChar XalanEXSLTFunctionObjectType::s_externalString[] =
{
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_x,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_l,
0
};
const XalanDOMChar XalanEXSLTFunctionObjectType::s_nodeSetString[] =
{
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_e,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_t,
0
};
const XalanDOMChar XalanEXSLTFunctionObjectType::s_numberString[] =
{
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_u,
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_b,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_r,
0
};
const XalanDOMChar XalanEXSLTFunctionObjectType::s_rtfString[] =
{
XalanUnicode::charLetter_R,
XalanUnicode::charLetter_T,
XalanUnicode::charLetter_F,
0
};
const XalanDOMChar XalanEXSLTFunctionObjectType::s_stringString[] =
{
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_g,
0
};
XObjectPtr
XalanEXSLTFunctionObjectType::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
const XalanDOMString* theResult = &m_external;
switch(args[0]->getType())
{
case XObject::eTypeBoolean:
theResult = &m_boolean;
break;
case XObject::eTypeNodeSet:
theResult = &m_nodeSet;
break;
case XObject::eTypeNumber:
theResult = &m_number;
break;
case XObject::eTypeResultTreeFrag:
theResult = &m_rtf;
break;
case XObject::eTypeString:
theResult = &m_string;
break;
}
assert(theResult != 0);
return executionContext.getXObjectFactory().createStringReference(*theResult);
}
const XalanDOMString
XalanEXSLTFunctionObjectType::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT object-type() function accepts one argument"));
}
static const XalanDOMChar s_commonNamespace[] =
{
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_p,
XalanUnicode::charColon,
XalanUnicode::charSolidus,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_x,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_t,
XalanUnicode::charFullStop,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_g,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_n,
0
};
static const XalanDOMChar s_nodeSetFunctionName[] =
{
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_e,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_objectTypeFunctionName[] =
{
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_b,
XalanUnicode::charLetter_j,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_t,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_y,
XalanUnicode::charLetter_p,
XalanUnicode::charLetter_e,
0
};
static const XalanEXSLTFunctionNodeSet s_nodesetFunction;
static const XalanEXSLTFunctionObjectType s_objectTypeFunction;
static const XalanEXSLTCommonFunctionsInstaller::FunctionTableEntry theFunctionTable[] =
{
{ s_nodeSetFunctionName, &s_nodesetFunction },
{ s_objectTypeFunctionName, &s_objectTypeFunction },
{ 0, 0 }
};
void
XalanEXSLTCommonFunctionsInstaller::installLocal(XPathEnvSupportDefault& theSupport)
{
doInstallLocal(s_commonNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTCommonFunctionsInstaller::installGlobal()
{
doInstallGlobal(s_commonNamespace, theFunctionTable);
}
void
XalanEXSLTCommonFunctionsInstaller::uninstallLocal(XPathEnvSupportDefault& theSupport)
{
doUninstallLocal(s_commonNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTCommonFunctionsInstaller::uninstallGlobal()
{
doUninstallGlobal(s_commonNamespace, theFunctionTable);
}
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTCommon.hpp
Index: XalanEXSLTCommon.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_COMMON_HEADER_GUARD_1357924680)
#define EXSLT_COMMON_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XalanExtensions/XalanExtensions.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTCommonFunctionsInstaller : public XalanExtensionsInstaller
{
public:
static void
installLocal(XPathEnvSupportDefault& theSupport);
static void
installGlobal();
static void
uninstallLocal(XPathEnvSupportDefault& theSupport);
static void
uninstallGlobal();
};
#endif // EXSLT_COMMON_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTCommonImpl.hpp
Index: XalanEXSLTCommonImpl.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_COMMONIMPL_HEADER_GUARD_1357924680)
#define EXSLT_COMMONIMPL_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XPath/Function.hpp>
#include <XalanExtensions/FunctionNodeSet.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionNodeSet : public FunctionNodeSet
{
public:
XalanEXSLTFunctionNodeSet() :
FunctionNodeSet(true)
{
}
virtual
~XalanEXSLTFunctionNodeSet()
{
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionNodeSet*
#endif
clone() const
{
return new XalanEXSLTFunctionNodeSet(*this);
}
protected:
virtual const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function node-set() accepts one argument"));
}
virtual const XalanDOMString
getInvalidArgumentTypeError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("Invalid argument type in EXSLT function node-set()!"));
}
private:
// Not implemented...
XalanEXSLTFunctionNodeSet&
operator=(const XalanEXSLTFunctionNodeSet&);
bool
operator==(const XalanEXSLTFunctionNodeSet&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionObjectType : public Function
{
public:
XalanEXSLTFunctionObjectType() :
Function(),
m_boolean(s_booleanString),
m_external(s_externalString),
m_nodeSet(s_nodeSetString),
m_number(s_numberString),
m_rtf(s_stringString),
m_string(s_stringString)
{
}
virtual
~XalanEXSLTFunctionObjectType()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionObjectType*
#endif
clone() const
{
return new XalanEXSLTFunctionObjectType(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionObjectType&
operator=(const XalanEXSLTFunctionObjectType&);
bool
operator==(const XalanEXSLTFunctionObjectType&) const;
// Data members...
const XalanDOMString m_boolean;
const XalanDOMString m_external;
const XalanDOMString m_nodeSet;
const XalanDOMString m_number;
const XalanDOMString m_rtf;
const XalanDOMString m_string;
static const XalanDOMChar s_booleanString[];
static const XalanDOMChar s_externalString[];
static const XalanDOMChar s_nodeSetString[];
static const XalanDOMChar s_numberString[];
static const XalanDOMChar s_rtfString[];
static const XalanDOMChar s_stringString[];
};
#endif // EXSLT_COMMONIMPL_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTDefinitions.hpp
Index: XalanEXSLTDefinitions.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_DEFINITIONS_HEADER_GUARD_1357924680)
#define EXSLT_DEFINITIONS_HEADER_GUARD_1357924680
#include <Include/PlatformDefinitions.hpp>
#if defined(XALAN_EXSLT_BUILD_DLL)
#define XALAN_EXSLT_EXPORT XALAN_PLATFORM_EXPORT
#define XALAN_EXSLT_EXPORT_FUNCTION(T) XALAN_PLATFORM_EXPORT_FUNCTION(T)
#else
#define XALAN_EXSLT_EXPORT XALAN_PLATFORM_IMPORT
#define XALAN_EXSLT_EXPORT_FUNCTION(T) XALAN_PLATFORM_IMPORT_FUNCTION(T)
#endif
#endif // EXSLT_DEFINITIONS_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTMath.cpp
Index: XalanEXSLTMath.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanEXSLTMath.hpp"
#include "XalanEXSLTMathImpl.hpp"
#include <cmath>
#include <PlatformSupport/DoubleSupport.hpp>
#include <PlatformSupport/XalanUnicode.hpp>
#include <DOMSupport/DOMServices.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathEnvSupportDefault.hpp>
template<class FunctionType>
XObjectPtr
findNodes(
XPathExecutionContext& executionContext,
const NodeRefListBase& theNodeSet,
FunctionType theCompareFunction)
{
const NodeRefListBase::size_type theLength = theNodeSet.getLength();
XPathExecutionContext::BorrowReturnMutableNodeRefList theNodes(executionContext);
theNodes->setDocumentOrder();
if (theLength != 0)
{
const XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theStringValue = theGuard.get();
XalanNode* theCurrentNode = theNodeSet.item(0);
assert(theCurrentNode != 0);
theNodes->addNode(theCurrentNode);
DOMServices::getNodeData(*theCurrentNode, theStringValue);
double theNumericValue = DOMStringToDouble(theStringValue);
for (NodeRefListBase::size_type i = 1; i < theLength; ++i)
{
theCurrentNode = theNodeSet.item(i);
assert(theCurrentNode != 0);
DOMServices::getNodeData(*theCurrentNode, theStringValue);
const double theCurrent = DOMStringToDouble(theStringValue);
if (DoubleSupport::isNaN(theCurrent) == true)
{
theNodes->clear();
break;
}
else if (DoubleSupport::equal(theCurrent, theNumericValue) == true)
{
theNodes->addNodeInDocOrder(theCurrentNode, executionContext);
}
else if (theCompareFunction(theCurrent, theNumericValue) == true)
{
theNodes->clear();
theNodes->addNode(theCurrentNode);
theNumericValue = theCurrent;
}
theStringValue.clear();
}
}
return executionContext.getXObjectFactory().createNodeSet(theNodes);
}
XObjectPtr
XalanEXSLTFunctionHighest::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
return findNodes(executionContext, args[0]->nodeset(), DoubleSupport::greaterThan);
}
const XalanDOMString
XalanEXSLTFunctionHighest::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT highest() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionLowest::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
return findNodes(executionContext, args[0]->nodeset(), DoubleSupport::lessThan);
}
const XalanDOMString
XalanEXSLTFunctionLowest::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT lowest() function accepts one argument"));
}
template<class FunctionType>
XObjectPtr
findValue(
XPathExecutionContext& executionContext,
const NodeRefListBase& theNodeSet,
FunctionType theCompareFunction)
{
const NodeRefListBase::size_type theLength = theNodeSet.getLength();
if (theLength == 0)
{
return executionContext.getXObjectFactory().createNumber(DoubleSupport::getNaN());
}
else
{
const XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theStringValue = theGuard.get();
assert(theNodeSet.item(0) != 0);
DOMServices::getNodeData(*theNodeSet.item(0), theStringValue);
double theResult = DOMStringToDouble(theStringValue);
for (NodeRefListBase::size_type i = 1; i < theLength; ++i)
{
assert(theNodeSet.item(i) != 0);
DOMServices::getNodeData(*theNodeSet.item(i), theStringValue);
const double theCurrent = DOMStringToDouble(theStringValue);
if (DoubleSupport::isNaN(theCurrent) == true)
{
theResult = theCurrent;
break;
}
else if (theCompareFunction(theCurrent, theResult) == true)
{
theResult = theCurrent;
}
theStringValue.clear();
}
return executionContext.getXObjectFactory().createNumber(theResult);
}
}
XObjectPtr
XalanEXSLTFunctionMin::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
return findValue(executionContext, args[0]->nodeset(), DoubleSupport::lessThan);
}
const XalanDOMString
XalanEXSLTFunctionMin::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT min() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionMax::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
return findValue(executionContext, args[0]->nodeset(), DoubleSupport::greaterThan);
}
const XalanDOMString
XalanEXSLTFunctionMax::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT max() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAbs::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::fabs;
#endif
return executionContext.getXObjectFactory().createNumber(fabs(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAbs::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT abs() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAcos::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::acos;
#endif
return executionContext.getXObjectFactory().createNumber(acos(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAcos::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT acos() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAsin::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::asin;
#endif
return executionContext.getXObjectFactory().createNumber(asin(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAsin::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT asin() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAtan::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::atan;
#endif
return executionContext.getXObjectFactory().createNumber(atan(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAtan::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT atan() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAtan2::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::atan2;
#endif
return executionContext.getXObjectFactory().createNumber(atan2(args[0]->num(), args[1]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAtan2::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT atan2() function accepts two arguments"));
}
const XalanDOMChar XalanEXSLTFunctionConstant::s_eString[] =
{
XalanUnicode::charLetter_E,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_ln10String[] =
{
XalanUnicode::charLetter_L,
XalanUnicode::charLetter_N,
XalanUnicode::charDigit_1,
XalanUnicode::charDigit_0,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_ln2String[] =
{
XalanUnicode::charLetter_L,
XalanUnicode::charLetter_N,
XalanUnicode::charDigit_2,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_log2EString[] =
{
XalanUnicode::charLetter_L,
XalanUnicode::charLetter_O,
XalanUnicode::charLetter_G,
XalanUnicode::charDigit_2,
XalanUnicode::charLetter_E,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_piString[] =
{
XalanUnicode::charLetter_P,
XalanUnicode::charLetter_I,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_sqrt1_2String[] =
{
XalanUnicode::charLetter_S,
XalanUnicode::charLetter_Q,
XalanUnicode::charLetter_R,
XalanUnicode::charLetter_T,
XalanUnicode::charDigit_1,
XalanUnicode::charLowLine,
XalanUnicode::charDigit_2,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_sqrt2String[] =
{
XalanUnicode::charLetter_S,
XalanUnicode::charLetter_Q,
XalanUnicode::charLetter_R,
XalanUnicode::charLetter_T,
XalanUnicode::charLetter_R,
XalanUnicode::charDigit_2,
0
};
const char XalanEXSLTFunctionConstant::s_eValueString[] =
"2.71828182845904523536028747135266249775724709369996";
const char XalanEXSLTFunctionConstant::s_ln10ValueString[] =
"2.302585092994046";
const char XalanEXSLTFunctionConstant::s_ln2ValueString[] =
"0.69314718055994530941723212145817656807550013436025";
const char XalanEXSLTFunctionConstant::s_log2EValueString[] =
"1.4426950408889633";
const char XalanEXSLTFunctionConstant::s_piValueString[] =
"3.1415926535897932384626433832795028841971693993751";
const char XalanEXSLTFunctionConstant::s_sqrt1_2ValueString[] =
"0.7071067811865476";
const char XalanEXSLTFunctionConstant::s_sqrt2ValueString[] =
"1.41421356237309504880168872420969807856967187537694";
XObjectPtr
doConvert(
XPathExecutionContext& executionContext,
const char* theValue,
size_t theSize,
double thePrecision)
{
return executionContext.getXObjectFactory().createNumber(
DoubleSupport::toDouble(
XalanDOMString(theValue, XalanDOMString::size_type(thePrecision <= theSize ? thePrecision : theSize))));
}
XObjectPtr
XalanEXSLTFunctionConstant::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
const XalanDOMString& theConstant = args[0]->str();
const double thePrecision = DoubleSupport::round(args[1]->num());
if (equals(
s_eString,
theConstant.c_str(),
sizeof(s_eString) / sizeof(s_eString[0]) - 1) == true)
{
return doConvert(executionContext, s_eValueString, sizeof(s_eValueString) - 1, thePrecision);
}
else if (equals(
s_ln10String,
theConstant.c_str(),
sizeof(s_ln10String) / sizeof(s_ln10String[0]) - 1) == true)
{
return doConvert(executionContext, s_ln10ValueString, sizeof(s_ln10ValueString) - 1, thePrecision);
}
else if (equals(
s_ln2String,
theConstant.c_str(),
sizeof(s_ln2String) / sizeof(s_ln2String[0]) - 1) == true)
{
return doConvert(executionContext, s_ln2ValueString, sizeof(s_ln2ValueString) - 1, thePrecision);
}
else if (equals(
s_log2EString,
theConstant.c_str(),
sizeof(s_log2EString) / sizeof(s_log2EString[0]) - 1) == true)
{
return doConvert(executionContext, s_log2EValueString, sizeof(s_log2EValueString) - 1, thePrecision);
}
else if (equals(
s_piString,
theConstant.c_str(),
sizeof(s_piString) / sizeof(s_piString[0]) - 1) == true)
{
return doConvert(executionContext, s_piValueString, sizeof(s_piValueString) - 1, thePrecision);
}
else if (equals(
s_sqrt1_2String,
theConstant.c_str(),
sizeof(s_sqrt1_2String) / sizeof(s_sqrt1_2String[0]) - 1) == true)
{
return doConvert(executionContext, s_sqrt1_2ValueString, sizeof(s_sqrt1_2ValueString) - 1, thePrecision);
}
else if (equals(
s_sqrt2String,
theConstant.c_str(),
sizeof(s_sqrt2String) / sizeof(s_sqrt2String[0]) - 1) == true)
{
return doConvert(executionContext, s_sqrt2ValueString, sizeof(s_sqrt2ValueString) - 1, thePrecision);
}
else
{
return executionContext.getXObjectFactory().createNumber(DoubleSupport::getNaN());
}
}
XObjectPtr
XalanEXSLTFunctionCos::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::cos;
#endif
return executionContext.getXObjectFactory().createNumber(cos(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionCos::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT cos() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionExp::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::exp;
#endif
return executionContext.getXObjectFactory().createNumber(exp(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionExp::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT exp() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionLog::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::log;
#endif
return executionContext.getXObjectFactory().createNumber(log(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionLog::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT log() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionPower::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::pow;
#endif
return executionContext.getXObjectFactory().createNumber(pow(args[0]->num(), args[1]->num()));
}
const XalanDOMString
XalanEXSLTFunctionPower::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT power() function accepts two arguments"));
}
XObjectPtr
XalanEXSLTFunctionSin::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::sin;
#endif
return executionContext.getXObjectFactory().createNumber(sin(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionSin::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT sin() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionSqrt::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::sqrt;
#endif
return executionContext.getXObjectFactory().createNumber(sqrt(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionSqrt::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT sqrt() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionTan::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::tan;
#endif
return executionContext.getXObjectFactory().createNumber(tan(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionTan::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT tan() function accepts one argument"));
}
static const XalanDOMChar s_mathNamespace[] =
{
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_p,
XalanUnicode::charColon,
XalanUnicode::charSolidus,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_x,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_t,
XalanUnicode::charFullStop,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_g,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_h,
0
};
static const XalanDOMChar s_absFunctionName[] =
{
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_b,
XalanUnicode::charLetter_s,
0
};
static const XalanDOMChar s_acosFunctionName[] =
{
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_s,
0
};
static const XalanDOMChar s_asinFunctionName[] =
{
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
0
};
static const XalanDOMChar s_atanFunctionName[] =
{
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_n,
0
};
static const XalanDOMChar s_atan2FunctionName[] =
{
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_n,
XalanUnicode::charDigit_2,
0
};
static const XalanDOMChar s_constantFunctionName[] =
{
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_cosFunctionName[] =
{
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_s,
0
};
static const XalanDOMChar s_expFunctionName[] =
{
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_x,
XalanUnicode::charLetter_p,
0
};
static const XalanDOMChar s_highestFunctionName[] =
{
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_g,
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_logFunctionName[] =
{
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_g,
0
};
static const XalanDOMChar s_lowestFunctionName[] =
{
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_w,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_maxFunctionName[] =
{
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_x,
0
};
static const XalanDOMChar s_minFunctionName[] =
{
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
0
};
static const XalanDOMChar s_powFunctionName[] =
{
XalanUnicode::charLetter_p,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_w,
0
};
static const XalanDOMChar s_sinFunctionName[] =
{
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
0
};
static const XalanDOMChar s_sqrtFunctionName[] =
{
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_q,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_tanFunctionName[] =
{
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_n,
0
};
static const XalanEXSLTFunctionAbs s_absFunction;
static const XalanEXSLTFunctionAcos s_acosFunction;
static const XalanEXSLTFunctionAsin s_asinFunction;
static const XalanEXSLTFunctionAtan s_atanFunction;
static const XalanEXSLTFunctionAtan s_atan2Function;
static const XalanEXSLTFunctionConstant s_constantFunction;
static const XalanEXSLTFunctionCos s_cosFunction;
static const XalanEXSLTFunctionExp s_expFunction;
static const XalanEXSLTFunctionHighest s_highestFunction;
static const XalanEXSLTFunctionLog s_logFunction;
static const XalanEXSLTFunctionLowest s_lowestFunction;
static const XalanEXSLTFunctionMax s_maxFunction;
static const XalanEXSLTFunctionMin s_minFunction;
static const XalanEXSLTFunctionPower s_powFunction;
static const XalanEXSLTFunctionSin s_sinFunction;
static const XalanEXSLTFunctionSqrt s_sqrtFunction;
static const XalanEXSLTFunctionTan s_tanFunction;
static const XalanEXSLTMathFunctionsInstaller::FunctionTableEntry theFunctionTable[] =
{
{ s_absFunctionName, &s_absFunction },
{ s_acosFunctionName, &s_acosFunction },
{ s_asinFunctionName, &s_asinFunction },
{ s_atanFunctionName, &s_atanFunction },
{ s_atan2FunctionName, &s_atan2Function },
{ s_constantFunctionName, &s_constantFunction },
{ s_cosFunctionName, &s_cosFunction },
{ s_expFunctionName, &s_expFunction },
{ s_highestFunctionName, &s_highestFunction },
{ s_logFunctionName, &s_logFunction },
{ s_lowestFunctionName, &s_lowestFunction },
{ s_maxFunctionName, &s_maxFunction },
{ s_minFunctionName, &s_minFunction },
{ s_powFunctionName, &s_powFunction },
{ s_sinFunctionName, &s_sinFunction },
{ s_sqrtFunctionName, &s_sqrtFunction },
{ s_tanFunctionName, &s_tanFunction },
{ 0, 0 }
};
void
XalanEXSLTMathFunctionsInstaller::installLocal(XPathEnvSupportDefault& theSupport)
{
doInstallLocal(s_mathNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTMathFunctionsInstaller::installGlobal()
{
doInstallGlobal(s_mathNamespace, theFunctionTable);
}
void
XalanEXSLTMathFunctionsInstaller::uninstallLocal(XPathEnvSupportDefault& theSupport)
{
doUninstallLocal(s_mathNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTMathFunctionsInstaller::uninstallGlobal()
{
doUninstallGlobal(s_mathNamespace, theFunctionTable);
}
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTMath.hpp
Index: XalanEXSLTMath.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_MATH_HEADER_GUARD_1357924680)
#define EXSLT_MATH_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XalanExtensions/XalanExtensions.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTMathFunctionsInstaller : public XalanExtensionsInstaller
{
public:
static void
installLocal(XPathEnvSupportDefault& theSupport);
static void
installGlobal();
static void
uninstallLocal(XPathEnvSupportDefault& theSupport);
static void
uninstallGlobal();
};
#endif // EXSLT_MATH_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTMathImpl.hpp
Index: XalanEXSLTMathImpl.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_MATHIMPL_HEADER_GUARD_1357924680)
#define EXSLT_MATHIMPL_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XPath/Function.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAbs : public Function
{
public:
XalanEXSLTFunctionAbs()
{
}
virtual
~XalanEXSLTFunctionAbs()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAbs*
#endif
clone() const
{
return new XalanEXSLTFunctionAbs(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAbs&
operator=(const XalanEXSLTFunctionAbs&);
bool
operator==(const XalanEXSLTFunctionAbs&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAcos : public Function
{
public:
XalanEXSLTFunctionAcos()
{
}
virtual
~XalanEXSLTFunctionAcos()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAcos*
#endif
clone() const
{
return new XalanEXSLTFunctionAcos(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAcos&
operator=(const XalanEXSLTFunctionAcos&);
bool
operator==(const XalanEXSLTFunctionAcos&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAsin : public Function
{
public:
XalanEXSLTFunctionAsin()
{
}
virtual
~XalanEXSLTFunctionAsin()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAsin*
#endif
clone() const
{
return new XalanEXSLTFunctionAsin(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAsin&
operator=(const XalanEXSLTFunctionAsin&);
bool
operator==(const XalanEXSLTFunctionAsin&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAtan : public Function
{
public:
XalanEXSLTFunctionAtan()
{
}
virtual
~XalanEXSLTFunctionAtan()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAtan*
#endif
clone() const
{
return new XalanEXSLTFunctionAtan(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAtan&
operator=(const XalanEXSLTFunctionAtan&);
bool
operator==(const XalanEXSLTFunctionAtan&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAtan2 : public Function
{
public:
XalanEXSLTFunctionAtan2()
{
}
virtual
~XalanEXSLTFunctionAtan2()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAtan2*
#endif
clone() const
{
return new XalanEXSLTFunctionAtan2(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAtan2&
operator=(const XalanEXSLTFunctionAtan2&);
bool
operator==(const XalanEXSLTFunctionAtan2&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionConstant : public Function
{
public:
XalanEXSLTFunctionConstant()
{
}
virtual
~XalanEXSLTFunctionConstant()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionConstant*
#endif
clone() const
{
return new XalanEXSLTFunctionConstant(*this);
}
protected:
const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function constant() function accepts two arguments"));
}
private:
static const XalanDOMChar s_eString[];
static const XalanDOMChar s_ln10String[];
static const XalanDOMChar s_ln2String[];
static const XalanDOMChar s_log2EString[];
static const XalanDOMChar s_piString[];
static const XalanDOMChar s_sqrt1_2String[];
static const XalanDOMChar s_sqrt2String[];
static const char s_eValueString[];
static const char s_ln10ValueString[];
static const char s_ln2ValueString[];
static const char s_log2EValueString[];
static const char s_piValueString[];
static const char s_sqrt1_2ValueString[];
static const char s_sqrt2ValueString[];
// Not implemented...
XalanEXSLTFunctionConstant&
operator=(const XalanEXSLTFunctionConstant&);
bool
operator==(const XalanEXSLTFunctionConstant&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionCos : public Function
{
public:
XalanEXSLTFunctionCos()
{
}
virtual
~XalanEXSLTFunctionCos()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionCos*
#endif
clone() const
{
return new XalanEXSLTFunctionCos(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionCos&
operator=(const XalanEXSLTFunctionCos&);
bool
operator==(const XalanEXSLTFunctionCos&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionExp : public Function
{
public:
XalanEXSLTFunctionExp()
{
}
virtual
~XalanEXSLTFunctionExp()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionExp*
#endif
clone() const
{
return new XalanEXSLTFunctionExp(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionExp&
operator=(const XalanEXSLTFunctionExp&);
bool
operator==(const XalanEXSLTFunctionExp&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionHighest : public Function
{
public:
XalanEXSLTFunctionHighest()
{
}
virtual
~XalanEXSLTFunctionHighest()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionHighest*
#endif
clone() const
{
return new XalanEXSLTFunctionHighest(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionHighest&
operator=(const XalanEXSLTFunctionHighest&);
bool
operator==(const XalanEXSLTFunctionHighest&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionLog : public Function
{
public:
XalanEXSLTFunctionLog()
{
}
virtual
~XalanEXSLTFunctionLog()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionLog*
#endif
clone() const
{
return new XalanEXSLTFunctionLog(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionLog&
operator=(const XalanEXSLTFunctionLog&);
bool
operator==(const XalanEXSLTFunctionLog&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionLowest : public Function
{
public:
XalanEXSLTFunctionLowest()
{
}
virtual
~XalanEXSLTFunctionLowest()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionLowest*
#endif
clone() const
{
return new XalanEXSLTFunctionLowest(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionLowest&
operator=(const XalanEXSLTFunctionLowest&);
bool
operator==(const XalanEXSLTFunctionLowest&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionMax : public Function
{
public:
XalanEXSLTFunctionMax()
{
}
virtual
~XalanEXSLTFunctionMax()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionMax*
#endif
clone() const
{
return new XalanEXSLTFunctionMax(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionMax&
operator=(const XalanEXSLTFunctionMax&);
bool
operator==(const XalanEXSLTFunctionMax&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionMin : public Function
{
public:
XalanEXSLTFunctionMin()
{
}
virtual
~XalanEXSLTFunctionMin()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionMin*
#endif
clone() const
{
return new XalanEXSLTFunctionMin(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionMin&
operator=(const XalanEXSLTFunctionMin&);
bool
operator==(const XalanEXSLTFunctionMin&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionPower : public Function
{
public:
XalanEXSLTFunctionPower()
{
}
virtual
~XalanEXSLTFunctionPower()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionPower*
#endif
clone() const
{
return new XalanEXSLTFunctionPower(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionPower&
operator=(const XalanEXSLTFunctionPower&);
bool
operator==(const XalanEXSLTFunctionPower&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionSin : public Function
{
public:
XalanEXSLTFunctionSin()
{
}
virtual
~XalanEXSLTFunctionSin()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionSin*
#endif
clone() const
{
return new XalanEXSLTFunctionSin(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionSin&
operator=(const XalanEXSLTFunctionSin&);
bool
operator==(const XalanEXSLTFunctionSin&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionSqrt : public Function
{
public:
XalanEXSLTFunctionSqrt()
{
}
virtual
~XalanEXSLTFunctionSqrt()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionSqrt*
#endif
clone() const
{
return new XalanEXSLTFunctionSqrt(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionSqrt&
operator=(const XalanEXSLTFunctionSqrt&);
bool
operator==(const XalanEXSLTFunctionSqrt&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionTan : public Function
{
public:
XalanEXSLTFunctionTan()
{
}
virtual
~XalanEXSLTFunctionTan()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionTan*
#endif
clone() const
{
return new XalanEXSLTFunctionTan(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionTan&
operator=(const XalanEXSLTFunctionTan&);
bool
operator==(const XalanEXSLTFunctionTan&) const;
};
#endif // EXSLT_MATHIMPL_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTSet.cpp
Index: XalanEXSLTSet.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanEXSLTSet.hpp"
#include "XalanEXSLTSetImpl.hpp"
#include <PlatformSupport/XalanUnicode.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathEnvSupportDefault.hpp>
XObjectPtr
XalanEXSLTFunctionHasSameNode::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
const NodeRefListBase& nodeset1 = args[0]->nodeset();
const NodeRefListBase& nodeset2 = args[1]->nodeset();
const NodeRefListBase::size_type theLength1 = nodeset1.getLength();
const NodeRefListBase::size_type theLength2 = nodeset1.getLength();
bool fResult = false;
if (theLength1 != 0 && theLength2 != 0)
{
for (NodeRefListBase::size_type i = 0; i < theLength1 && fResult == false; ++i)
{
XalanNode* const theNode = nodeset1.item(i);
assert(theNode != 0);
if (nodeset2.indexOf(theNode) != NodeRefListBase::npos)
{
fResult = true;
}
}
}
return executionContext.getXObjectFactory().createBoolean(fResult);
}
typedef Function::XObjectArgVectorType XObjectArgVectorType;
template<class PredicateType>
XObjectPtr
findNodes(
XPathExecutionContext& executionContext,
const XObjectArgVectorType& args,
PredicateType thePredicate)
{
assert(args[0].null() == false && args[1].null() == false);
const NodeRefListBase& nodeset1 = args[0]->nodeset();
const NodeRefListBase& nodeset2 = args[1]->nodeset();
const NodeRefListBase::size_type theLength1 = nodeset1.getLength();
const NodeRefListBase::size_type theLength2 = nodeset1.getLength();
if (theLength1 == 0 || theLength2 == 0)
{
return args[0];
}
else
{
const XalanNode* const theNode = nodeset2.item(0);
assert(theNode != 0);
XPathExecutionContext::BorrowReturnMutableNodeRefList theNodes(executionContext);
const NodeRefListBase::size_type theIndex = nodeset1.indexOf(theNode);
if (theIndex != NodeRefListBase::npos)
{
for (NodeRefListBase::size_type i = 0; i < theLength1; ++i)
{
XalanNode* const theCurrentNode = nodeset1.item(i);
assert(theCurrentNode != 0);
if (thePredicate(theCurrentNode, theNode) == true)
{
theNodes->addNodeInDocOrder(theCurrentNode, executionContext);
}
}
}
theNodes->setDocumentOrder();
return executionContext.getXObjectFactory().createNodeSet(theNodes);
}
}
struct LeadingCompareFunctor
{
LeadingCompareFunctor(XPathExecutionContext& executionContext) :
m_executionContext(executionContext)
{
}
bool
operator()(
const XalanNode* theLHS,
const XalanNode* theRHS) const
{
assert(theLHS != 0 && theRHS != 0);
return theLHS != theRHS && m_executionContext.isNodeAfter(*theLHS, *theRHS) == false;
}
private:
XPathExecutionContext& m_executionContext;
};
XObjectPtr
XalanEXSLTFunctionLeading::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
return findNodes(executionContext, args, LeadingCompareFunctor(executionContext));
}
struct TrailingCompareFunctor
{
TrailingCompareFunctor(XPathExecutionContext& executionContext) :
m_executionContext(executionContext)
{
}
bool
operator()(
const XalanNode* theLHS,
const XalanNode* theRHS) const
{
assert(theLHS != 0 && theRHS != 0);
return m_executionContext.isNodeAfter(*theLHS, *theRHS) == true;
}
private:
XPathExecutionContext& m_executionContext;
};
XObjectPtr
XalanEXSLTFunctionTrailing::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
return findNodes(executionContext, args, TrailingCompareFunctor(executionContext));
}
static const XalanDOMChar s_setNamespace[] =
{
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_p,
XalanUnicode::charColon,
XalanUnicode::charSolidus,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_x,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_t,
XalanUnicode::charFullStop,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_g,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_differenceFunctionName[] =
{
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_f,
XalanUnicode::charLetter_f,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_e,
0
};
static const XalanDOMChar s_distinctFunctionName[] =
{
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_hasSameNodeFunctionName[] =
{
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_s,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_m,
XalanUnicode::charLetter_e,
XalanUnicode::charHyphenMinus,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_e,
0
};
static const XalanDOMChar s_intersectionFunctionName[] =
{
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_n,
0
};
static const XalanDOMChar s_leadingFunctionName[] =
{
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_g,
0
};
static const XalanDOMChar s_trailingFunctionName[] =
{
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_g,
0
};
static const XalanEXSLTFunctionDifference s_differenceFunction;
static const XalanEXSLTFunctionDistinct s_distinctFunction;
static const XalanEXSLTFunctionHasSameNode s_hasSameNodeFunction;
static const XalanEXSLTFunctionIntersection s_intersectionFunction;
static const XalanEXSLTFunctionLeading s_leadingFunction;
static const XalanEXSLTFunctionTrailing s_trailingFunction;
static const XalanEXSLTSetFunctionsInstaller::FunctionTableEntry theFunctionTable[] =
{
{ s_differenceFunctionName, &s_differenceFunction },
{ s_distinctFunctionName, &s_distinctFunction },
{ s_hasSameNodeFunctionName, &s_hasSameNodeFunction },
{ s_intersectionFunctionName, &s_intersectionFunction },
{ s_leadingFunctionName, &s_leadingFunction },
{ s_trailingFunctionName, &s_trailingFunction },
{ 0, 0 }
};
void
XalanEXSLTSetFunctionsInstaller::installLocal(XPathEnvSupportDefault& theSupport)
{
doInstallLocal(s_setNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTSetFunctionsInstaller::installGlobal()
{
doInstallGlobal(s_setNamespace, theFunctionTable);
}
void
XalanEXSLTSetFunctionsInstaller::uninstallLocal(XPathEnvSupportDefault& theSupport)
{
doUninstallLocal(s_setNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTSetFunctionsInstaller::uninstallGlobal()
{
doUninstallGlobal(s_setNamespace, theFunctionTable);
}
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTSet.hpp
Index: XalanEXSLTSet.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_SET_HEADER_GUARD_1357924680)
#define EXSLT_SET_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XalanExtensions/XalanExtensions.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTSetFunctionsInstaller : public XalanExtensionsInstaller
{
public:
static void
installLocal(XPathEnvSupportDefault& theSupport);
static void
installGlobal();
static void
uninstallLocal(XPathEnvSupportDefault& theSupport);
static void
uninstallGlobal();
};
#endif // EXSLT_SET_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTSetImpl.hpp
Index: XalanEXSLTSetImpl.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_SETIMPL_HEADER_GUARD_1357924680)
#define EXSLT_SETIMPL_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XPath/Function.hpp>
#include <XalanExtensions/FunctionDifference.hpp>
#include <XalanExtensions/FunctionDistinct.hpp>
#include <XalanExtensions/FunctionIntersection.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionDifference : public FunctionDifference
{
public:
XalanEXSLTFunctionDifference() :
FunctionDifference()
{
}
virtual
~XalanEXSLTFunctionDifference()
{
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionDifference*
#endif
clone() const
{
return new XalanEXSLTFunctionDifference(*this);
}
protected:
virtual const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function difference() function accepts two arguments"));
}
private:
// Not implemented...
XalanEXSLTFunctionDifference&
operator=(const XalanEXSLTFunctionDifference&);
bool
operator==(const XalanEXSLTFunctionDifference&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionDistinct : public FunctionDistinct
{
public:
XalanEXSLTFunctionDistinct() :
FunctionDistinct()
{
}
virtual
~XalanEXSLTFunctionDistinct()
{
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionDistinct*
#endif
clone() const
{
return new XalanEXSLTFunctionDistinct(*this);
}
protected:
virtual const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function distinct() function accepts one argument"));
}
private:
// Not implemented...
XalanEXSLTFunctionDifference&
operator=(const XalanEXSLTFunctionDifference&);
bool
operator==(const XalanEXSLTFunctionDifference&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionHasSameNode : public Function
{
public:
XalanEXSLTFunctionHasSameNode() :
Function()
{
}
virtual
~XalanEXSLTFunctionHasSameNode()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionHasSameNode*
#endif
clone() const
{
return new XalanEXSLTFunctionHasSameNode(*this);
}
protected:
virtual const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function has-same-node() function accepts two arguments"));
}
private:
// Not implemented...
XalanEXSLTFunctionHasSameNode&
operator=(const XalanEXSLTFunctionHasSameNode&);
bool
operator==(const XalanEXSLTFunctionHasSameNode&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionIntersection : public FunctionIntersection
{
public:
XalanEXSLTFunctionIntersection() :
FunctionIntersection()
{
}
virtual
~XalanEXSLTFunctionIntersection()
{
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionIntersection*
#endif
clone() const
{
return new XalanEXSLTFunctionIntersection(*this);
}
protected:
virtual const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function distinct() function accepts two arguments"));
}
private:
// Not implemented...
XalanEXSLTFunctionIntersection&
operator=(const XalanEXSLTFunctionIntersection&);
bool
operator==(const XalanEXSLTFunctionIntersection&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionLeading : public Function
{
public:
XalanEXSLTFunctionLeading() :
Function()
{
}
virtual
~XalanEXSLTFunctionLeading()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionLeading*
#endif
clone() const
{
return new XalanEXSLTFunctionLeading(*this);
}
protected:
virtual const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function leading() function accepts two arguments"));
}
private:
// Not implemented...
XalanEXSLTFunctionHasSameNode&
operator=(const XalanEXSLTFunctionHasSameNode&);
bool
operator==(const XalanEXSLTFunctionHasSameNode&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionTrailing : public Function
{
public:
XalanEXSLTFunctionTrailing() :
Function()
{
}
virtual
~XalanEXSLTFunctionTrailing()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionTrailing*
#endif
clone() const
{
return new XalanEXSLTFunctionTrailing(*this);
}
protected:
virtual const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function trailing() function accepts two arguments"));
}
private:
// Not implemented...
XalanEXSLTFunctionTrailing&
operator=(const XalanEXSLTFunctionTrailing&);
bool
operator==(const XalanEXSLTFunctionTrailing&) const;
};
#endif // EXSLT_SETIMPL_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTString.cpp
Index: XalanEXSLTString.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#include "XalanEXSLTString.hpp"
#include "XalanEXSLTStringImpl.hpp"
//#include <PlatformSupport/DoubleSupport.hpp>
#include <PlatformSupport/XalanUnicode.hpp>
#include <DOMSupport/DOMServices.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPathEnvSupportDefault.hpp>
const XalanDOMChar XalanEXSLTFunctionAlign::s_centerString[] =
{
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_r,
0
};
const XalanDOMChar XalanEXSLTFunctionAlign::s_rightString[] =
{
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_g,
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_t,
0
};
XObjectPtr
XalanEXSLTFunctionAlign::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
const XObjectArgVectorType::size_type theSize = args.size();
if (theSize != 2 && theSize != 3)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false && (theSize == 2 || args[2].null() == false));
const XalanDOMString& theTargetString = args[0]->str();
const XalanDOMString& thePaddingString = args[1]->str();
const XalanDOMString::size_type theTargetStringLength = theTargetString.length();
const XalanDOMString::size_type thePaddingStringLength = thePaddingString.length();
if (theTargetStringLength == thePaddingStringLength)
{
return XObjectPtr(args[0]);
}
else
{
XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theResult = theGuard.get();
if (theTargetStringLength > thePaddingStringLength)
{
theResult.assign(theTargetString, 0, thePaddingStringLength);
}
else
{
theResult.reserve(thePaddingStringLength);
enum eAlignment { eCenter, eLeft, eRight };
eAlignment theAlignment = eLeft;
if (theSize == 3)
{
const XalanDOMString& theAlignmentString = args[2]->str();
if (equals(
s_centerString,
theAlignmentString.c_str(),
sizeof(s_centerString) / sizeof(s_centerString[0]) - 1) == true)
{
theAlignment = eCenter;
}
else if (equals(
s_rightString,
theAlignmentString.c_str(),
sizeof(s_rightString) / sizeof(s_rightString[0]) - 1) == true)
{
theAlignment = eRight;
}
}
if (theAlignment == eLeft)
{
theResult = theTargetString;
theResult.append(thePaddingString, theTargetStringLength, thePaddingStringLength - theTargetStringLength);
}
else if (theAlignment == eRight)
{
theResult.assign(thePaddingString, 0, thePaddingStringLength - theTargetStringLength);
theResult.append(theTargetString);
}
else if (theAlignment == eCenter)
{
const XalanDOMString::size_type theStartIndex =
(thePaddingStringLength - theTargetStringLength) / 2;
theResult.assign(thePaddingString, 0, theStartIndex);
theResult.append(theTargetString);
theResult.append(
thePaddingString,
theTargetStringLength + theStartIndex,
thePaddingStringLength - theTargetStringLength - theStartIndex);
}
}
return executionContext.getXObjectFactory().createString(theResult);
}
}
static const XalanDOMString s_emptyString;
XObjectPtr
XalanEXSLTFunctionConcat::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
const NodeRefListBase& theNodeSet = args[0]->nodeset();
const NodeRefListBase::size_type theLength = theNodeSet.getLength();
if (theLength == 0)
{
return executionContext.getXObjectFactory().createStringReference(s_emptyString);
}
else
{
XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theResult = theGuard.get();
for(NodeRefListBase::size_type i = 0; i < theLength; ++i)
{
assert(theNodeSet.item(i) != 0);
DOMServices::getNodeData(*theNodeSet.item(i), theResult);
}
return executionContext.getXObjectFactory().createString(theResult);
}
}
const XalanDOMChar XalanEXSLTFunctionPadding::s_spaceString[] =
{
XalanUnicode::charSpace,
0
};
XObjectPtr
XalanEXSLTFunctionPadding::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
const XObjectArgVectorType::size_type theSize = args.size();
if (theSize != 1 && theSize != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && (theSize == 1 || args[1].null() == false));
const double theLength = args[0]->num();
const XalanDOMString& thePaddingString = theSize == 2 ? args[1]->str() : m_space;
const XalanDOMString::size_type thePaddingStringLength = thePaddingString.length();
if (theLength == 0.0 || thePaddingStringLength == 0)
{
return executionContext.getXObjectFactory().createStringReference(s_emptyString);
}
else
{
XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theResult = theGuard.get();
if (thePaddingStringLength == 1)
{
theResult.assign(theLength, thePaddingString[0]);
}
else
{
double theRemainingLength = theLength;
for(;;)
{
if (theRemainingLength > thePaddingStringLength)
{
theResult.append(thePaddingString);
theRemainingLength -= thePaddingStringLength;
}
else
{
theResult.append(
thePaddingString,
0,
XalanDOMString::size_type(theRemainingLength));
break;
}
}
}
return executionContext.getXObjectFactory().createString(theResult);
}
#if 0
const XalanDOMString::size_type theTargetStringLength = theTargetString.length();
if (theTargetStringLength == thePaddingStringLength)
{
return XObjectPtr(args[0]);
}
else
{
if (theTargetStringLength > thePaddingStringLength)
{
theResult.assign(theTargetString, 0, thePaddingStringLength);
}
else
{
theResult.reserve(thePaddingStringLength);
enum eAlignment { eCenter, eLeft, eRight };
eAlignment theAlignment = eLeft;
if (theSize == 3)
{
const XalanDOMString& theAlignmentString = args[2]->str();
if (equals(
s_centerString,
theAlignmentString.c_str(),
sizeof(s_centerString) / sizeof(s_centerString[0]) - 1) == true)
{
theAlignment = eCenter;
}
else if (equals(
s_rightString,
theAlignmentString.c_str(),
sizeof(s_rightString) / sizeof(s_rightString[0]) - 1) == true)
{
theAlignment = eRight;
}
}
if (theAlignment == eLeft)
{
theResult = theTargetString;
theResult.append(thePaddingString, theTargetStringLength, thePaddingStringLength - theTargetStringLength);
}
else if (theAlignment == eRight)
{
theResult.assign(thePaddingString, 0, thePaddingStringLength - theTargetStringLength);
theResult.append(theTargetString);
}
else if (theAlignment == eCenter)
{
const XalanDOMString::size_type theStartIndex =
(thePaddingStringLength - theTargetStringLength) / 2;
theResult.assign(thePaddingString, 0, theStartIndex);
theResult.append(theTargetString);
theResult.append(
thePaddingString,
theTargetStringLength + theStartIndex,
thePaddingStringLength - theTargetStringLength - theStartIndex);
}
}
}
#endif
}
#if 0
const XalanDOMString
XalanEXSLTFunctionHighest::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT highest() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionLowest::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
return findNodes(executionContext, args[0]->nodeset(), DoubleSupport::lessThan);
}
const XalanDOMString
XalanEXSLTFunctionLowest::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT lowest() function accepts one argument"));
}
template<class FunctionType>
XObjectPtr
findValue(
XPathExecutionContext& executionContext,
const NodeRefListBase& theNodeSet,
FunctionType theCompareFunction)
{
const NodeRefListBase::size_type theLength = theNodeSet.getLength();
if (theLength == 0)
{
return executionContext.getXObjectFactory().createNumber(DoubleSupport::getNaN());
}
else
{
const XPathExecutionContext::GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theStringValue = theGuard.get();
assert(theNodeSet.item(0) != 0);
DOMServices::getNodeData(*theNodeSet.item(0), theStringValue);
double theResult = DOMStringToDouble(theStringValue);
for (NodeRefListBase::size_type i = 1; i < theLength; ++i)
{
assert(theNodeSet.item(i) != 0);
DOMServices::getNodeData(*theNodeSet.item(i), theStringValue);
const double theCurrent = DOMStringToDouble(theStringValue);
if (DoubleSupport::isNaN(theCurrent) == true)
{
theResult = theCurrent;
break;
}
else if (theCompareFunction(theCurrent, theResult) == true)
{
theResult = theCurrent;
}
theStringValue.clear();
}
return executionContext.getXObjectFactory().createNumber(theResult);
}
}
XObjectPtr
XalanEXSLTFunctionMin::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
return findValue(executionContext, args[0]->nodeset(), DoubleSupport::lessThan);
}
const XalanDOMString
XalanEXSLTFunctionMin::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT min() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionMax::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
return findValue(executionContext, args[0]->nodeset(), DoubleSupport::greaterThan);
}
const XalanDOMString
XalanEXSLTFunctionMax::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT max() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAbs::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::fabs;
#endif
return executionContext.getXObjectFactory().createNumber(fabs(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAbs::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT abs() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAcos::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::acos;
#endif
return executionContext.getXObjectFactory().createNumber(acos(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAcos::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT acos() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAsin::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::asin;
#endif
return executionContext.getXObjectFactory().createNumber(asin(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAsin::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT asin() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAtan::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::atan;
#endif
return executionContext.getXObjectFactory().createNumber(atan(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAtan::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT atan() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionAtan2::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::atan2;
#endif
return executionContext.getXObjectFactory().createNumber(atan2(args[0]->num(), args[1]->num()));
}
const XalanDOMString
XalanEXSLTFunctionAtan2::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT atan2() function accepts two arguments"));
}
const XalanDOMChar XalanEXSLTFunctionConstant::s_eString[] =
{
XalanUnicode::charLetter_E,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_ln10String[] =
{
XalanUnicode::charLetter_L,
XalanUnicode::charLetter_N,
XalanUnicode::charDigit_1,
XalanUnicode::charDigit_0,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_ln2String[] =
{
XalanUnicode::charLetter_L,
XalanUnicode::charLetter_N,
XalanUnicode::charDigit_2,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_log2EString[] =
{
XalanUnicode::charLetter_L,
XalanUnicode::charLetter_O,
XalanUnicode::charLetter_G,
XalanUnicode::charDigit_2,
XalanUnicode::charLetter_E,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_piString[] =
{
XalanUnicode::charLetter_P,
XalanUnicode::charLetter_I,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_sqrt1_2String[] =
{
XalanUnicode::charLetter_S,
XalanUnicode::charLetter_Q,
XalanUnicode::charLetter_R,
XalanUnicode::charLetter_T,
XalanUnicode::charDigit_1,
XalanUnicode::charLowLine,
XalanUnicode::charDigit_2,
0
};
const XalanDOMChar XalanEXSLTFunctionConstant::s_sqrt2String[] =
{
XalanUnicode::charLetter_S,
XalanUnicode::charLetter_Q,
XalanUnicode::charLetter_R,
XalanUnicode::charLetter_T,
XalanUnicode::charLetter_R,
XalanUnicode::charDigit_2,
0
};
const char XalanEXSLTFunctionConstant::s_eValueString[] =
"2.71828182845904523536028747135266249775724709369996";
const char XalanEXSLTFunctionConstant::s_ln10ValueString[] =
"2.302585092994046";
const char XalanEXSLTFunctionConstant::s_ln2ValueString[] =
"0.69314718055994530941723212145817656807550013436025";
const char XalanEXSLTFunctionConstant::s_log2EValueString[] =
"1.4426950408889633";
const char XalanEXSLTFunctionConstant::s_piValueString[] =
"3.1415926535897932384626433832795028841971693993751";
const char XalanEXSLTFunctionConstant::s_sqrt1_2ValueString[] =
"0.7071067811865476";
const char XalanEXSLTFunctionConstant::s_sqrt2ValueString[] =
"1.41421356237309504880168872420969807856967187537694";
XObjectPtr
doConvert(
XPathExecutionContext& executionContext,
const char* theValue,
size_t theSize,
double thePrecision)
{
return executionContext.getXObjectFactory().createNumber(
DoubleSupport::toDouble(
XalanDOMString(theValue, XalanDOMString::size_type(thePrecision <= theSize ? thePrecision : theSize))));
}
XObjectPtr
XalanEXSLTFunctionConstant::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
const XalanDOMString& theConstant = args[0]->str();
const double thePrecision = DoubleSupport::round(args[1]->num());
if (equals(
s_eString,
theConstant.c_str(),
sizeof(s_eString) / sizeof(s_eString[0]) - 1) == true)
{
return doConvert(executionContext, s_eValueString, sizeof(s_eValueString) - 1, thePrecision);
}
else if (equals(
s_ln10String,
theConstant.c_str(),
sizeof(s_ln10String) / sizeof(s_ln10String[0]) - 1) == true)
{
return doConvert(executionContext, s_ln10ValueString, sizeof(s_ln10ValueString) - 1, thePrecision);
}
else if (equals(
s_ln2String,
theConstant.c_str(),
sizeof(s_ln2String) / sizeof(s_ln2String[0]) - 1) == true)
{
return doConvert(executionContext, s_ln2ValueString, sizeof(s_ln2ValueString) - 1, thePrecision);
}
else if (equals(
s_log2EString,
theConstant.c_str(),
sizeof(s_log2EString) / sizeof(s_log2EString[0]) - 1) == true)
{
return doConvert(executionContext, s_log2EValueString, sizeof(s_log2EValueString) - 1, thePrecision);
}
else if (equals(
s_piString,
theConstant.c_str(),
sizeof(s_piString) / sizeof(s_piString[0]) - 1) == true)
{
return doConvert(executionContext, s_piValueString, sizeof(s_piValueString) - 1, thePrecision);
}
else if (equals(
s_sqrt1_2String,
theConstant.c_str(),
sizeof(s_sqrt1_2String) / sizeof(s_sqrt1_2String[0]) - 1) == true)
{
return doConvert(executionContext, s_sqrt1_2ValueString, sizeof(s_sqrt1_2ValueString) - 1, thePrecision);
}
else if (equals(
s_sqrt2String,
theConstant.c_str(),
sizeof(s_sqrt2String) / sizeof(s_sqrt2String[0]) - 1) == true)
{
return doConvert(executionContext, s_sqrt2ValueString, sizeof(s_sqrt2ValueString) - 1, thePrecision);
}
else
{
return executionContext.getXObjectFactory().createNumber(DoubleSupport::getNaN());
}
}
XObjectPtr
XalanEXSLTFunctionCos::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::cos;
#endif
return executionContext.getXObjectFactory().createNumber(cos(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionCos::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT cos() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionExp::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::exp;
#endif
return executionContext.getXObjectFactory().createNumber(exp(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionExp::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT exp() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionLog::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::log;
#endif
return executionContext.getXObjectFactory().createNumber(log(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionLog::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT log() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionPower::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 2)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false && args[1].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::pow;
#endif
return executionContext.getXObjectFactory().createNumber(pow(args[0]->num(), args[1]->num()));
}
const XalanDOMString
XalanEXSLTFunctionPower::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT power() function accepts two arguments"));
}
XObjectPtr
XalanEXSLTFunctionSin::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::sin;
#endif
return executionContext.getXObjectFactory().createNumber(sin(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionSin::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT sin() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionSqrt::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::sqrt;
#endif
return executionContext.getXObjectFactory().createNumber(sqrt(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionSqrt::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT sqrt() function accepts one argument"));
}
XObjectPtr
XalanEXSLTFunctionTan::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const
{
if (args.size() != 1)
{
executionContext.error(getError(), context, locator);
}
assert(args[0].null() == false);
#if defined(XALAN_STRICT_ANSI_HEADERS)
using std::tan;
#endif
return executionContext.getXObjectFactory().createNumber(tan(args[0]->num()));
}
const XalanDOMString
XalanEXSLTFunctionTan::getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXSLT tan() function accepts one argument"));
}
#endif
static const XalanDOMChar s_stringNamespace[] =
{
XalanUnicode::charLetter_h,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_p,
XalanUnicode::charColon,
XalanUnicode::charSolidus,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_e,
XalanUnicode::charLetter_x,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_t,
XalanUnicode::charFullStop,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_g,
XalanUnicode::charSolidus,
XalanUnicode::charLetter_s,
XalanUnicode::charLetter_t,
XalanUnicode::charLetter_r,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_g,
0
};
static const XalanDOMChar s_alignFunctionName[] =
{
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_l,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_g,
XalanUnicode::charLetter_n,
0
};
static const XalanDOMChar s_concatFunctionName[] =
{
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_o,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_c,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_t,
0
};
static const XalanDOMChar s_paddingFunctionName[] =
{
XalanUnicode::charLetter_p,
XalanUnicode::charLetter_a,
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_d,
XalanUnicode::charLetter_i,
XalanUnicode::charLetter_n,
XalanUnicode::charLetter_g,
0
};
static const XalanEXSLTFunctionAlign s_alignFunction;
static const XalanEXSLTFunctionConcat s_concatFunction;
static const XalanEXSLTFunctionPadding s_paddingFunction;
static const XalanEXSLTStringFunctionsInstaller::FunctionTableEntry theFunctionTable[] =
{
{ s_alignFunctionName, &s_alignFunction },
{ s_concatFunctionName, &s_concatFunction },
{ s_paddingFunctionName, &s_paddingFunction },
{ 0, 0 }
};
void
XalanEXSLTStringFunctionsInstaller::installLocal(XPathEnvSupportDefault& theSupport)
{
doInstallLocal(s_stringNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTStringFunctionsInstaller::installGlobal()
{
doInstallGlobal(s_stringNamespace, theFunctionTable);
}
void
XalanEXSLTStringFunctionsInstaller::uninstallLocal(XPathEnvSupportDefault& theSupport)
{
doUninstallLocal(s_stringNamespace, theFunctionTable, theSupport);
}
void
XalanEXSLTStringFunctionsInstaller::uninstallGlobal()
{
doUninstallGlobal(s_stringNamespace, theFunctionTable);
}
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTString.hpp
Index: XalanEXSLTString.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_STRING_HEADER_GUARD_1357924680)
#define EXSLT_STRING_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XalanExtensions/XalanExtensions.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTStringFunctionsInstaller : public XalanExtensionsInstaller
{
public:
static void
installLocal(XPathEnvSupportDefault& theSupport);
static void
installGlobal();
static void
uninstallLocal(XPathEnvSupportDefault& theSupport);
static void
uninstallGlobal();
};
#endif // EXSLT_STRING_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanEXSLT/XalanEXSLTStringImpl.hpp
Index: XalanEXSLTStringImpl.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2002 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Xalan" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation and was
* originally based on software copyright (c) 1999, International
* Business Machines, Inc., http://www.ibm.com. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
#if !defined(EXSLT_STRINGIMPL_HEADER_GUARD_1357924680)
#define EXSLT_STRINGIMPL_HEADER_GUARD_1357924680
#include <XalanEXSLT/XalanEXSLTDefinitions.hpp>
#include <XPath/Function.hpp>
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAlign : public Function
{
public:
XalanEXSLTFunctionAlign()
{
}
virtual
~XalanEXSLTFunctionAlign()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAlign*
#endif
clone() const
{
return new XalanEXSLTFunctionAlign(*this);
}
protected:
const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function align() accepts two or three arguments"));
}
private:
// Not implemented...
XalanEXSLTFunctionAlign&
operator=(const XalanEXSLTFunctionAlign&);
bool
operator==(const XalanEXSLTFunctionAlign&) const;
// Data members...
static const XalanDOMChar s_centerString[];
static const XalanDOMChar s_rightString[];
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionConcat : public Function
{
public:
XalanEXSLTFunctionConcat() :
Function()
{
}
virtual
~XalanEXSLTFunctionConcat()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionConcat*
#endif
clone() const
{
return new XalanEXSLTFunctionConcat(*this);
}
protected:
const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function concat() accepts one argument"));
}
private:
// Not implemented...
XalanEXSLTFunctionConcat&
operator=(const XalanEXSLTFunctionConcat&);
bool
operator==(const XalanEXSLTFunctionConcat&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionPadding : public Function
{
public:
XalanEXSLTFunctionPadding() :
Function(),
m_space(s_spaceString)
{
}
virtual
~XalanEXSLTFunctionPadding()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionPadding*
#endif
clone() const
{
return new XalanEXSLTFunctionPadding(*this);
}
protected:
const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function padding() accepts one or two arguments"));
}
private:
// Not implemented...
XalanEXSLTFunctionPadding&
operator=(const XalanEXSLTFunctionPadding&);
bool
operator==(const XalanEXSLTFunctionPadding&) const;
// Data members...
const XalanDOMString m_space;
static const XalanDOMChar s_spaceString[];
};
#if 0
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAsin : public Function
{
public:
XalanEXSLTFunctionAsin()
{
}
virtual
~XalanEXSLTFunctionAsin()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAsin*
#endif
clone() const
{
return new XalanEXSLTFunctionAsin(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAsin&
operator=(const XalanEXSLTFunctionAsin&);
bool
operator==(const XalanEXSLTFunctionAsin&) const;
// Data members...
static const XalanDOMString s_emptyString;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAtan : public Function
{
public:
XalanEXSLTFunctionAtan()
{
}
virtual
~XalanEXSLTFunctionAtan()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAtan*
#endif
clone() const
{
return new XalanEXSLTFunctionAtan(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAtan&
operator=(const XalanEXSLTFunctionAtan&);
bool
operator==(const XalanEXSLTFunctionAtan&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionAtan2 : public Function
{
public:
XalanEXSLTFunctionAtan2()
{
}
virtual
~XalanEXSLTFunctionAtan2()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionAtan2*
#endif
clone() const
{
return new XalanEXSLTFunctionAtan2(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionAtan2&
operator=(const XalanEXSLTFunctionAtan2&);
bool
operator==(const XalanEXSLTFunctionAtan2&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionConstant : public Function
{
public:
XalanEXSLTFunctionConstant()
{
}
virtual
~XalanEXSLTFunctionConstant()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionConstant*
#endif
clone() const
{
return new XalanEXSLTFunctionConstant(*this);
}
protected:
const XalanDOMString
getError() const
{
return StaticStringToDOMString(XALAN_STATIC_UCODE_STRING("The EXLT function constant() function accepts two arguments"));
}
private:
static const XalanDOMChar s_eString[];
static const XalanDOMChar s_ln10String[];
static const XalanDOMChar s_ln2String[];
static const XalanDOMChar s_log2EString[];
static const XalanDOMChar s_piString[];
static const XalanDOMChar s_sqrt1_2String[];
static const XalanDOMChar s_sqrt2String[];
static const char s_eValueString[];
static const char s_ln10ValueString[];
static const char s_ln2ValueString[];
static const char s_log2EValueString[];
static const char s_piValueString[];
static const char s_sqrt1_2ValueString[];
static const char s_sqrt2ValueString[];
// Not implemented...
XalanEXSLTFunctionConstant&
operator=(const XalanEXSLTFunctionConstant&);
bool
operator==(const XalanEXSLTFunctionConstant&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionCos : public Function
{
public:
XalanEXSLTFunctionCos()
{
}
virtual
~XalanEXSLTFunctionCos()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionCos*
#endif
clone() const
{
return new XalanEXSLTFunctionCos(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionCos&
operator=(const XalanEXSLTFunctionCos&);
bool
operator==(const XalanEXSLTFunctionCos&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionExp : public Function
{
public:
XalanEXSLTFunctionExp()
{
}
virtual
~XalanEXSLTFunctionExp()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionExp*
#endif
clone() const
{
return new XalanEXSLTFunctionExp(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionExp&
operator=(const XalanEXSLTFunctionExp&);
bool
operator==(const XalanEXSLTFunctionExp&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionHighest : public Function
{
public:
XalanEXSLTFunctionHighest()
{
}
virtual
~XalanEXSLTFunctionHighest()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionHighest*
#endif
clone() const
{
return new XalanEXSLTFunctionHighest(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionHighest&
operator=(const XalanEXSLTFunctionHighest&);
bool
operator==(const XalanEXSLTFunctionHighest&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionLog : public Function
{
public:
XalanEXSLTFunctionLog()
{
}
virtual
~XalanEXSLTFunctionLog()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionLog*
#endif
clone() const
{
return new XalanEXSLTFunctionLog(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionLog&
operator=(const XalanEXSLTFunctionLog&);
bool
operator==(const XalanEXSLTFunctionLog&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionLowest : public Function
{
public:
XalanEXSLTFunctionLowest()
{
}
virtual
~XalanEXSLTFunctionLowest()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionLowest*
#endif
clone() const
{
return new XalanEXSLTFunctionLowest(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionLowest&
operator=(const XalanEXSLTFunctionLowest&);
bool
operator==(const XalanEXSLTFunctionLowest&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionMax : public Function
{
public:
XalanEXSLTFunctionMax()
{
}
virtual
~XalanEXSLTFunctionMax()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionMax*
#endif
clone() const
{
return new XalanEXSLTFunctionMax(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionMax&
operator=(const XalanEXSLTFunctionMax&);
bool
operator==(const XalanEXSLTFunctionMax&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionMin : public Function
{
public:
XalanEXSLTFunctionMin()
{
}
virtual
~XalanEXSLTFunctionMin()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionMin*
#endif
clone() const
{
return new XalanEXSLTFunctionMin(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionMin&
operator=(const XalanEXSLTFunctionMin&);
bool
operator==(const XalanEXSLTFunctionMin&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionPower : public Function
{
public:
XalanEXSLTFunctionPower()
{
}
virtual
~XalanEXSLTFunctionPower()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionPower*
#endif
clone() const
{
return new XalanEXSLTFunctionPower(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionPower&
operator=(const XalanEXSLTFunctionPower&);
bool
operator==(const XalanEXSLTFunctionPower&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionSin : public Function
{
public:
XalanEXSLTFunctionSin()
{
}
virtual
~XalanEXSLTFunctionSin()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionSin*
#endif
clone() const
{
return new XalanEXSLTFunctionSin(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionSin&
operator=(const XalanEXSLTFunctionSin&);
bool
operator==(const XalanEXSLTFunctionSin&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionSqrt : public Function
{
public:
XalanEXSLTFunctionSqrt()
{
}
virtual
~XalanEXSLTFunctionSqrt()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionSqrt*
#endif
clone() const
{
return new XalanEXSLTFunctionSqrt(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionSqrt&
operator=(const XalanEXSLTFunctionSqrt&);
bool
operator==(const XalanEXSLTFunctionSqrt&) const;
};
class XALAN_EXSLT_EXPORT XalanEXSLTFunctionTan : public Function
{
public:
XalanEXSLTFunctionTan()
{
}
virtual
~XalanEXSLTFunctionTan()
{
}
// These methods are inherited from Function ...
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectArgVectorType& args,
const Locator* locator) const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual XalanEXSLTFunctionTan*
#endif
clone() const
{
return new XalanEXSLTFunctionTan(*this);
}
protected:
const XalanDOMString
getError() const;
private:
// Not implemented...
XalanEXSLTFunctionTan&
operator=(const XalanEXSLTFunctionTan&);
bool
operator==(const XalanEXSLTFunctionTan&) const;
};
#endif
#endif // EXSLT_STRINGIMPL_HEADER_GUARD_1357924680
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org