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 2001/06/14 21:31:33 UTC
cvs commit: xml-xalan/c/src/XalanExtensions FunctionDifference.cpp FunctionDifference.hpp FunctionDistinct.cpp FunctionDistinct.hpp FunctionEvaluate.cpp FunctionEvaluate.hpp FunctionHasSameNodes.cpp FunctionHasSameNodes.hpp FunctionIntersection.cpp FunctionIntersection.hpp FunctionNodeSet.cpp FunctionNodeSet.hpp XalanExtensionsDefinitions.hpp
dbertoni 01/06/14 12:31:33
Added: c/src/XalanExtensions FunctionDifference.cpp
FunctionDifference.hpp FunctionDistinct.cpp
FunctionDistinct.hpp FunctionEvaluate.cpp
FunctionEvaluate.hpp FunctionHasSameNodes.cpp
FunctionHasSameNodes.hpp FunctionIntersection.cpp
FunctionIntersection.hpp FunctionNodeSet.cpp
FunctionNodeSet.hpp XalanExtensionsDefinitions.hpp
Log:
Initial revision.
Revision Changes Path
1.1 xml-xalan/c/src/XalanExtensions/FunctionDifference.cpp
Index: FunctionDifference.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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 "FunctionDifference.hpp"
#include <XPath/XPathExecutionContext.hpp>
#include <XPath/XObjectFactory.hpp>
FunctionDifference::FunctionDifference()
{
}
FunctionDifference::~FunctionDifference()
{
}
XObjectPtr
FunctionDifference::execute(
XPathExecutionContext& executionContext,
XalanNode* context)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionDifference::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionDifference::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const XObjectPtr arg2)
{
const NodeRefListBase& nodeset1 = arg1->nodeset();
const NodeRefListBase& nodeset2 = arg2->nodeset();
typedef XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList;
BorrowReturnMutableNodeRefList theResult(executionContext);
const unsigned int theLength = nodeset1.getLength();
// Check the second node-set for nodes in the
// first node-set. If a node is not found,
// add it to the result.
for (unsigned int i = 0; i < theLength; ++i)
{
XalanNode* const theNode = nodeset1.item(i);
assert(theNode != 0);
if (nodeset2.indexOf(theNode) == NodeRefListBase::npos)
{
theResult->addNode(theNode);
}
}
return executionContext.getXObjectFactory().createNodeSet(theResult);
}
XObjectPtr
FunctionDifference::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */,
const XObjectPtr /* arg3 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionDifference::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int /* opPos */,
const XObjectArgVectorType& /* args */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
Function*
#else
FunctionDifference*
#endif
FunctionDifference::clone() const
{
return new FunctionDifference(*this);
}
const XalanDOMString
FunctionDifference::getError() const
{
return XALAN_STATIC_UCODE_STRING(
"The difference() function takes two arguments!");
}
1.1 xml-xalan/c/src/XalanExtensions/FunctionDifference.hpp
Index: FunctionDifference.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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(FUNCTIONDIFFERENCE_HEADER_GUARD_1357924680)
#define FUNCTIONDIFFERENCE_HEADER_GUARD_1357924680
// Base header file. Must be first.
#include <XalanExtensions/XalanExtensionsDefinitions.hpp>
// Base class header file...
#include <XPath/Function.hpp>
/**
* XPath implementation of "difference" function.
*/
class XALAN_XALANEXTENSIONS_EXPORT FunctionDifference : public Function
{
public:
FunctionDifference();
virtual
~FunctionDifference();
// These methods are inherited from Function ...
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context);
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const XObjectPtr arg3);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int opPos,
const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual FunctionDifference*
#endif
clone() const;
private:
const XalanDOMString
getError() const;
// Not implemented...
FunctionDifference&
operator=(const FunctionDifference&);
bool
operator==(const FunctionDifference&) const;
};
#endif // FUNCTIONDIFFERENCE_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanExtensions/FunctionDistinct.cpp
Index: FunctionDistinct.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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 "FunctionDistinct.hpp"
#include <set>
#include <XalanDOM/XalanDOMString.hpp>
#include <DOMSupport/DOMServices.hpp>
#include <XPath/XPathExecutionContext.hpp>
#include <XPath/XObjectFactory.hpp>
FunctionDistinct::FunctionDistinct()
{
}
FunctionDistinct::~FunctionDistinct()
{
}
XObjectPtr
FunctionDistinct::execute(
XPathExecutionContext& executionContext,
XalanNode* context)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionDistinct::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1)
{
const NodeRefListBase& nodeset = arg1->nodeset();
typedef XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList;
BorrowReturnMutableNodeRefList theResult(executionContext);
const unsigned int theLength = nodeset.getLength();
if (theLength == 1)
{
theResult->addNode(nodeset.item(0));
}
else if (theLength > 1)
{
#if !defined(XALAN_NO_NAMESPACES)
using std::set;
#endif
typedef XPathExecutionContext::GetAndReleaseCachedString GetAndReleaseCachedString;
GetAndReleaseCachedString theGuard(executionContext);
XalanDOMString& theCachedString = theGuard.get();
set<XalanDOMString> theStrings;
// Check to make sure each node has a unique
// string value.
for (unsigned int i = 0; i < theLength; ++i)
{
XalanNode* const theNode = nodeset.item(i);
assert(theNode != 0);
DOMServices::getNodeData(*theNode, theCachedString);
if (theStrings.find(theCachedString) == theStrings.end())
{
theResult->addNode(theNode);
}
}
}
return executionContext.getXObjectFactory().createNodeSet(theResult);
}
XObjectPtr
FunctionDistinct::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionDistinct::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */,
const XObjectPtr /* arg3 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionDistinct::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int /* opPos */,
const XObjectArgVectorType& /* args */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
Function*
#else
FunctionDistinct*
#endif
FunctionDistinct::clone() const
{
return new FunctionDistinct(*this);
}
const XalanDOMString
FunctionDistinct::getError() const
{
return XALAN_STATIC_UCODE_STRING(
"The distinct() function takes one argument!");
}
1.1 xml-xalan/c/src/XalanExtensions/FunctionDistinct.hpp
Index: FunctionDistinct.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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(FUNCTIONDISTINCT_HEADER_GUARD_1357924680)
#define FUNCTIONDISTINCT_HEADER_GUARD_1357924680
// Base header file. Must be first.
#include <XalanExtensions/XalanExtensionsDefinitions.hpp>
// Base class header file...
#include <XPath/Function.hpp>
/**
* XPath implementation of "difference" function.
*/
class XALAN_XALANEXTENSIONS_EXPORT FunctionDistinct : public Function
{
public:
FunctionDistinct();
virtual
~FunctionDistinct();
// These methods are inherited from Function ...
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context);
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const XObjectPtr arg3);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int opPos,
const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual FunctionDistinct*
#endif
clone() const;
private:
const XalanDOMString
getError() const;
// Not implemented...
FunctionDistinct&
operator=(const FunctionDistinct&);
bool
operator==(const FunctionDistinct&) const;
};
#endif // FUNCTIONDISTINCT_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanExtensions/FunctionEvaluate.cpp
Index: FunctionEvaluate.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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 "FunctionEvaluate.hpp"
#include <DOMSupport/PrefixResolver.hpp>
#include <XPath/XObjectFactory.hpp>
#include <XPath/XPath.hpp>
#include <XPath/XPathProcessorImpl.hpp>
FunctionEvaluate::FunctionEvaluate()
{
}
FunctionEvaluate::~FunctionEvaluate()
{
}
XObjectPtr
FunctionEvaluate::execute(
XPathExecutionContext& executionContext,
XalanNode* context)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionEvaluate::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1)
{
assert(arg1.null() == false);
const PrefixResolver* const theResolver =
executionContext.getPrefixResolver();
if (theResolver == 0)
{
executionContext.warn(
"No prefix resolver available in evaluate()!",
context);
return arg1;
}
else
{
const XalanDOMString& theString =
arg1->str();
if (length(theString) == 0)
{
return XObjectPtr(0);
}
else
{
XPathProcessorImpl theProcessor;
XPath theXPath;
theProcessor.initXPath(
theXPath,
theString,
*theResolver);
return theXPath.execute(context, *theResolver, executionContext);
}
}
}
XObjectPtr
FunctionEvaluate::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionEvaluate::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */,
const XObjectPtr /* arg3 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionEvaluate::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int /* opPos */,
const XObjectArgVectorType& /* args */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
Function*
#else
FunctionEvaluate*
#endif
FunctionEvaluate::clone() const
{
return new FunctionEvaluate(*this);
}
const XalanDOMString
FunctionEvaluate::getError() const
{
return XALAN_STATIC_UCODE_STRING(
"The evaluate() function takes one argument!");
}
1.1 xml-xalan/c/src/XalanExtensions/FunctionEvaluate.hpp
Index: FunctionEvaluate.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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(FUNCTIONEVALUATE_HEADER_GUARD_1357924680)
#define FUNCTIONEVALUATE_HEADER_GUARD_1357924680
// Base header file. Must be first.
#include <XalanExtensions/XalanExtensionsDefinitions.hpp>
// Base class header file...
#include <XPath/Function.hpp>
/**
* XPath implementation of "node-set" function.
*/
class XALAN_XALANEXTENSIONS_EXPORT FunctionEvaluate : public Function
{
public:
FunctionEvaluate();
virtual
~FunctionEvaluate();
// These methods are inherited from Function ...
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context);
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const XObjectPtr arg3);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int opPos,
const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual FunctionEvaluate*
#endif
clone() const;
private:
const XalanDOMString
getError() const;
// Not implemented...
FunctionEvaluate&
operator=(const FunctionEvaluate&);
bool
operator==(const FunctionEvaluate&) const;
};
#endif // FUNCTIONEVALUATE_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanExtensions/FunctionHasSameNodes.cpp
Index: FunctionHasSameNodes.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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 "FunctionHasSameNodes.hpp"
#include <XPath/XPathExecutionContext.hpp>
#include <XPath/XObjectFactory.hpp>
FunctionHasSameNodes::FunctionHasSameNodes()
{
}
FunctionHasSameNodes::~FunctionHasSameNodes()
{
}
XObjectPtr
FunctionHasSameNodes::execute(
XPathExecutionContext& executionContext,
XalanNode* context)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionHasSameNodes::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionHasSameNodes::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const XObjectPtr arg2)
{
const NodeRefListBase& nodeset1 = arg1->nodeset();
const NodeRefListBase& nodeset2 = arg2->nodeset();
const unsigned int theLength = nodeset1.getLength();
bool fResult = true;
if (theLength != nodeset2.getLength())
{
fResult = false;
}
else
{
for (unsigned int i = 0; i < theLength && fResult == true; ++i)
{
XalanNode* const theNode = nodeset1.item(i);
assert(theNode != 0);
if (nodeset2.indexOf(theNode) == NodeRefListBase::npos)
{
fResult = false;
}
}
}
return executionContext.getXObjectFactory().createBoolean(fResult);
}
XObjectPtr
FunctionHasSameNodes::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */,
const XObjectPtr /* arg3 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionHasSameNodes::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int /* opPos */,
const XObjectArgVectorType& /* args */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
Function*
#else
FunctionHasSameNodes*
#endif
FunctionHasSameNodes::clone() const
{
return new FunctionHasSameNodes(*this);
}
const XalanDOMString
FunctionHasSameNodes::getError() const
{
return XALAN_STATIC_UCODE_STRING(
"The has-same-nodes() function takes two arguments!");
}
1.1 xml-xalan/c/src/XalanExtensions/FunctionHasSameNodes.hpp
Index: FunctionHasSameNodes.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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(FUNCTIONHASSAMENODES_HEADER_GUARD_1357924680)
#define FUNCTIONHASSAMENODES_HEADER_GUARD_1357924680
// Base header file. Must be first.
#include <XalanExtensions/XalanExtensionsDefinitions.hpp>
// Base class header file...
#include <XPath/Function.hpp>
/**
* XPath implementation of "has-same-nodes" function for NodeSets.
*/
class XALAN_XALANEXTENSIONS_EXPORT FunctionHasSameNodes : public Function
{
public:
FunctionHasSameNodes();
virtual
~FunctionHasSameNodes();
// These methods are inherited from Function ...
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context);
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const XObjectPtr arg3);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int opPos,
const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual FunctionHasSameNodes*
#endif
clone() const;
private:
const XalanDOMString
getError() const;
// Not implemented...
FunctionHasSameNodes&
operator=(const FunctionHasSameNodes&);
bool
operator==(const FunctionHasSameNodes&) const;
};
#endif // FUNCTIONHASSAMENODES_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanExtensions/FunctionIntersection.cpp
Index: FunctionIntersection.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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 "FunctionIntersection.hpp"
#include <XPath/XPathExecutionContext.hpp>
#include <XPath/XObjectFactory.hpp>
FunctionIntersection::FunctionIntersection()
{
}
FunctionIntersection::~FunctionIntersection()
{
}
XObjectPtr
FunctionIntersection::execute(
XPathExecutionContext& executionContext,
XalanNode* context)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionIntersection::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionIntersection::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1,
const XObjectPtr arg2)
{
const NodeRefListBase& nodeset1 = arg1->nodeset();
const NodeRefListBase& nodeset2 = arg2->nodeset();
typedef XPathExecutionContext::BorrowReturnMutableNodeRefList BorrowReturnMutableNodeRefList;
BorrowReturnMutableNodeRefList theResult(executionContext);
const unsigned int theLength = nodeset1.getLength();
for (unsigned int i = 0; i < theLength; ++i)
{
XalanNode* const theNode = nodeset1.item(i);
assert(theNode != 0);
if (nodeset2.indexOf(theNode) != NodeRefListBase::npos)
{
theResult->addNode(theNode);
}
}
return executionContext.getXObjectFactory().createNodeSet(theResult);
}
XObjectPtr
FunctionIntersection::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */,
const XObjectPtr /* arg3 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionIntersection::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int /* opPos */,
const XObjectArgVectorType& /* args */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
Function*
#else
FunctionIntersection*
#endif
FunctionIntersection::clone() const
{
return new FunctionIntersection(*this);
}
const XalanDOMString
FunctionIntersection::getError() const
{
return XALAN_STATIC_UCODE_STRING(
"The intersection() function takes two arguments!");
}
1.1 xml-xalan/c/src/XalanExtensions/FunctionIntersection.hpp
Index: FunctionIntersection.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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(FUNCTIONINTERSECTION_HEADER_GUARD_1357924680)
#define FUNCTIONINTERSECTION_HEADER_GUARD_1357924680
// Base header file. Must be first.
#include <XalanExtensions/XalanExtensionsDefinitions.hpp>
// Base class header file...
#include <XPath/Function.hpp>
/**
* XPath implementation of "intersection" function for NodeSets.
*/
class XALAN_XALANEXTENSIONS_EXPORT FunctionIntersection : public Function
{
public:
FunctionIntersection();
virtual
~FunctionIntersection();
// These methods are inherited from Function ...
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context);
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const XObjectPtr arg3);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int opPos,
const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual FunctionIntersection*
#endif
clone() const;
private:
const XalanDOMString
getError() const;
// Not implemented...
FunctionIntersection&
operator=(const FunctionIntersection&);
bool
operator==(const FunctionIntersection&) const;
};
#endif // FUNCTIONINTERSECTION_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanExtensions/FunctionNodeSet.cpp
Index: FunctionNodeSet.cpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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 "FunctionNodeSet.hpp"
#include <XPath/XNodeSetBase.hpp>
#include <XPath/XObjectFactory.hpp>
class XResultTreeFragNodeSetProxy : public XNodeSetBase
{
public:
XResultTreeFragNodeSetProxy(const XObjectPtr& theXObject) :
m_xobject(theXObject),
m_proxy(*static_cast<const XResultTreeFrag*>(theXObject.get()))
{
assert(theXObject.null() == false);
assert(theXObject->getType() == XObject::eTypeResultTreeFrag);
}
XResultTreeFragNodeSetProxy(const XResultTreeFragNodeSetProxy& theSource) :
m_xobject(theSource.m_xobject),
m_proxy(*static_cast<const XResultTreeFrag*>(m_xobject.get()))
{
}
virtual
~XResultTreeFragNodeSetProxy()
{
}
// These methods are inherited from XNodeSetBase...
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual XObject*
#else
virtual XResultTreeFragNodeSetProxy*
#endif
clone(void* theAddress = 0) const
{
return theAddress == 0 ? new XResultTreeFragNodeSetProxy(*this) :
new (theAddress) XResultTreeFragNodeSetProxy(*this);
}
virtual const NodeRefListBase&
nodeset() const
{
return m_proxy;
}
virtual void
dereferenced()
{
delete this;
}
virtual XalanNode*
item(unsigned int index) const
{
return m_proxy.item(index);
}
virtual unsigned int
getLength() const
{
return m_proxy.getLength();
}
private:
const XObjectPtr m_xobject;
const XResultTreeFrag::NodeRefListBaseProxy m_proxy;
};
FunctionNodeSet::FunctionNodeSet()
{
}
FunctionNodeSet::~FunctionNodeSet()
{
}
XObjectPtr
FunctionNodeSet::execute(
XPathExecutionContext& executionContext,
XalanNode* context)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionNodeSet::execute(
XPathExecutionContext& executionContext,
XalanNode* /* context */,
const XObjectPtr arg1)
{
assert(arg1.null() == false);
if (arg1->getType() != XObject::eTypeResultTreeFrag)
{
return arg1;
}
else
{
return XObjectPtr(new XResultTreeFragNodeSetProxy(arg1));
}
}
XObjectPtr
FunctionNodeSet::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionNodeSet::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr /* arg1 */,
const XObjectPtr /* arg2 */,
const XObjectPtr /* arg3 */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
XObjectPtr
FunctionNodeSet::execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int /* opPos */,
const XObjectArgVectorType& /* args */)
{
executionContext.error(getError(), context);
return XObjectPtr(0);
}
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
Function*
#else
FunctionNodeSet*
#endif
FunctionNodeSet::clone() const
{
return new FunctionNodeSet(*this);
}
const XalanDOMString
FunctionNodeSet::getError() const
{
return XALAN_STATIC_UCODE_STRING(
"The node-set() function takes one argument!");
}
1.1 xml-xalan/c/src/XalanExtensions/FunctionNodeSet.hpp
Index: FunctionNodeSet.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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(FUNCTIONNODESET_HEADER_GUARD_1357924680)
#define FUNCTIONNODESET_HEADER_GUARD_1357924680
// Base header file. Must be first.
#include <XalanExtensions/XalanExtensionsDefinitions.hpp>
// Base class header file...
#include <XPath/Function.hpp>
#include <XPath/XResultTreeFrag.hpp>
/**
* XPath implementation of "node-set" function.
*/
class XALAN_XALANEXTENSIONS_EXPORT FunctionNodeSet : public Function
{
public:
FunctionNodeSet();
virtual
~FunctionNodeSet();
// These methods are inherited from Function ...
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context);
virtual XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
const XObjectPtr arg1,
const XObjectPtr arg2,
const XObjectPtr arg3);
XObjectPtr
execute(
XPathExecutionContext& executionContext,
XalanNode* context,
int opPos,
const XObjectArgVectorType& args);
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual Function*
#else
virtual FunctionNodeSet*
#endif
clone() const;
private:
const XalanDOMString
getError() const;
// Not implemented...
FunctionNodeSet&
operator=(const FunctionNodeSet&);
bool
operator==(const FunctionNodeSet&) const;
};
#endif // FUNCTIONNODESET_HEADER_GUARD_1357924680
1.1 xml-xalan/c/src/XalanExtensions/XalanExtensionsDefinitions.hpp
Index: XalanExtensionsDefinitions.hpp
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 2001 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(XALANEXTENSIONS_DEFINITIONS_HEADER_GUARD_1357924680)
#define XALANEXTENSIONS_DEFINITIONS_HEADER_GUARD_1357924680
#include <Include/PlatformDefinitions.hpp>
#if defined(XALAN_XALANEXTENSIONS_BUILD_DLL)
#define XALAN_XALANEXTENSIONS_EXPORT XALAN_PLATFORM_EXPORT
#define XALAN_XALANEXTENSIONS_EXPORT_FUNCTION(T) XALAN_PLATFORM_EXPORT_FUNCTION(T)
#else
#define XALAN_XALANEXTENSIONS_EXPORT XALAN_PLATFORM_IMPORT
#define XALAN_XALANEXTENSIONS_EXPORT_FUNCTION(T) XALAN_PLATFORM_IMPORT_FUNCTION(T)
#endif
#endif // XALANEXTENSIONS_DEFINITIONS_HEADER_GUARD_1357924680
---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org