dbertoni 00/08/10 11:37:57
Modified: c/src/XPath Function.hpp FunctionID.hpp
MutableNodeRefList.cpp MutableNodeRefList.hpp
NodeRefList.cpp NodeRefList.hpp NodeRefListBase.hpp
ResultTreeFrag.cpp ResultTreeFrag.hpp
ResultTreeFragBase.hpp SimpleNodeLocator.cpp
SimpleNodeLocator.hpp XBoolean.cpp XBoolean.hpp
XBooleanStatic.cpp XBooleanStatic.hpp XLocator.hpp
XNodeSet.cpp XNodeSet.hpp XNull.cpp XNull.hpp
XNumber.cpp XNumber.hpp XObject.cpp XObject.hpp
XObjectFactory.hpp XObjectFactoryDefault.cpp
XObjectFactoryDefault.hpp XObjectTypeCallback.hpp
XPath.cpp XPath.hpp XPathExecutionContext.hpp
XPathExecutionContextDefault.cpp
XPathExecutionContextDefault.hpp
XPathExpression.cpp XPathExpression.hpp
XPathFactory.hpp XPathProcessor.hpp
XPathProcessorImpl.cpp XPathProcessorImpl.hpp
XResultTreeFrag.cpp XResultTreeFrag.hpp XSpan.cpp
XSpan.hpp XString.cpp XString.hpp XUnknown.cpp
XUnknown.hpp
Log:
Made interfaces more const-correct. Reduced size of XObjects and removed
dynamically allocted XObjects from XPaths. Made some changes for new
document-ordering interfaces on XalanNode to improve performance.
Revision Changes Path
1.5 +2 -2 xml-xalan/c/src/XPath/Function.hpp
Index: Function.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/Function.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Function.hpp 2000/04/11 14:46:04 1.4
+++ Function.hpp 2000/08/10 18:37:29 1.5
@@ -89,9 +89,9 @@
}
#if defined(XALAN_NO_NAMESPACES)
- typedef vector<XObject*> XObjectArgVectorType;
+ typedef vector<const XObject*> XObjectArgVectorType;
#else
- typedef std::vector<XObject*> XObjectArgVectorType;
+ typedef std::vector<const XObject*> XObjectArgVectorType;
#endif
/**
1.10 +1 -1 xml-xalan/c/src/XPath/FunctionID.hpp
Index: FunctionID.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/FunctionID.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- FunctionID.hpp 2000/07/28 22:01:51 1.9
+++ FunctionID.hpp 2000/08/10 18:37:29 1.10
@@ -192,7 +192,7 @@
if (theNode != 0)
{
-
theNodeList->addNodeInDocOrder(theNode, true);
+
theNodeList->addNodeInDocOrder(theNode, executionContext);
}
}
}
1.15 +294 -55 xml-xalan/c/src/XPath/MutableNodeRefList.cpp
Index: MutableNodeRefList.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/MutableNodeRefList.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- MutableNodeRefList.cpp 2000/07/28 22:01:51 1.14
+++ MutableNodeRefList.cpp 2000/08/10 18:37:29 1.15
@@ -66,34 +66,32 @@
#include <XalanDOM/XalanNamedNodeMap.hpp>
+#include <XalanDOM/XalanDocument.hpp>
#include <XalanDOM/XalanNode.hpp>
#include <XalanDOM/XalanNodeList.hpp>
-#include "XPathSupport.hpp"
+#include "XPathExecutionContext.hpp"
-MutableNodeRefList::MutableNodeRefList(XPathSupport* theSupport) :
- NodeRefList(),
- m_support(theSupport)
+MutableNodeRefList::MutableNodeRefList() :
+ NodeRefList()
{
}
MutableNodeRefList::MutableNodeRefList(const MutableNodeRefList&
theSource) :
- NodeRefList(theSource),
- m_support(theSource.m_support)
+ NodeRefList(theSource)
{
}
MutableNodeRefList::MutableNodeRefList(const NodeRefListBase&
theSource) :
- NodeRefList(theSource),
- m_support(theSource.getSupport())
+ NodeRefList(theSource)
{
}
@@ -180,7 +178,7 @@
XalanNode* n,
unsigned int pos)
{
- assert(getLength() >= pos);
+ assert(m_nodeList.size() >= pos);
if (n != 0)
{
@@ -215,7 +213,7 @@
void
MutableNodeRefList::removeNode(unsigned int pos)
{
- assert(pos < getLength());
+ assert(pos < m_nodeList.size());
m_nodeList.erase(m_nodeList.begin() + pos);
}
@@ -235,7 +233,7 @@
unsigned int pos,
XalanNode* theNode)
{
- assert(pos < getLength());
+ assert(pos < m_nodeList.size());
m_nodeList[pos] = theNode;
}
@@ -250,8 +248,8 @@
// Reserve the space at the start. We may end up reserving
// more space than necessary, but it's a small price to
// pay for the increased speed. We can always shrink by
- // swapping if we have way to much space.
- ensureAllocation(getLength() + theLength);
+ // swapping if we have way too much space.
+ ensureAllocation(m_nodeList.size() + theLength);
for (unsigned int i = 0; i < theLength; i++)
{
@@ -269,8 +267,8 @@
// Reserve the space at the start. We may end up reserving
// more space than necessary, but it's a small price to
// pay for the increased speed. We can always shrink by
- // swapping if we have way to much space.
- ensureAllocation(getLength() + theLength);
+ // swapping if we have way too much space.
+ ensureAllocation(m_nodeList.size() + theLength);
for (unsigned int i = 0; i < theLength; i++)
{
@@ -281,84 +279,336 @@
void
-MutableNodeRefList::addNodesInDocOrder(const XalanNodeList&
nodelist)
+MutableNodeRefList::addNodesInDocOrder(
+ const XalanNodeList& nodelist,
+ XPathExecutionContext& executionContext)
{
const unsigned int theLength = nodelist.getLength();
// Reserve the space at the start. We may end up reserving
// more space than necessary, but it's a small price to
// pay for the increased speed. We can always shrink by
- // swapping if we have way to much space.
- ensureAllocation(getLength() + theLength);
+ // swapping if we have way too much space.
+ ensureAllocation(m_nodeList.size() + theLength);
for(unsigned int i = 0; i < theLength; i++)
{
- addNodeInDocOrder(nodelist.item(i), true);
+ addNodeInDocOrder(nodelist.item(i), executionContext);
}
}
void
-MutableNodeRefList::addNodesInDocOrder(const NodeRefListBase&
nodelist)
+MutableNodeRefList::addNodesInDocOrder(
+ const NodeRefListBase& nodelist,
+ XPathExecutionContext& executionContext)
{
const unsigned int theLength = nodelist.getLength();
// Reserve the space at the start. We may end up reserving
// more space than necessary, but it's a small price to
// pay for the increased speed. We can always shrink by
- // swapping if we have way to much space.
- ensureAllocation(getLength() + theLength);
+ // swapping if we have way too much space.
+ ensureAllocation(m_nodeList.size() + theLength);
for(unsigned int i = 0; i < theLength; i++)
{
- addNodeInDocOrder(nodelist.item(i), true);
+ addNodeInDocOrder(nodelist.item(i), executionContext);
}
}
+MutableNodeRefList::NodeListIteratorType
+findInsertionPointBinarySearch(
+ XalanNode*
node,
+ MutableNodeRefList::NodeListIteratorType begin,
+ MutableNodeRefList::NodeListIteratorType end)
+{
+ assert(node != 0);
+ assert(node->getNodeType() == XalanNode::DOCUMENT_NODE ||
+ (node->getOwnerDocument() != 0 &&
node->getOwnerDocument()->isIndexed() == true));
+
+ typedef MutableNodeRefList::NodeListIteratorType
NodeListIteratorType;
+
+ NodeListIteratorType insertionPoint = 0;
+
+ // At this point, we are guaranteed that the range is only for this
+ // document, and that the range is indexed...
+ const unsigned long theIndex = node->getIndex();
+
+ // End points to one past the last valid point,
+ // so subtract 1.
+ NodeListIteratorType last = end - 1;
+ assert(*last != 0);
+
+ // Do a quick check to see if we just need to append...
+ if ((*last)->getIndex() < theIndex)
+ {
+ insertionPoint = end;
+ }
+ else
+ {
+ // Do a binary search for the insertion point...
+ NodeListIteratorType first = begin;
+ NodeListIteratorType current = 0;
+
+ unsigned long theCurrentIndex = 0;
+
+ while (first <= last)
+ {
+ current = first + (last - first) / 2;
+ assert(*current != 0);
+
+ theCurrentIndex = (*current)->getIndex();
+
+ if (theIndex < theCurrentIndex)
+ {
+ last = current - 1;
+ }
+ else if (theIndex > theCurrentIndex)
+ {
+ first = current + 1;
+ }
+ else if (theIndex == theCurrentIndex)
+ {
+ // Duplicate, don't insert...
+ break;
+ }
+ }
+
+ if (theIndex != theCurrentIndex)
+ {
+ if (current == 0 || first == end)
+ {
+ // We either didn't search, or we're
+ // at the end...
+ insertionPoint = end;
+ }
+ else if (theCurrentIndex < theIndex)
+ {
+ // We're inserting after the current position...
+ assert((*current)->getIndex() < theIndex &&
+ (current + 1 == end || (*(current +
1))->getIndex() > theIndex));
+
+ insertionPoint = current + 1;
+ }
+ else
+ {
+ // We're inserting before the current
position...
+ assert(theCurrentIndex > theIndex);
+ assert((*current)->getIndex() > theIndex &&
+ (current == begin ||
(*(current))->getIndex() > theIndex));
+
+ insertionPoint = current;
+ }
+ }
+ }
+
+ return insertionPoint;
+}
+
+
+
+template<class PredicateType>
+MutableNodeRefList::NodeListIteratorType
+findInsertionPointLinearSearch(
+ XalanNode*
node,
+ MutableNodeRefList::NodeListIteratorType begin,
+ MutableNodeRefList::NodeListIteratorType end,
+ const PredicateType&
isNodeAfterPredicate)
+{
+ assert(node != 0);
+
+ typedef MutableNodeRefList::NodeListIteratorType
NodeListIteratorType;
+
+ NodeListIteratorType current = begin;
+
+ // Loop, looking for the node, or for a
+ // node that's before the one we're adding...
+ while(current != end)
+ {
+ const XalanNode* child = *current;
+ assert(child != 0);
+
+ if(child == node)
+ {
+ // Duplicate, don't insert...
+ current = 0;
+
+ break;
+ }
+ else if (isNodeAfterPredicate(*node, *child) == false)
+ {
+ // We found the insertion point...
+ break;
+ }
+ else
+ {
+ ++current;
+ }
+ }
+
+ return current;
+}
+
+
+
+struct DocumentPredicate
+{
+ bool
+ operator()(
+ const XalanNode& node1,
+ const XalanNode& node2) const
+ {
+ // Always order a document node, or a node from another
+ // document after another node...
+ return node1.getNodeType() == XalanNode::DOCUMENT_NODE &&
+ node2.getNodeType() == XalanNode::DOCUMENT_NODE ?
true :
+ node1.getOwnerDocument() !=
node2.getOwnerDocument() ? true : false;
+ }
+};
+
+
+
+struct IndexPredicate
+{
+ bool
+ operator()(
+ const XalanNode& node1,
+ const XalanNode& node2) const
+ {
+ assert(node1.getOwnerDocument() == node2.getOwnerDocument());
+
+ return m_documentPredicate(node1, node2) == true ? true :
node1.getIndex() > node2.getIndex() ? true : false;
+ }
+
+ DocumentPredicate m_documentPredicate;
+};
+
+
+
+
+struct ExecutionContextPredicate
+{
+ ExecutionContextPredicate(XPathExecutionContext&
executionContext) :
+ m_executionContext(executionContext)
+ {
+ }
+
+ bool
+ operator()(
+ const XalanNode& node1,
+ const XalanNode& node2) const
+ {
+ if (m_documentPredicate(node1, node2) == true)
+ {
+ return true;
+ }
+ else
+ {
+ assert(node1.getOwnerDocument() ==
node2.getOwnerDocument());
+ assert(node1.getNodeType() != XalanNode::DOCUMENT_NODE
&&
+ node2.getNodeType() !=
XalanNode::DOCUMENT_NODE);
+
+ return m_executionContext.isNodeAfter(node1, node2);
+ }
+ }
+
+ XPathExecutionContext& m_executionContext;
+
+ DocumentPredicate m_documentPredicate;
+};
+
+
+
+
void
MutableNodeRefList::addNodeInDocOrder(
- XalanNode* node,
- bool test)
+ XalanNode* node,
+ XPathExecutionContext& executionContext)
{
if (node != 0)
{
ensureAllocation();
- const unsigned int size = getLength();
+ const unsigned int size = m_nodeList.size();
- if (test == false || m_support == 0 || size == 0)
+ if (size == 0)
{
addNode(node);
}
- else if (indexOf(node) == npos)
+ else
{
- unsigned int i = size - 1;
+ assert(m_nodeList[0] != 0);
- // When wrap-around happens, i will be > than size...
- for(; i < size; i--)
+ // Do some quick optimizations, since we tend to append
+ // the same node a lot.
+ const XalanNode* const theLastNode = m_nodeList.back();
+ assert(theLastNode != 0);
+
+ // Is it a duplicate?
+ if (theLastNode != node)
{
- const XalanNode* child = m_nodeList[i];
- assert(child != 0);
+ NodeListIteratorType insertionPoint = 0;
- if(child == node)
- {
- // Duplicate, don't insert...
- i = size;
+ const XalanNode* const theFirstNode =
m_nodeList.front();
+ assert(theFirstNode != 0);
+
+ // Normalize so that if we have a document
node, it owns
+ // itself, which is not how DOM works...
+ const XalanNode* const theFirstNodeOwner =
+ theFirstNode->getNodeType() ==
XalanNode::DOCUMENT_NODE ?
+ theFirstNode :
theFirstNode->getOwnerDocument();
+ assert(theFirstNodeOwner != 0);
- break;
+ if (node->isIndexed() == true &&
+ node->getOwnerDocument() ==
theFirstNodeOwner)
+ {
+ // If it's indexed, then see if the
entire list consists of
+ // nodes from the same document.
+ // Normalize so that if we have a
document node, it owns
+ // itself, which is not how DOM works...
+ const XalanNode* const
theLastNodeOwner =
+ theLastNode->getNodeType() ==
XalanNode::DOCUMENT_NODE ?
+ theLastNode :
theLastNode->getOwnerDocument();
+ assert(theLastNodeOwner != 0);
+
+ // If the owner document is 0, then
it's a document node, so there's not
+ // much we can do except a linear
search...
+ if (theFirstNodeOwner ==
theLastNodeOwner)
+ {
+ insertionPoint =
+
findInsertionPointBinarySearch(
+ node,
+
m_nodeList.begin(),
+
m_nodeList.end());
+ }
+ else
+ {
+ insertionPoint =
+
findInsertionPointLinearSearch(
+ node,
+
m_nodeList.begin(),
+
m_nodeList.end(),
+
IndexPredicate());
+ }
}
- else if (m_support->isNodeAfter(*node, *child)
== false)
+ else
{
- break;
+ insertionPoint =
+
findInsertionPointLinearSearch(
+ node,
+
m_nodeList.begin(),
+
m_nodeList.end(),
+
ExecutionContextPredicate(executionContext));
}
- }
- if (i != size)
- {
- insertNode(node, i + 1);
+ if (insertionPoint != 0)
+ {
+ m_nodeList.insert(insertionPoint, node);
+ }
}
}
}
@@ -410,14 +660,6 @@
-XPathSupport*
-MutableNodeRefList::getSupport() const
-{
- return m_support;
-}
-
-
-
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
NodeRefListBase*
#else
@@ -427,6 +669,3 @@
{
return new MutableNodeRefList(*this);
}
-
-
-
1.11 +25 -25 xml-xalan/c/src/XPath/MutableNodeRefList.hpp
Index: MutableNodeRefList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/MutableNodeRefList.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- MutableNodeRefList.hpp 2000/07/28 22:01:51 1.10
+++ MutableNodeRefList.hpp 2000/08/10 18:37:29 1.11
@@ -68,7 +68,8 @@
-class XPathSupport;
+class XPathExecutionContext;
+class XalanDocument;
class XalanNodeList;
@@ -83,11 +84,9 @@
/**
* Construct an empty mutable node list.
- *
- * @param theSupport XPath support class instance
*/
explicit
- MutableNodeRefList(XPathSupport* theSupport = 0);
+ MutableNodeRefList();
/**
* Construct a mutable node list from another list.
@@ -124,7 +123,7 @@
*
* @param n node to add
*/
- virtual void
+ void
addNode(XalanNode* n);
/**
@@ -133,7 +132,7 @@
* @param n node to insert
* @param pos position of insertion
*/
- virtual void
+ void
insertNode(
XalanNode* n,
unsigned int pos);
@@ -143,7 +142,7 @@
*
* @param n node to insert
*/
- virtual void
+ void
removeNode(const XalanNode* n);
/**
@@ -151,13 +150,13 @@
*
* @param pos position of node in list
*/
- virtual void
+ void
removeNode(unsigned int pos);
/**
* Remove all nodes.
*/
- virtual void
+ void
clear();
/**
@@ -166,7 +165,7 @@
* @param pos position of node to modify
* @param n node to insert, default is empty node
*/
- virtual void
+ void
setNode(unsigned int pos,
XalanNode* n = 0);
@@ -176,7 +175,7 @@
*
* @param nodelist node list to add
*/
- virtual void
+ void
addNodes(const XalanNodeList& nodelist);
/**
@@ -185,55 +184,56 @@
*
* @param nodelist node list to add
*/
- virtual void
+ void
addNodes(const NodeRefListBase& nodelist);
/**
* Copy NodeList members into this nodelist, adding in document order.
*
* @param nodelist node list to add
+ * @param executionContext the current execution context
*/
virtual void
- addNodesInDocOrder(const XalanNodeList& nodelist);
+ addNodesInDocOrder(
+ const XalanNodeList& nodelist,
+ XPathExecutionContext& executionContext);
/**
* Copy NodeList members into this nodelist, adding in document order.
*
* @param nodelist node list to add
+ * @param executionContext the current execution context
*/
virtual void
- addNodesInDocOrder(const NodeRefListBase& nodelist);
+ addNodesInDocOrder(
+ const NodeRefListBase& nodelist,
+ XPathExecutionContext& executionContext);
/**
* Add a node into list where it should occur in document order.
*
* @param node node object to add
- * @param test true if we should test for doc order
+ * @param executionContext the current execution context
*/
virtual void
addNodeInDocOrder(
- XalanNode* node,
- bool test);
+ XalanNode* node,
+ XPathExecutionContext& executionContext);
/**
- * Clear any null entrees in the node list.
+ * Clear any null entries in the node list.
*/
- virtual void
+ void
clearNulls();
- virtual XPathSupport*
- getSupport() const;
-
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual NodeRefListBase*
#else
virtual MutableNodeRefList*
#endif
clone() const;
-
-private:
- XPathSupport* m_support;
+ typedef NodeListVectorType::iterator NodeListIteratorType;
};
1.9 +0 -8 xml-xalan/c/src/XPath/NodeRefList.cpp
Index: NodeRefList.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefList.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- NodeRefList.cpp 2000/07/28 22:01:52 1.8
+++ NodeRefList.cpp 2000/08/10 18:37:30 1.9
@@ -183,14 +183,6 @@
-XPathSupport*
-NodeRefList::getSupport() const
-{
- return 0;
-}
-
-
-
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
NodeRefListBase*
#else
1.10 +0 -3 xml-xalan/c/src/XPath/NodeRefList.hpp
Index: NodeRefList.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefList.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- NodeRefList.hpp 2000/07/28 22:01:52 1.9
+++ NodeRefList.hpp 2000/08/10 18:37:30 1.10
@@ -119,9 +119,6 @@
virtual unsigned int
indexOf(const XalanNode* theNode) const;
- virtual XPathSupport*
- getSupport() const;
-
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual NodeRefListBase*
#else
1.7 +0 -3 xml-xalan/c/src/XPath/NodeRefListBase.hpp
Index: NodeRefListBase.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/NodeRefListBase.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- NodeRefListBase.hpp 2000/07/28 22:01:52 1.6
+++ NodeRefListBase.hpp 2000/08/10 18:37:30 1.7
@@ -119,9 +119,6 @@
virtual unsigned int
indexOf(const XalanNode* theNode) const = 0;
- virtual XPathSupport*
- getSupport() const = 0;
-
virtual NodeRefListBase*
clone() const = 0;
1.9 +129 -35 xml-xalan/c/src/XPath/ResultTreeFrag.cpp
Index: ResultTreeFrag.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFrag.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ResultTreeFrag.cpp 2000/07/27 20:35:23 1.8
+++ ResultTreeFrag.cpp 2000/08/10 18:37:30 1.9
@@ -59,17 +59,19 @@
+#include <algorithm>
#include <cassert>
-ResultTreeFrag::ResultTreeFrag(
- XalanDocument& theOwnerDocument,
- XPathSupport& theSupport) :
+#include <DOMSupport/DOMServices.hpp>
+
+
+
+ResultTreeFrag::ResultTreeFrag(XalanDocument& theOwnerDocument) :
ResultTreeFragBase(),
- m_document(&theOwnerDocument),
- m_children(&theSupport),
- m_surrogate(m_children)
+ XalanNodeList(),
+ m_document(&theOwnerDocument)
{
}
@@ -78,17 +80,21 @@
ResultTreeFrag::ResultTreeFrag(const ResultTreeFrag& theSource,
bool
deepClone) :
ResultTreeFragBase(theSource),
+ XalanNodeList(),
m_document(theSource.m_document),
- m_children(deepClone == false ? theSource.m_children :
MutableNodeRefList()),
- m_surrogate(m_children)
+ m_children(deepClone == false ? theSource.m_children : NodeVectorType())
{
if (deepClone == true)
{
- const int theLength = theSource.m_children.getLength();
+ const unsigned int theLength = theSource.m_children.size();
+
+ m_children.reserve(theLength);
- for (int i = 0; i < theLength; i++)
+ for (unsigned int i = 0; i < theLength; ++i)
{
-
m_children.addNode(theSource.m_children.item(i)->cloneNode(true));
+ assert(theSource.m_children[i] != 0);
+
+
m_children.push_back(theSource.m_children[i]->cloneNode(true));
}
}
}
@@ -136,7 +142,7 @@
const XalanNodeList*
ResultTreeFrag::getChildNodes() const
{
- return &m_surrogate;
+ return this;
}
@@ -144,7 +150,7 @@
XalanNode*
ResultTreeFrag::getFirstChild() const
{
- return m_children.getLength() == 0 ? 0 : m_children.item(0);
+ return m_children.size() == 0 ? 0 : m_children[0];
}
@@ -152,10 +158,10 @@
XalanNode*
ResultTreeFrag::getLastChild() const
{
- const unsigned int theLength = m_children.getLength();
+ const unsigned int theLength = m_children.size();
- return theLength == 0 ? 0 : m_children.item(theLength - 1);
+ return theLength == 0 ? 0 : m_children.back();
}
@@ -214,12 +220,19 @@
XalanNode* newChild,
XalanNode* refChild)
{
- const unsigned int refIndex = 0 == refChild ?
m_children.getLength() :
-
m_children.indexOf(refChild);
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find;
+#endif
+
+ const NodeVectorType::iterator i =
+ 0 == refChild ? m_children.end() :
+ find(m_children.begin(),
+ m_children.end(),
+ refChild);
- assert(refIndex != m_children.npos);
+ assert(0 == refChild || i != m_children.end());
- m_children.insertNode(newChild, refIndex);
+ m_children.insert(i, newChild);
return newChild;
}
@@ -233,21 +246,49 @@
{
assert(newChild != 0);
- const unsigned int refIndex =
- 0 == oldChild ? m_children.npos : m_children.indexOf(oldChild);
-
- if(refIndex != m_children.npos)
- {
- const unsigned int newChildIndex =
m_children.indexOf(newChild);
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find;
+#endif
- // Set the new child first, then erase it from
- // the old position. if it's there.
- m_children.setNode(refIndex, newChild);
+ // Look for the old child...
+ NodeVectorType::iterator i =
+ 0 == oldChild ? m_children.end() :
+ find(m_children.begin(),
+ m_children.end(),
+ oldChild);
- if(newChildIndex != m_children.npos)
+ // Did we find it?
+ if(i != m_children.end())
+ {
+ // First, look for an occurrence of the
+ // new child, because we'll have to remove
+ // it if it's there...
+ const NodeVectorType::iterator j =
+ find(m_children.begin(),
+ m_children.end(),
+ newChild);
+
+ // OK, if the newChild is already in the list,
+ // and it's after the new position, then we
+ // can just erase and set the newChild. If it's
+ // not, then we have to erase and set the new
+ // child at the previous iterator position, since
+ // we've erased a node from the vector, and the indices
+ // are now off...
+ if(j != m_children.end())
{
- m_children.removeNode(newChildIndex);
+ if (j < i)
+ {
+ // It's less, so decrement...
+ --i;
+ }
+
+ m_children.erase(j);
}
+
+ assert((*i) == oldChild);
+
+ (*i) = newChild;
}
return oldChild;
@@ -260,8 +301,7 @@
{
assert(newChild != 0);
- m_children.addNode(newChild);
- assert(m_children.item(m_children.getLength() - 1) == newChild);
+ m_children.push_back(newChild);
return newChild;
}
@@ -271,8 +311,17 @@
XalanNode*
ResultTreeFrag::removeChild(XalanNode* oldChild)
{
- m_children.removeNode(oldChild);
- assert(m_children.indexOf(oldChild) == m_children.npos);
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::find;
+#endif
+
+ // Look for the old child...
+ const NodeVectorType::iterator i =
+ find(m_children.begin(),
+ m_children.end(),
+ oldChild);
+
+ m_children.erase(i);
return oldChild;
}
@@ -281,7 +330,7 @@
bool
ResultTreeFrag::hasChildNodes() const
{
- return m_children.getLength() > 0 ? true : false;
+ return m_children.size() > 0 ? true : false;
}
@@ -317,6 +366,7 @@
}
+
XalanDOMString
ResultTreeFrag::getPrefix() const
{
@@ -324,6 +374,7 @@
}
+
XalanDOMString
ResultTreeFrag::getLocalName() const
{
@@ -331,6 +382,7 @@
}
+
void
ResultTreeFrag::setPrefix(const XalanDOMString& /* prefix */)
{
@@ -338,6 +390,30 @@
+bool
+ResultTreeFrag::isIndexed() const
+{
+ return false;
+}
+
+
+
+unsigned long
+ResultTreeFrag::getIndex() const
+{
+ return 0;
+}
+
+
+
+XalanDOMString
+ResultTreeFrag::getXSLTData() const
+{
+ return DOMServices::getNodeData(*this);
+}
+
+
+
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
ResultTreeFragBase*
#else
@@ -346,4 +422,22 @@
ResultTreeFrag::clone(bool deep) const
{
return new ResultTreeFrag(*this, deep);
+}
+
+
+
+XalanNode*
+ResultTreeFrag::item(unsigned int index) const
+{
+ assert(index < m_children.size());
+
+ return m_children[index];
+}
+
+
+
+unsigned int
+ResultTreeFrag::getLength() const
+{
+ return m_children.size();
}
1.9 +31 -10 xml-xalan/c/src/XPath/ResultTreeFrag.hpp
Index: ResultTreeFrag.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFrag.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- ResultTreeFrag.hpp 2000/07/21 19:50:02 1.8
+++ ResultTreeFrag.hpp 2000/08/10 18:37:31 1.9
@@ -64,12 +64,15 @@
+#include <vector>
+
+
+
+#include <XalanDOM/XalanNodeList.hpp>
#include <XalanDOM/XalanDocument.hpp>
-#include <XPath/MutableNodeRefList.hpp>
-#include <XPath/NodeListImplSurrogate.hpp>
#include <XPath/ResultTreeFragBase.hpp>
@@ -81,7 +84,7 @@
/**
* The holder of result tree fragments.
*/
-class XALAN_XPATH_EXPORT ResultTreeFrag : public ResultTreeFragBase
+class XALAN_XPATH_EXPORT ResultTreeFrag : public ResultTreeFragBase, private
XalanNodeList
{
public:
@@ -89,11 +92,8 @@
* Construct a result tree fragment object from a DOM document.
*
* @param theOwnerDocument The document used to construct result tree
fragment
- * @param theSupport The XPathSupport instance
*/
- ResultTreeFrag(
- XalanDocument& theOwnerDocument,
- XPathSupport& theSupport);
+ ResultTreeFrag(XalanDocument& theOwnerDocument);
/**
* Construct a result tree fragment object from another.
@@ -191,6 +191,14 @@
virtual void
setPrefix(const XalanDOMString& prefix);
+ virtual bool
+ isIndexed() const;
+
+ virtual unsigned long
+ getIndex() const;
+
+ virtual XalanDOMString
+ getXSLTData() const;
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
virtual ResultTreeFragBase*
@@ -201,6 +209,14 @@
private:
+ // These methods are inherited from XalanNodeList...
+
+ virtual XalanNode*
+ item(unsigned int index) const;
+
+ virtual unsigned int
+ getLength() const;
+
// Not defined
ResultTreeFrag&
operator=(const ResultTreeFrag& theRHS);
@@ -209,10 +225,15 @@
operator==(const ResultTreeFrag& theRHS) const;
- XalanDocument* m_document;
- MutableNodeRefList m_children;
+ XalanDocument* m_document;
+
+#if defined(XALAN_NO_NAMESPACES)
+ typedef vector<XalanNode*> NodeVectorType;
+#else
+ typedef std::vector<XalanNode*> NodeVectorType;
+#endif
- NodeListImplSurrogate m_surrogate;
+ NodeVectorType m_children;
};
1.8 +9 -0 xml-xalan/c/src/XPath/ResultTreeFragBase.hpp
Index: ResultTreeFragBase.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/ResultTreeFragBase.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- ResultTreeFragBase.hpp 2000/04/20 16:29:20 1.7
+++ ResultTreeFragBase.hpp 2000/08/10 18:37:31 1.8
@@ -182,6 +182,15 @@
virtual void
setPrefix(const XalanDOMString& prefix) = 0;
+ virtual bool
+ isIndexed() const = 0;
+
+ virtual unsigned long
+ getIndex() const = 0;
+
+ virtual XalanDOMString
+ getXSLTData() const = 0;
+
virtual ResultTreeFragBase*
clone(bool deep) const = 0;
1.20 +47 -32 xml-xalan/c/src/XPath/SimpleNodeLocator.cpp
Index: SimpleNodeLocator.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/SimpleNodeLocator.cpp,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- SimpleNodeLocator.cpp 2000/07/28 22:01:52 1.19
+++ SimpleNodeLocator.cpp 2000/08/10 18:37:31 1.20
@@ -108,7 +108,7 @@
-XObject*
+const XObject*
SimpleNodeLocator::connectToNodes(
const XPath& /*
xpath */,
XPathExecutionContext&
executionContext,
@@ -205,7 +205,7 @@
-XObject*
+const XObject*
SimpleNodeLocator::locationPath(
const XPath& xpath,
XPathExecutionContext& executionContext,
@@ -382,13 +382,16 @@
step(xpath, executionContext, node, opPos,
*mnl);
- if(queryResults.getLength() == 0)
+ if (mnl->getLength() > 0)
{
- queryResults = *mnl;
- }
- else
- {
- queryResults.addNodesInDocOrder(*mnl);
+ if(queryResults.getLength() == 0)
+ {
+ queryResults = *mnl;
+ }
+ else
+ {
+
queryResults.addNodesInDocOrder(*mnl, executionContext);
+ }
}
}
}
@@ -397,7 +400,7 @@
{
if (shouldReorder == true)
{
- queryResults.addNodesInDocOrder(*subQueryResults);
+ queryResults.addNodesInDocOrder(*subQueryResults,
executionContext);
}
else
{
@@ -626,7 +629,7 @@
if(XObject::eTypeNumber == pred->getType())
{
- throw FoundIndex();
+ score = handleFoundIndex(xpath,
executionContext, localContext, startOpPos);
}
else if(pred->boolean() == false)
{
@@ -643,40 +646,52 @@
}
catch(const FoundIndex&)
{
+ score = handleFoundIndex(xpath, executionContext,
localContext, startOpPos);
+ }
+ }
+
+ if (scoreHolder == xpath.s_MatchScoreNone ||
+ score == xpath.s_MatchScoreNone)
+ {
+ scoreHolder = score;
+ }
+
+ return score == xpath.s_MatchScoreNone ? 0 : localContext;
+}
+
+
+
+double
+SimpleNodeLocator::handleFoundIndex(
+ const XPath& xpath,
+ XPathExecutionContext& executionContext,
+ XalanNode* localContext,
+ int startOpPos)
+{
// We have an index somewhere in our pattern. So, we
have
// to do a full search for our step, using the parent
as
// localContext, then see if the current localContext
is found in the
// node set. Seems crazy, but, so far, it seems like
the
// easiest way.
- executionContext.setThrowFoundIndex(false);
+ executionContext.setThrowFoundIndex(false);
- XalanNode* const parentContext =
+ XalanNode* const parentContext =
executionContext.getParentOfNode(*localContext);
- typedef
XPathExecutionContext::BorrowReturnMutableNodeRefList
BorrowReturnMutableNodeRefList;
+ typedef XPathExecutionContext::BorrowReturnMutableNodeRefList
BorrowReturnMutableNodeRefList;
- BorrowReturnMutableNodeRefList mnl(executionContext);
+ BorrowReturnMutableNodeRefList mnl(executionContext);
- step(xpath, executionContext, parentContext,
startOpPos, *mnl);
+ step(xpath, executionContext, parentContext, startOpPos, *mnl);
- if (mnl->indexOf(localContext) ==
MutableNodeRefList::npos)
- {
- score = xpath.s_MatchScoreNone;
- }
- else
- {
- score = xpath.s_MatchScoreOther;
- }
- }
+ if (mnl->indexOf(localContext) == MutableNodeRefList::npos)
+ {
+ return XPath::s_MatchScoreNone;
}
-
- if (scoreHolder == xpath.s_MatchScoreNone ||
- score == xpath.s_MatchScoreNone)
+ else
{
- scoreHolder = score;
+ return XPath::s_MatchScoreOther;
}
-
- return score == xpath.s_MatchScoreNone ? 0 : localContext;
}
@@ -1139,7 +1154,7 @@
if(xpath.s_MatchScoreNone != score)
{
- subQueryResults.addNodeInDocOrder(pos, true);
+ subQueryResults.addNodeInDocOrder(pos,
executionContext);
}
nextNode = pos->getFirstChild();
@@ -1714,7 +1729,7 @@
i + 1 != pred->num() ||
pred->boolean() == false)
{
- // Set the node to null. Later on,
+ // Set the node to 0. After we're done,
// we'll clear it out.
subQueryResults.setNode(i, 0);
}
1.8 +9 -2 xml-xalan/c/src/XPath/SimpleNodeLocator.hpp
Index: SimpleNodeLocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/SimpleNodeLocator.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- SimpleNodeLocator.hpp 2000/06/07 18:16:01 1.7
+++ SimpleNodeLocator.hpp 2000/08/10 18:37:31 1.8
@@ -98,7 +98,7 @@
// These methods are inherited from XLocator ...
- virtual XObject*
+ virtual const XObject*
connectToNodes(
const XPath& xpath,
XPathExecutionContext&
executionContext,
@@ -106,7 +106,7 @@
int
opPos,
const ConnectArgsVectorType& connectArgs);
- virtual XObject*
+ virtual const XObject*
locationPath(
const XPath& xpath,
XPathExecutionContext& executionContext,
@@ -298,6 +298,13 @@
int opPos,
MutableNodeRefList& subQueryResults,
int&
endPredicatesPos);
+
+ double
+ handleFoundIndex(
+ const XPath& xpath,
+ XPathExecutionContext& executionContext,
+ XalanNode* localContext,
+ int startOpPos);
private:
1.7 +2 -57 xml-xalan/c/src/XPath/XBoolean.cpp
Index: XBoolean.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBoolean.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XBoolean.cpp 2000/07/28 22:01:52 1.6
+++ XBoolean.cpp 2000/08/10 18:37:31 1.7
@@ -67,28 +67,14 @@
-XBoolean::XBoolean(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- bool val) :
- XObject(&envSupport, &support),
+XBoolean::XBoolean(bool val) :
+ XObject(),
m_value(val)
{
}
-XBoolean::XBoolean(
- XPathEnvSupport* envSupport,
- XPathSupport* support,
- bool val) :
- XObject(envSupport, support),
- m_value(val)
-{
-}
-
-
-
XBoolean::XBoolean(const XBoolean& source) :
XObject(source),
m_value(source.m_value)
@@ -152,47 +138,6 @@
{
return m_value == true ? XALAN_STATIC_UCODE_STRING("true") :
XALAN_STATIC_UCODE_STRING("false");
-}
-
-
-
-// dummy object for casts after throw statements.
-static int dummy;
-
-
-
-const ResultTreeFragBase&
-XBoolean::rtree() const
-{
- error("Can't cast XBoolean to ResultTreeFragBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return reinterpret_cast<ResultTreeFragBase&>(dummy);
-}
-
-
-
-ResultTreeFragBase&
-XBoolean::rtree()
-{
- error("Can't cast XBoolean to ResultTreeFragBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return reinterpret_cast<ResultTreeFragBase&>(dummy);
-}
-
-
-
-const NodeRefListBase&
-XBoolean::nodeset() const
-{
- error("Can't cast XBoolean to NodeRefListBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return reinterpret_cast<NodeRefListBase&>(dummy);
}
1.8 +4 -25 xml-xalan/c/src/XPath/XBoolean.hpp
Index: XBoolean.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBoolean.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XBoolean.hpp 2000/07/28 22:01:53 1.7
+++ XBoolean.hpp 2000/08/10 18:37:32 1.8
@@ -76,17 +76,15 @@
/**
* Construct an XBoolean object from a boolean value
*
- * @param support XPath support class instance
- * @param envSupport XPath environment support class instance
* @param val boolean value to initialize object
*/
- XBoolean(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- bool val);
+ XBoolean(bool val);
XBoolean(const XBoolean& source);
+ virtual
+ ~XBoolean();
+
// These methods are inherited from XObject ...
#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
@@ -111,30 +109,11 @@
virtual XalanDOMString
str() const;
- virtual const ResultTreeFragBase&
- rtree() const;
-
- virtual ResultTreeFragBase&
- rtree();
-
- virtual const NodeRefListBase&
- nodeset() const;
-
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject);
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject) const;
-
-protected:
-
- virtual
- ~XBoolean();
-
- XBoolean(
- XPathEnvSupport* envSupport,
- XPathSupport* support,
- bool val);
private:
1.4 +0 -8 xml-xalan/c/src/XPath/XBooleanStatic.cpp
Index: XBooleanStatic.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBooleanStatic.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XBooleanStatic.cpp 2000/05/03 21:21:14 1.3
+++ XBooleanStatic.cpp 2000/08/10 18:37:32 1.4
@@ -82,11 +82,3 @@
XBooleanStatic::~XBooleanStatic()
{
}
-
-
-
-void
-XBooleanStatic::error(const XalanDOMString& msg) const
-{
- throw XPathException(msg);
-}
1.4 +0 -7 xml-xalan/c/src/XPath/XBooleanStatic.hpp
Index: XBooleanStatic.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XBooleanStatic.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XBooleanStatic.hpp 2000/04/11 14:46:12 1.3
+++ XBooleanStatic.hpp 2000/08/10 18:37:32 1.4
@@ -85,13 +85,6 @@
virtual
~XBooleanStatic();
-protected:
-
- // We have to override this because there is not XPathEnvSupport
- // for this class, so an error always throws an exception.
- virtual void
- error(const XalanDOMString& msg) const;
-
private:
};
1.6 +2 -2 xml-xalan/c/src/XPath/XLocator.hpp
Index: XLocator.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XLocator.hpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XLocator.hpp 2000/04/11 14:46:12 1.5
+++ XLocator.hpp 2000/08/10 18:37:32 1.6
@@ -106,7 +106,7 @@
* function
* @return pointer to result of the query in an XObject
*/
- virtual XObject*
+ virtual const XObject*
connectToNodes(
const XPath& xpath,
XPathExecutionContext&
executionContext,
@@ -125,7 +125,7 @@
* @param opPos current position in the xpath.m_opMap array
* @return result of the query in a pointer to an XObject
*/
- virtual XObject*
+ virtual const XObject*
locationPath(
const XPath& xpath,
XPathExecutionContext& executionContext,
1.12 +14 -77 xml-xalan/c/src/XPath/XNodeSet.cpp
Index: XNodeSet.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNodeSet.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XNodeSet.cpp 2000/07/28 22:01:53 1.11
+++ XNodeSet.cpp 2000/08/10 18:37:33 1.12
@@ -71,16 +71,12 @@
#include "ResultTreeFrag.hpp"
#include "MutableNodeRefList.hpp"
#include "XObjectTypeCallback.hpp"
-#include "XPathEnvSupport.hpp"
-#include "XPathSupport.hpp"
+#include "XPathExecutionContext.hpp"
-XNodeSet::XNodeSet(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- NodeRefListBase* value) :
- XObject(&envSupport, &support),
+XNodeSet::XNodeSet(NodeRefListBase* value) :
+ XObject(),
m_value(value == 0 ? new NodeRefList : value),
m_cachedStringValue(),
m_cachedNumberValue(0.0),
@@ -91,32 +87,14 @@
-#if 0
-XNodeSet::XNodeSet(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const MutableNodeRefList& value) :
- XObject(&envSupport, &support),
- m_value(value),
- m_resultTreeFrag(),
- m_cachedStringValue(),
- m_cachedNumberValue(0.0)
-{
-}
-#endif
-
-
-
MutableNodeRefList*
-createNodeListWithNode(
- XPathSupport& support,
- XalanNode* node)
+createNodeListWithNode(XalanNode* node)
{
#if !defined(XALAN_NO_NAMESPACES)
using std::auto_ptr;
#endif
- auto_ptr<MutableNodeRefList> resultNodeList(new
MutableNodeRefList(&support));
+ auto_ptr<MutableNodeRefList> resultNodeList(new MutableNodeRefList);
resultNodeList->addNode(node);
@@ -125,12 +103,9 @@
-XNodeSet::XNodeSet(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- XalanNode& value) :
- XObject(&envSupport, &support),
- m_value(createNodeListWithNode(support, &value)),
+XNodeSet::XNodeSet(XalanNode& value) :
+ XObject(),
+ m_value(createNodeListWithNode(&value)),
m_resultTreeFrag(),
m_cachedStringValue(),
m_cachedNumberValue(0.0)
@@ -215,8 +190,6 @@
XalanDOMString
XNodeSet::str() const
{
- assert(m_support != 0);
-
if (isEmpty(m_cachedStringValue) == true &&
m_value->getLength() > 0)
{
@@ -237,9 +210,9 @@
else
{
#if defined(XALAN_NO_MUTABLE)
- ((XNodeSet*)this)->m_cachedStringValue =
m_support->getNodeData(*theNode);
+ ((XNodeSet*)this)->m_cachedStringValue =
theNode->getXSLTData();
#else
- m_cachedStringValue = m_support->getNodeData(*theNode);
+ m_cachedStringValue = theNode->getXSLTData();
#endif
}
}
@@ -256,18 +229,15 @@
const ResultTreeFragBase&
-XNodeSet::rtree() const
+XNodeSet::rtree(XPathExecutionContext& executionContext) const
{
- assert(m_support != 0);
- assert(m_envSupport != 0);
-
if (m_resultTreeFrag.get() == 0)
{
- assert(m_envSupport->getDOMFactory() != 0);
+ XalanDocument* const theFactory =
executionContext.getDOMFactory();
+ assert(theFactory != 0);
ResultTreeFrag* const theFrag =
- new ResultTreeFrag(*m_envSupport->getDOMFactory(),
- *m_support);
+ new ResultTreeFrag(*theFactory);
const int nNodes = m_value->getLength();
@@ -289,39 +259,6 @@
m_resultTreeFrag.reset(theFrag);
#endif
#endif
- }
-
- return *m_resultTreeFrag.get();
-}
-
-
-
-ResultTreeFragBase&
-XNodeSet::rtree()
-{
- assert(m_support != 0);
- assert(m_envSupport != 0);
-
- if (m_resultTreeFrag.get() == 0)
- {
- assert(m_envSupport->getDOMFactory() != 0);
-
- ResultTreeFrag* const theFrag =
- new ResultTreeFrag(*m_envSupport->getDOMFactory(),
- *m_support);
-
-#if defined(XALAN_OLD_AUTO_PTR)
- m_resultTreeFrag = auto_ptr<ResultTreeFragBase>(theFrag);
-#else
- m_resultTreeFrag.reset(theFrag);
-#endif
-
- const int nNodes = m_value->getLength();
-
- for(int i = 0; i < nNodes; i++)
- {
-
m_resultTreeFrag->appendChild(m_value->item(i)->cloneNode(true));
- }
}
return *m_resultTreeFrag.get();
1.12 +4 -19 xml-xalan/c/src/XPath/XNodeSet.hpp
Index: XNodeSet.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNodeSet.hpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XNodeSet.hpp 2000/07/28 22:01:53 1.11
+++ XNodeSet.hpp 2000/08/10 18:37:33 1.12
@@ -73,9 +73,6 @@
-class NodeRefListBase;
-class ResultTreeFragBase;
-class XPathSupport;
class XalanNode;
@@ -90,26 +87,16 @@
/**
* Create an XNodeSet from a node list.
*
- * @param envSupport XPath environment support class instance
- * @param support XPath support class instance
* @param value Pointer to source node list. The XNodeSet will adopt
the pointer.
*/
- XNodeSet(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- NodeRefListBase* value = 0);
+ XNodeSet(NodeRefListBase* value);
/**
* Create an XNodeSet from a node.
*
- * @param envSupport XPath environment support class instance
- * @param support XPath support class instance
* @param value source node
*/
- XNodeSet(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- XalanNode& value);
+ XNodeSet(XalanNode& value);
/**
* Create an XNodeSet from another.
@@ -149,11 +136,8 @@
str() const;
virtual const ResultTreeFragBase&
- rtree() const;
+ rtree(XPathExecutionContext& executionContext) const;
- virtual ResultTreeFragBase&
- rtree();
-
virtual const NodeRefListBase&
nodeset() const;
@@ -170,6 +154,7 @@
operator=(const XNodeSet&);
// Data members...
+
#if defined(XALAN_NO_NAMESPACES)
auto_ptr<NodeRefListBase> m_value;
1.7 +4 -45 xml-xalan/c/src/XPath/XNull.cpp
Index: XNull.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNull.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XNull.cpp 2000/07/28 22:01:54 1.6
+++ XNull.cpp 2000/08/10 18:37:33 1.7
@@ -59,32 +59,19 @@
-#include "ResultTreeFrag.hpp"
#include "XObjectTypeCallback.hpp"
-#include "XPathEnvSupport.hpp"
-XNull::XNull(
- XPathEnvSupport& envSupport,
- XPathSupport& support) :
- XObject(&envSupport, &support),
- m_resultTreeFrag(new ResultTreeFrag(*envSupport.getDOMFactory(),
-
support))
+XNull::XNull() :
+ XObject()
{
}
-XNull::XNull(
- const XNull& source,
- bool deepClone) :
- XObject(source),
-#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
-
m_resultTreeFrag(static_cast<ResultTreeFragBase*>(source.m_resultTreeFrag->cloneNode(deepClone)))
-#else
- m_resultTreeFrag(source.m_resultTreeFrag->clone(deepClone))
-#endif
+XNull::XNull(const XNull& source) :
+ XObject(source)
{
}
@@ -144,34 +131,6 @@
XNull::str() const
{
return XalanDOMString();
-}
-
-
-
-const ResultTreeFragBase&
-XNull::rtree() const
-{
- return *m_resultTreeFrag.get();
-}
-
-
-
-ResultTreeFragBase&
-XNull::rtree()
-{
- return *m_resultTreeFrag.get();
-}
-
-
-
-const NodeRefListBase&
-XNull::nodeset() const
-{
- error("Can't cast XNull to NodeRefListBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<NodeRefListBase*>(0);
}
1.9 +4 -36 xml-xalan/c/src/XPath/XNull.hpp
Index: XNull.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNull.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XNull.hpp 2000/07/28 22:01:54 1.8
+++ XNull.hpp 2000/08/10 18:37:33 1.9
@@ -64,27 +64,11 @@
-#include <memory>
-
-
-
-#include <XalanDOM/XalanDOMString.hpp>
-
-
-
// Base class header file.
#include <XPath/XObject.hpp>
-#include <XPath/ResultTreeFragBase.hpp>
-
-
-
-class XPathSupport;
-
-
-
class XALAN_XPATH_EXPORT XNull : public XObject
{
public:
@@ -92,12 +76,9 @@
/**
* Create an XNull.
*
- * @param envSupport XPath environment support class instance
- * @param support XPath support class instance
*/
- XNull(
- XPathEnvSupport& envSupport,
- XPathSupport& support);
+ explicit
+ XNull();
/**
* Create an XNull from another.
@@ -105,9 +86,7 @@
* @param source object to copy
* @param deepClone true to copy all children on nodeset nodes
*/
- XNull(
- const XNull& source,
- bool deepClone = false);
+ XNull(const XNull& source);
virtual
~XNull();
@@ -126,7 +105,7 @@
virtual XalanDOMString
getTypeString() const;
-
+
virtual double
num() const;
@@ -136,15 +115,6 @@
virtual XalanDOMString
str() const;
- virtual const ResultTreeFragBase&
- rtree() const;
-
- virtual ResultTreeFragBase&
- rtree();
-
- virtual const NodeRefListBase&
- nodeset() const;
-
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject);
@@ -152,8 +122,6 @@
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject) const;
private:
-
- const std::auto_ptr<ResultTreeFragBase> m_resultTreeFrag;
// not implemented
XNull& operator=(const XNull &);
1.9 +2 -41 xml-xalan/c/src/XPath/XNumber.cpp
Index: XNumber.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNumber.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XNumber.cpp 2000/07/28 22:01:54 1.8
+++ XNumber.cpp 2000/08/10 18:37:34 1.9
@@ -68,11 +68,8 @@
-XNumber::XNumber(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- double val) :
- XObject(&envSupport, &support),
+XNumber::XNumber(double val) :
+ XObject(),
m_value(val),
m_cachedStringValue()
{
@@ -152,42 +149,6 @@
}
return m_cachedStringValue;
-}
-
-
-
-const ResultTreeFragBase&
-XNumber::rtree() const
-{
- error("Can't cast XNumber to ResultTreeFragBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<ResultTreeFragBase*>(0);
-}
-
-
-
-ResultTreeFragBase&
-XNumber::rtree()
-{
- error("Can't cast XNumber to ResultTreeFragBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<ResultTreeFragBase*>(0);
-}
-
-
-
-const NodeRefListBase&
-XNumber::nodeset() const
-{
- error("Can't cast XNumber to NodeRefListBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<NodeRefListBase*>(0);
}
1.9 +1 -14 xml-xalan/c/src/XPath/XNumber.hpp
Index: XNumber.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XNumber.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XNumber.hpp 2000/07/28 22:01:54 1.8
+++ XNumber.hpp 2000/08/10 18:37:34 1.9
@@ -80,13 +80,9 @@
/**
* Create an XNumber from a number.
*
- * @param envSupport XPath environment support class instance
* @param val numeric value to use
*/
- XNumber(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- double val);
+ XNumber(double val);
XNumber(const XNumber& source);
@@ -116,15 +112,6 @@
virtual XalanDOMString
str() const;
-
- virtual const ResultTreeFragBase&
- rtree() const;
-
- virtual ResultTreeFragBase&
- rtree();
-
- virtual const NodeRefListBase&
- nodeset() const;
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject);
1.9 +153 -146 xml-xalan/c/src/XPath/XObject.cpp
Index: XObject.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XObject.cpp 2000/07/13 22:22:31 1.8
+++ XObject.cpp 2000/08/10 18:37:34 1.9
@@ -63,6 +63,10 @@
+#include <XalanDOM/XalanNode.hpp>
+
+
+
#include <PlatformSupport/DoubleSupport.hpp>
@@ -72,25 +76,16 @@
#include "NodeRefListBase.hpp"
-#include "XPathEnvSupport.hpp"
-#include "XPathException.hpp"
-#include "XPathSupport.hpp"
-XObject::XObject(
- XPathEnvSupport* envSupport,
- XPathSupport* support) :
- m_envSupport(envSupport),
- m_support(support)
+XObject::XObject()
{
}
-XObject::XObject(const XObject& source) :
- m_envSupport(source.m_envSupport),
- m_support(source.m_support)
+XObject::XObject(const XObject& /* source */)
{
}
@@ -102,60 +97,67 @@
-void
-XObject::error(const XalanDOMString& msg) const
+double
+XObject::num() const
{
- const bool shouldThrow =
- m_envSupport->problem(XPathEnvSupport::eXPATHProcessor,
-
XPathEnvSupport::eError,
-#if defined(XALAN_OLD_STYLE_CASTS)
- (XalanNode*)0,
-#else
-
static_cast<XalanNode*>(0),
-#endif
- 0,
- msg,
- 0,
- 0);
+ throw XObjectInvalidCastException(getTypeString(),
XALAN_STATIC_UCODE_STRING("number"));
- if(shouldThrow == true)
- {
- throw XPathException(msg);
- }
+ // This is just a dummy value to satisfy the compiler.
+ return 0.0;
}
-XPathSupport*
-getSupport(const XObject& theXObject,
- const NodeRefListBase& theNodeList)
+bool
+XObject::boolean() const
{
- XPathSupport* theSupport = theXObject.getSupport();
+ throw XObjectInvalidCastException(getTypeString(),
XALAN_STATIC_UCODE_STRING("boolean"));
- if (theSupport == 0)
- {
- theNodeList.getSupport();
- }
+ // This is just a dummy value to satisfy the compiler.
+ return false;
+}
+
+
+
+XalanDOMString
+XObject::str() const
+{
+ throw XObjectInvalidCastException(getTypeString(),
XALAN_STATIC_UCODE_STRING("string"));
- return theSupport;
+ // This is just a dummy value to satisfy the compiler.
+ return XalanDOMString();
}
+const ResultTreeFragBase&
+XObject::rtree(XPathExecutionContext& /* executionContext */) const
+{
+ throw XObjectInvalidCastException(getTypeString(),
XALAN_STATIC_UCODE_STRING("result tree fragment"));
+
+ // This is just a dummy value to satisfy the compiler.
+ return *static_cast<ResultTreeFragBase*>(0);
+}
+
+
+const NodeRefListBase&
+XObject::nodeset() const
+{
+ throw XObjectInvalidCastException(getTypeString(),
XALAN_STATIC_UCODE_STRING("node set"));
+
+ // error will throw, so this is just a dummy
+ // value to satisfy the compiler.
+ return *static_cast<NodeRefListBase*>(0);
+}
+
+
+
const XalanDOMString
getStringFromNode(
- const XalanNode& theNode,
- XPathSupport* theXPathSupport)
+ const XalanNode& theNode)
{
- if (theXPathSupport != 0)
- {
- return theXPathSupport->getNodeData(theNode);
- }
- else
- {
- return DOMServices::getNodeData(theNode);
- }
+ return theNode.getXSLTData();
}
@@ -163,30 +165,24 @@
struct
getStringFromNodeFunction
{
- getStringFromNodeFunction(XPathSupport* theSupport = 0) :
- m_support(theSupport)
+ getStringFromNodeFunction()
{
}
const XalanDOMString
operator()(const XalanNode& theNode) const
{
- return getStringFromNode(theNode, m_support);
+ return getStringFromNode(theNode);
}
-
-private:
-
- XPathSupport* const m_support;
};
double
getNumberFromNode(
- const XalanNode& theNode,
- XPathSupport* theXPathSupport)
+ const XalanNode& theNode)
{
- return DoubleSupport::toDouble(getStringFromNode(theNode,
theXPathSupport));
+ return DoubleSupport::toDouble(getStringFromNode(theNode));
}
@@ -194,20 +190,15 @@
struct
getNumberFromNodeFunction
{
- getNumberFromNodeFunction(XPathSupport* theSupport = 0) :
- m_support(theSupport)
+ getNumberFromNodeFunction()
{
}
double
operator()(const XalanNode& theNode) const
{
- return getNumberFromNode(theNode, m_support);
+ return getNumberFromNode(theNode);
}
-
-private:
-
- XPathSupport* const m_support;
};
@@ -300,22 +291,17 @@
equalNodeSet(
const XObject& theLHS,
const XObject& theRHS,
- XObject::eObjectType theRHSType,
- XPathSupport* theXPathSupport)
+ XObject::eObjectType theRHSType)
{
bool theResult = false;
- XPathSupport* const theSupport = theXPathSupport != 0 ?
- theXPathSupport
:
-
theRHS.getSupport();
-
if(theRHSType == XObject::eTypeNodeSet)
{
// Compare as node sets...
theResult = doCompareNodeSets(
theLHS.nodeset(),
theRHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
DOMStringEqualsFunction());
}
@@ -343,7 +329,7 @@
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::equalFunction());
}
@@ -357,7 +343,7 @@
// Compare as number...
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::equalFunction());
}
@@ -366,7 +352,7 @@
// Compare as string...
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringEqualsFunction());
}
@@ -381,7 +367,7 @@
// string is true.
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringEqualsFunction());
}
@@ -399,22 +385,17 @@
notEqualNodeSet(
const XObject& theLHS,
const XObject& theRHS,
- XObject::eObjectType theRHSType,
- XPathSupport* theXPathSupport)
+ XObject::eObjectType theRHSType)
{
bool theResult = false;
- XPathSupport* const theSupport = theXPathSupport != 0 ?
- theXPathSupport
:
-
theRHS.getSupport();
-
if(theRHSType == XObject::eTypeNodeSet)
{
// Compare as node sets...
theResult = doCompareNodeSets(
theLHS.nodeset(),
theRHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
DOMStringNotEqualsFunction());
}
@@ -442,7 +423,7 @@
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::notEqualFunction());
}
@@ -456,7 +437,7 @@
// Compare as number...
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::notEqualFunction());
}
@@ -465,7 +446,7 @@
// Compare as string...
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringNotEqualsFunction());
}
@@ -480,7 +461,7 @@
// string is true.
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringNotEqualsFunction());
}
@@ -498,22 +479,17 @@
lessThanNodeSet(
const XObject& theLHS,
const XObject& theRHS,
- XObject::eObjectType theRHSType,
- XPathSupport* theXPathSupport)
+ XObject::eObjectType theRHSType)
{
bool theResult = false;
- XPathSupport* const theSupport = theXPathSupport != 0 ?
- theXPathSupport
:
-
theRHS.getSupport();
-
if(theRHSType == XObject::eTypeNodeSet)
{
// Compare as node sets...
theResult = doCompareNodeSets(
theLHS.nodeset(),
theRHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
DOMStringLessThanFunction());
}
@@ -541,7 +517,7 @@
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::lessThanFunction());
}
@@ -555,7 +531,7 @@
// Compare as number...
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::lessThanFunction());
}
@@ -564,7 +540,7 @@
// Compare as string...
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringLessThanFunction());
}
@@ -579,7 +555,7 @@
// string is true.
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringLessThanFunction());
}
@@ -597,22 +573,17 @@
lessThanOrEqualNodeSet(
const XObject& theLHS,
const XObject& theRHS,
- XObject::eObjectType theRHSType,
- XPathSupport* theXPathSupport)
+ XObject::eObjectType theRHSType)
{
bool theResult = false;
- XPathSupport* const theSupport = theXPathSupport != 0 ?
- theXPathSupport
:
-
theRHS.getSupport();
-
if(theRHSType == XObject::eTypeNodeSet)
{
// Compare as node sets...
theResult = doCompareNodeSets(
theLHS.nodeset(),
theRHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
DOMStringLessThanOrEqualFunction());
}
@@ -640,7 +611,7 @@
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::lessThanOrEqualFunction());
}
@@ -654,7 +625,7 @@
// Compare as number...
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::lessThanOrEqualFunction());
}
@@ -663,7 +634,7 @@
// Compare as string...
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringLessThanOrEqualFunction());
}
@@ -678,7 +649,7 @@
// string is true.
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringLessThanOrEqualFunction());
}
@@ -696,22 +667,17 @@
greaterThanNodeSet(
const XObject& theLHS,
const XObject& theRHS,
- XObject::eObjectType theRHSType,
- XPathSupport* theXPathSupport)
+ XObject::eObjectType theRHSType)
{
bool theResult = false;
- XPathSupport* const theSupport = theXPathSupport != 0 ?
- theXPathSupport
:
-
theRHS.getSupport();
-
if(theRHSType == XObject::eTypeNodeSet)
{
// Compare as node sets...
theResult = doCompareNodeSets(
theLHS.nodeset(),
theRHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
DOMStringGreaterThanFunction());
}
@@ -739,7 +705,7 @@
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::greaterThanFunction());
}
@@ -753,7 +719,7 @@
// Compare as number...
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::greaterThanFunction());
}
@@ -762,7 +728,7 @@
// Compare as string...
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringGreaterThanFunction());
}
@@ -777,7 +743,7 @@
// string is true.
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringGreaterThanFunction());
}
@@ -795,22 +761,17 @@
greaterThanOrEqualNodeSet(
const XObject& theLHS,
const XObject& theRHS,
- XObject::eObjectType theRHSType,
- XPathSupport* theXPathSupport)
+ XObject::eObjectType theRHSType)
{
bool theResult = false;
- XPathSupport* const theSupport = theXPathSupport != 0 ?
- theXPathSupport
:
-
theRHS.getSupport();
-
if(theRHSType == XObject::eTypeNodeSet)
{
// Compare as node sets...
theResult = doCompareNodeSets(
theLHS.nodeset(),
theRHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
DOMStringGreaterThanOrEqualFunction());
}
@@ -838,7 +799,7 @@
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::greaterThanOrEqualFunction());
}
@@ -852,7 +813,7 @@
// Compare as number...
theResult = doCompare(
theLHS.nodeset(),
- getNumberFromNodeFunction(theSupport),
+ getNumberFromNodeFunction(),
theRHS.num(),
DoubleSupport::greaterThanOrEqualFunction());
}
@@ -861,7 +822,7 @@
// Compare as string...
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringGreaterThanOrEqualFunction());
}
@@ -876,7 +837,7 @@
// string is true.
theResult = doCompare(
theLHS.nodeset(),
- getStringFromNodeFunction(theSupport),
+ getStringFromNodeFunction(),
theRHS.str(),
DOMStringGreaterThanOrEqualFunction());
}
@@ -911,11 +872,11 @@
}
else if (theLHSType == eTypeNodeSet)
{
- return equalNodeSet(*this, theRHS, theRHS.getType(),
m_support);
+ return equalNodeSet(*this, theRHS, theRHS.getType());
}
else if (theRHS.getType() == eTypeNodeSet)
{
- return equalNodeSet(theRHS, *this, theLHSType,
m_support);
+ return equalNodeSet(theRHS, *this, theLHSType);
}
else
{
@@ -940,7 +901,8 @@
bool
-XObject::notEquals(const XObject& theRHS) const
+XObject::notEquals(
+ const XObject& theRHS) const
{
if (this == &theRHS)
{
@@ -960,11 +922,11 @@
}
else if (theLHSType == eTypeNodeSet)
{
- return notEqualNodeSet(*this, theRHS, theRHS.getType(),
m_support);
+ return notEqualNodeSet(*this, theRHS, theRHS.getType());
}
else if (theRHS.getType() == eTypeNodeSet)
{
- return notEqualNodeSet(theRHS, *this, theLHSType,
m_support);
+ return notEqualNodeSet(theRHS, *this, theLHSType);
}
else
{
@@ -1005,11 +967,11 @@
}
else if (theLHSType == eTypeNodeSet)
{
- return lessThanNodeSet(*this, theRHS, theRHS.getType(),
m_support);
+ return lessThanNodeSet(*this, theRHS, theRHS.getType());
}
else if (theRHS.getType() == eTypeNodeSet)
{
- return greaterThanNodeSet(theRHS, *this, theLHSType,
theRHS.getSupport());
+ return greaterThanNodeSet(theRHS, *this, theLHSType);
}
else
{
@@ -1021,7 +983,7 @@
bool
-XObject::lessThanOrEqual(const XObject& theRHS) const
+XObject::lessThanOrEqual(const XObject& theRHS) const
{
if (this == &theRHS)
{
@@ -1037,11 +999,11 @@
}
else if (theLHSType == eTypeNodeSet)
{
- return lessThanOrEqualNodeSet(*this, theRHS,
theRHS.getType(), m_support);
+ return lessThanOrEqualNodeSet(*this, theRHS,
theRHS.getType());
}
else if (theRHS.getType() == eTypeNodeSet)
{
- return greaterThanOrEqualNodeSet(theRHS, *this,
theLHSType, theRHS.getSupport());
+ return greaterThanOrEqualNodeSet(theRHS, *this,
theLHSType);
}
else
{
@@ -1053,7 +1015,7 @@
bool
-XObject::greaterThan(const XObject& theRHS) const
+XObject::greaterThan(const XObject& theRHS) const
{
if (this == &theRHS)
{
@@ -1069,11 +1031,11 @@
}
else if (theLHSType == eTypeNodeSet)
{
- return greaterThanNodeSet(*this, theRHS,
theRHS.getType(), m_support);
+ return greaterThanNodeSet(*this, theRHS,
theRHS.getType());
}
else if (theRHS.getType() == eTypeNodeSet)
{
- return lessThanNodeSet(theRHS, *this, theLHSType,
theRHS.getSupport());
+ return lessThanNodeSet(theRHS, *this, theLHSType);
}
else
{
@@ -1101,15 +1063,60 @@
}
else if (theLHSType == eTypeNodeSet)
{
- return greaterThanOrEqualNodeSet(*this, theRHS,
theRHS.getType(), m_support);
+ return greaterThanOrEqualNodeSet(*this, theRHS,
theRHS.getType());
}
else if (theRHS.getType() == eTypeNodeSet)
{
- return lessThanOrEqualNodeSet(theRHS, *this,
theLHSType, theRHS.getSupport());
+ return lessThanOrEqualNodeSet(theRHS, *this,
theLHSType);
}
else
{
return DoubleSupport::greaterThanOrEqual(num(),
theRHS.num());
}
}
+}
+
+
+
+XObject::XObjectException::XObjectException(
+ const XalanDOMString& message,
+ const XalanNode* styleNode) :
+ XPathException(message, styleNode)
+{
+}
+
+
+
+XObject::XObjectException::~XObjectException()
+{
+}
+
+
+
+XObject::XObjectInvalidCastException::XObjectInvalidCastException(
+ const XalanDOMString& fromType,
+ const XalanDOMString& toType) :
+ m_fromType(fromType),
+ m_toType(toType)
+{
+}
+
+
+
+XObject::XObjectInvalidCastException::~XObjectInvalidCastException()
+{
+}
+
+
+
+const XalanDOMString
+XObject::XObjectInvalidCastException::formatErrorString(
+ const XalanDOMString& fromType,
+ const XalanDOMString& toType)
+{
+ return XalanDOMString(XALAN_STATIC_UCODE_STRING("Cannot cast an ")) +
+ fromType +
+ XalanDOMString(XALAN_STATIC_UCODE_STRING(" to a ")) +
+ toType +
+ XalanDOMString(XALAN_STATIC_UCODE_STRING("."));
}
1.10 +72 -49 xml-xalan/c/src/XPath/XObject.hpp
Index: XObject.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObject.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XObject.hpp 2000/07/28 22:01:55 1.9
+++ XObject.hpp 2000/08/10 18:37:34 1.10
@@ -68,12 +68,15 @@
+#include <XPath/XPathException.hpp>
+
+
+
class MutableNodeRefList;
class NodeRefListBase;
class ResultTreeFragBase;
class XObjectTypeCallback;
-class XPathSupport;
-class XPathEnvSupport;
+class XPathExecutionContext;
@@ -87,12 +90,9 @@
/**
* Create an XObject.
*
- * @param envSupport XPath environment support class instance
*/
explicit
- XObject(
- XPathEnvSupport* envSupport,
- XPathSupport* support);
+ XObject();
XObject(const XObject& source);
@@ -120,7 +120,7 @@
* @return numeric value
*/
virtual double
- num() const = 0;
+ num() const;
/**
* Cast result object to a boolean.
@@ -128,7 +128,7 @@
* @return boolean value
*/
virtual bool
- boolean() const = 0;
+ boolean() const;
/**
* Cast result object to a string.
@@ -136,23 +136,16 @@
* @return string value
*/
virtual XalanDOMString
- str() const = 0;
+ str() const;
/**
* Cast result object to a result tree fragment.
*
+ * @param executionContext the current execution context
* @return result tree fragment
*/
virtual const ResultTreeFragBase&
- rtree() const = 0;
-
- /**
- * Cast result object to a result tree fragment.
- *
- * @return result tree fragment
- */
- virtual ResultTreeFragBase&
- rtree() = 0;
+ rtree(XPathExecutionContext& executionContext) const;
/**
* Cast result object to a nodelist.
@@ -160,7 +153,7 @@
* @return node list
*/
virtual const NodeRefListBase&
- nodeset() const = 0;
+ nodeset() const;
/**
* Process a callback request for preferred type information.
@@ -182,6 +175,7 @@
* Tell if two objects are functionally equal.
*
* @param theRHS object to compare
+ * @param executionContext the current execution context
* @return true if they are equal
*/
bool
@@ -191,6 +185,7 @@
* Tell if two objects are functionally not equal.
*
* @param theRHS object to compare
+ * @param executionContext the current execution context
* @return true if they are equal
*/
bool
@@ -237,14 +232,16 @@
/**
* Enumeration of possible object types
*/
- enum eObjectType { eTypeNull = -1,
- eTypeUnknown = 0,
- eTypeBoolean = 1,
- eTypeNumber = 2,
- eTypeString = 3,
- eTypeNodeSet = 4,
- eTypeResultTreeFrag = 5,
- eUnknown = 6};
+ enum eObjectType { eTypeNull = 0,
+ eTypeUnknown = 1,
+ eTypeBoolean = 2,
+ eTypeNumber = 3,
+ eTypeString = 4,
+ eTypeNodeSet = 5,
+ eTypeResultTreeFrag = 6,
+ eTypeUserDefined = 7,
+ eUnknown
+ };
/**
* Tell what kind of class this is.
@@ -253,38 +250,64 @@
*/
virtual eObjectType
getType() const = 0;
+
+ // All XObject instances are controlled by an instance of an
XObjectFactory.
+ friend class XObjectFactory;
- XPathEnvSupport*
- getEnvSupport() const
+ // Base class for all XObject exceptions...
+ class XObjectException : public XPathException
{
- return m_envSupport;
- }
+ public:
- XPathSupport*
- getSupport() const
+ explicit
+ XObjectException(
+ const XalanDOMString& message =
XalanDOMString(),
+ const XalanNode* styleNode = 0);
+
+ virtual
+ ~XObjectException();
+ };
+
+ class XObjectInvalidCastException : public XObjectException
{
- return m_support;
- }
+ public:
- // All XObject instances are controlled by an instance of an
XObjectFactory.
- friend class XObjectFactory;
+ explicit
+ XObjectInvalidCastException(
+ const XalanDOMString& fromType,
+ const XalanDOMString& toType);
+
+ virtual
+ ~XObjectInvalidCastException();
+
+ const XalanDOMString&
+ getFromType() const
+ {
+ return m_fromType;
+ }
+
+ const XalanDOMString&
+ getToType() const
+ {
+ return m_toType;
+ }
+
+ private:
+
+ static const XalanDOMString
+ formatErrorString(
+ const XalanDOMString& fromType,
+ const XalanDOMString& toType);
+ const XalanDOMString m_fromType;
+
+ const XalanDOMString m_toType;
+ };
+
protected:
virtual
~XObject();
-
- /**
- * Tell the user of an error, and probably throw an
- * exception.
- */
- virtual void
- error(const XalanDOMString& msg) const;
-
- // Data members...
- XPathEnvSupport* const m_envSupport;
-
- XPathSupport* const m_support;
private:
1.9 +7 -7 xml-xalan/c/src/XPath/XObjectFactory.hpp
Index: XObjectFactory.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactory.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XObjectFactory.hpp 2000/07/28 22:01:55 1.8
+++ XObjectFactory.hpp 2000/08/10 18:37:36 1.9
@@ -363,7 +363,7 @@
*/
XObjectGuard(
XObjectFactory& theFactory,
- XObject* theXObject) :
+ const XObject* theXObject) :
m_factory(&theFactory),
m_object(theXObject)
{
@@ -426,7 +426,7 @@
*
* @return pointer to XObject
*/
- XObject*
+ const XObject*
operator->() const
{
assert(m_object != 0);
@@ -439,7 +439,7 @@
*
* @return pointer to XObject
*/
- XObject*
+ const XObject*
get() const
{
return m_object;
@@ -470,7 +470,7 @@
void
reset(
XObjectFactory& theFactory,
- XObject* theXObject)
+ const XObject* theXObject)
{
if (m_object != 0)
{
@@ -488,10 +488,10 @@
*
* @return pointer to XObject
*/
- XObject*
+ const XObject*
release()
{
- XObject* const theTemp = m_object;
+ const XObject* const theTemp = m_object;
m_object = 0;
@@ -506,7 +506,7 @@
// Data members...
XObjectFactory* m_factory;
- XObject* m_object;
+ const XObject* m_object;
};
1.12 +14 -21 xml-xalan/c/src/XPath/XObjectFactoryDefault.cpp
Index: XObjectFactoryDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactoryDefault.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XObjectFactoryDefault.cpp 2000/07/28 22:01:56 1.11
+++ XObjectFactoryDefault.cpp 2000/08/10 18:37:37 1.12
@@ -65,12 +65,9 @@
#include "XBoolean.hpp"
-#include "XBooleanStatic.hpp"
#include "XNodeSet.hpp"
#include "XNull.hpp"
#include "XNumber.hpp"
-#include "XPathEnvSupport.hpp"
-#include "XPathSupport.hpp"
#include "XResultTreeFrag.hpp"
#include "XSpan.hpp"
#include "XString.hpp"
@@ -78,19 +75,15 @@
-static XBooleanStatic theTrueBoolean(true);
-static XBooleanStatic theFalseBoolean(false);
+static XBoolean theTrueBoolean(true);
+static XBoolean theFalseBoolean(false);
-XObjectFactoryDefault::XObjectFactoryDefault(
- XPathEnvSupport& theEnvSupport,
- XPathSupport& theSupport) :
+XObjectFactoryDefault::XObjectFactoryDefault() :
XObjectFactory(),
- m_envSupport(theEnvSupport),
- m_support(theSupport),
m_xobjects(),
- m_XNull(new XNull(theEnvSupport, theSupport))
+ m_XNull(new XNull)
#if !defined(NDEBUG)
, m_totalBooleanInstanceCount(0),
m_totalNodeSetInstanceCount(0),
@@ -189,7 +182,7 @@
}
else
{
- XBoolean* const theBoolean = new XBoolean(m_envSupport,
m_support, theValue);
+ XBoolean* const theBoolean = new XBoolean(theValue);
m_xobjects.insert(theBoolean);
@@ -207,7 +200,7 @@
NodeRefListBase* value,
bool /* fOptimize */)
{
- XNodeSet* const theXNodeSet = new XNodeSet(m_envSupport,
m_support, value);
+ XNodeSet* const theXNodeSet = new XNodeSet(value);
m_xobjects.insert(theXNodeSet);
@@ -225,7 +218,7 @@
XalanNode& value,
bool /* fOptimize */)
{
- XNodeSet* const theXNodeSet = new XNodeSet(m_envSupport,
m_support, value);
+ XNodeSet* const theXNodeSet = new XNodeSet(value);
m_xobjects.insert(theXNodeSet);
@@ -247,7 +240,7 @@
}
else
{
- XNull* const theXNull = new XNull(m_envSupport, m_support);
+ XNull* const theXNull = new XNull();
m_xobjects.insert(theXNull);
@@ -266,7 +259,7 @@
double theValue,
bool /* fOptimize */)
{
- XNumber* theXNumber = new XNumber(m_envSupport, m_support,
theValue);
+ XNumber* theXNumber = new XNumber(theValue);
m_xobjects.insert(theXNumber);
@@ -284,7 +277,7 @@
const XalanDOMString& theValue,
bool /* fOptimize */)
{
- XString* const theXString = new XString(m_envSupport, m_support,
theValue);
+ XString* const theXString = new XString(theValue);
m_xobjects.insert(theXString);
@@ -302,7 +295,7 @@
const XalanDOMString& theValue,
bool /* fOptimize */)
{
- XUnknown* const theXUnknown = new XUnknown(m_envSupport, m_support,
theValue);
+ XUnknown* const theXUnknown = new XUnknown(theValue);
m_xobjects.insert(theXUnknown);
@@ -320,7 +313,7 @@
ResultTreeFragBase* theValue,
bool /* fOptimize */)
{
- XResultTreeFrag* const theResultTreeFrag = new
XResultTreeFrag(m_envSupport, m_support, theValue);
+ XResultTreeFrag* const theResultTreeFrag = new
XResultTreeFrag(theValue);
m_xobjects.insert(theResultTreeFrag);
@@ -338,7 +331,7 @@
NodeRefListBase* theValue,
bool /* fOptimize */)
{
- XSpan* const theXSpan = new XSpan(m_envSupport, m_support, theValue);
+ XSpan* const theXSpan = new XSpan(theValue);
m_xobjects.insert(theXSpan);
@@ -356,7 +349,7 @@
XalanNode& theValue,
bool /* fOptimize */)
{
- XSpan* const theXSpan = new XSpan(m_envSupport, m_support, theValue);
+ XSpan* const theXSpan = new XSpan(theValue);
m_xobjects.insert(theXSpan);
1.9 +2 -12 xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp
Index: XObjectFactoryDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectFactoryDefault.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XObjectFactoryDefault.hpp 2000/07/28 22:01:56 1.8
+++ XObjectFactoryDefault.hpp 2000/08/10 18:37:37 1.9
@@ -75,8 +75,6 @@
class XNull;
-class XPathEnvSupport;
-class XPathSupport;
@@ -89,14 +87,9 @@
/**
* Construct a factory for creating XObjects.
- *
- * @param constructionContext context for construction of object
- * @param theEnvSupport XPath environment support class instance
- * @param theSupport XPath support class instance
*/
- XObjectFactoryDefault(
- XPathEnvSupport& theEnvSupport,
- XPathSupport& theSupport);
+ explicit
+ XObjectFactoryDefault();
virtual
~XObjectFactoryDefault();
@@ -249,9 +242,6 @@
// Data members...
- XPathEnvSupport& m_envSupport;
- XPathSupport& m_support;
-
CollectionType m_xobjects;
#if defined(XALAN_NO_NAMESPACES)
1.4 +2 -2 xml-xalan/c/src/XPath/XObjectTypeCallback.hpp
Index: XObjectTypeCallback.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XObjectTypeCallback.hpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XObjectTypeCallback.hpp 2000/04/11 14:46:16 1.3
+++ XObjectTypeCallback.hpp 2000/08/10 18:37:37 1.4
@@ -121,8 +121,8 @@
* @param theValue
*/
virtual void
- String(const XObject& theXObject,
- const XalanDOMString& theValue) = 0;
+ String(const XObject& theXObject,
+ const XalanDOMString& theValue) = 0;
/**
* Call back the XObject with a result tree fragment value.
1.25 +61 -63 xml-xalan/c/src/XPath/XPath.cpp
Index: XPath.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- XPath.cpp 2000/08/04 21:30:46 1.24
+++ XPath.cpp 2000/08/10 18:37:38 1.25
@@ -154,7 +154,7 @@
-XObject*
+const XObject*
XPath::execute(XPathExecutionContext& executionContext) const
{
assert(executionContext.getPrefixResolver() != 0);
@@ -164,7 +164,7 @@
-XObject*
+const XObject*
XPath::execute(
XalanNode* context,
const PrefixResolver& prefixResolver,
@@ -180,7 +180,7 @@
executionContext,
context);
- XObject* theResult = 0;
+ const XObject* theResult = 0;
theResult = execute(executionContext);
@@ -189,7 +189,7 @@
-XObject*
+const XObject*
XPath::execute(
XalanNode* context,
const PrefixResolver& prefixResolver,
@@ -201,7 +201,7 @@
executionContext,
contextNodeList);
- XObject* theResult = 0;
+ const XObject* theResult = 0;
theResult = execute(context, prefixResolver, executionContext);
@@ -210,13 +210,13 @@
-XObject*
+const XObject*
XPath::executeMore(
XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* result = 0;
+ const XObject* result = 0;
switch(m_expression.m_opMap[opPos])
{
@@ -589,7 +589,7 @@
if(tokenIndex
>= 0)
{
const
XalanDOMString targetName =
-
m_expression.m_tokenQueue[tokenIndex]->str();
+
m_expression.m_tokenQueue[tokenIndex].str();
if(::equals(targetName, PSEUDONAME_ANY) == true)
{
@@ -625,7 +625,7 @@
-XObject*
+const XObject*
XPath::xpath(
XalanNode* context,
int opPos,
@@ -636,14 +636,14 @@
-XObject*
+const XObject*
XPath::matchPattern(
XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* score = 0;
+ const XObject* score = 0;
XObjectFactory& theFactory =
executionContext.getXObjectFactory();
@@ -693,7 +693,7 @@
-XObject*
+const XObject*
XPath::Or(
XalanNode* context,
int opPos,
@@ -723,7 +723,7 @@
-XObject*
+const XObject*
XPath::And(
XalanNode* context,
int opPos,
@@ -756,7 +756,7 @@
-XObject*
+const XObject*
XPath::notequals(
XalanNode* context,
int opPos,
@@ -779,7 +779,7 @@
-XObject*
+const XObject*
XPath::equals(
XalanNode* context,
int opPos,
@@ -802,7 +802,7 @@
-XObject*
+const XObject*
XPath::lte(
XalanNode* context,
int opPos,
@@ -825,7 +825,7 @@
-XObject*
+const XObject*
XPath::lt(
XalanNode* context,
int opPos,
@@ -848,7 +848,7 @@
-XObject*
+const XObject*
XPath::gte(
XalanNode* context,
int opPos,
@@ -871,7 +871,7 @@
-XObject*
+const XObject*
XPath::gt(
XalanNode* context,
int opPos,
@@ -894,7 +894,7 @@
-XObject*
+const XObject*
XPath::plus(
XalanNode* context,
int opPos,
@@ -917,7 +917,7 @@
-XObject*
+const XObject*
XPath::minus(
XalanNode* context,
int opPos,
@@ -940,7 +940,7 @@
-XObject*
+const XObject*
XPath::mult(
XalanNode* context,
int opPos,
@@ -963,7 +963,7 @@
-XObject*
+const XObject*
XPath::div(
XalanNode* context,
int opPos,
@@ -986,7 +986,7 @@
-XObject*
+const XObject*
XPath::mod(
XalanNode* context,
int opPos,
@@ -1009,7 +1009,7 @@
-XObject*
+const XObject*
XPath::quo(
XalanNode* context,
int opPos,
@@ -1023,7 +1023,7 @@
-XObject*
+const XObject*
XPath::neg(
XalanNode* context,
int opPos,
@@ -1039,7 +1039,7 @@
-XObject*
+const XObject*
XPath::string(
XalanNode* context,
int opPos,
@@ -1064,7 +1064,7 @@
-XObject*
+const XObject*
XPath::boolean(
XalanNode* context,
int opPos,
@@ -1089,7 +1089,7 @@
-XObject*
+const XObject*
XPath::number(
XalanNode* context,
int opPos,
@@ -1114,7 +1114,7 @@
-XObject*
+const XObject*
XPath::Union(
XalanNode* context,
int opPos,
@@ -1134,12 +1134,12 @@
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
- XObject* expr = executeMore(context, opPos,
executionContext);
+ const XObject* expr = executeMore(context, opPos,
executionContext);
const NodeRefListBase& nl =
expr->nodeset();
- resultNodeList->addNodesInDocOrder(nl);
+ resultNodeList->addNodesInDocOrder(nl, executionContext);
theFactory.returnObject(expr);
@@ -1151,7 +1151,7 @@
-XObject*
+const XObject*
XPath::literal(
XalanNode* /* context */,
int opPos,
@@ -1160,15 +1160,14 @@
assert(m_expression.m_opMap.size() > static_cast<unsigned>(opPos + 2));
assert(m_expression.m_tokenQueue.size() >
static_cast<unsigned>(m_expression.m_opMap[opPos + 2]));
- XObject* const theToken =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
- assert(theToken != 0 && theToken->getType() == XObject::eTypeString);
+ const XObject& theLiteral =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
- return executionContext.getXObjectFactory().clone(*theToken);
+ return
executionContext.getXObjectFactory().createString(theLiteral.str());
}
-XObject*
+const XObject*
XPath::variable(
XalanNode* context,
int opPos,
@@ -1176,13 +1175,13 @@
{
assert(executionContext.getPrefixResolver() != 0);
- XObject* const varName =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
+ const XObject& varName =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
// $$$ ToDo: I don't this will be parsed right in the first place...
- const QName qname(varName->str(),
+ const QName qname(varName.str(),
*executionContext.getPrefixResolver());
- XObject* result = 0;
+ const XObject* result = 0;
try
{
@@ -1190,7 +1189,7 @@
}
catch(...)
{
- executionContext.error(XalanDOMString("Could not get variable
named ") + varName->str());
+ executionContext.error(XalanDOMString("Could not get variable
named ") + varName.str());
throw;
}
@@ -1199,7 +1198,7 @@
{
executionContext.warn(XalanDOMString("VariableReference given
for variable out ") +
XalanDOMString("of context or without definition! Name = ") +
- varName->str(),
+ varName.str(),
context);
}
@@ -1208,7 +1207,7 @@
-XObject*
+const XObject*
XPath::group(
XalanNode* context,
int opPos,
@@ -1219,7 +1218,7 @@
-XObject*
+const XObject*
XPath::numberlit(
XalanNode* /* context */,
int opPos,
@@ -1228,15 +1227,14 @@
assert(m_expression.m_opMap.size() > static_cast<unsigned>(opPos + 2));
assert(m_expression.m_tokenQueue.size() >
static_cast<unsigned>(m_expression.m_opMap[opPos + 2]));
- XObject* const theToken =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
- assert(theToken != 0 && theToken->getType() == XObject::eTypeNumber);
+ const XObject& theLiteral =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos + 2]];
- return executionContext.getXObjectFactory().clone(*theToken);
+ return
executionContext.getXObjectFactory().createNumber(theLiteral.num());
}
-XObject*
+const XObject*
XPath::arg(
XalanNode* context,
int opPos,
@@ -1247,7 +1245,7 @@
-XObject*
+const XObject*
XPath::locationPath(
XalanNode* context,
int opPos,
@@ -1294,13 +1292,13 @@
-XObject*
+const XObject*
XPath::predicate(
XalanNode* context,
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
+ const XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
// $$$ ToDo: This appears to be just an optimization, but is it really?
/*
@@ -1316,7 +1314,7 @@
-XObject*
+const XObject*
XPath::locationPathPattern(
XalanNode* context,
int opPos,
@@ -1338,7 +1336,7 @@
-XObject*
+const XObject*
XPath::runExtFunction(
XalanNode* context,
int opPos,
@@ -1348,11 +1346,11 @@
opPos += 2;
- const XObject* const ns =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos]];
+ const XalanDOMString ns =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos]].str();
opPos++;
- const XObject* const funcName =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos]];
+ const XalanDOMString funcName =
m_expression.m_tokenQueue[m_expression.m_opMap[opPos]].str();
opPos++;
@@ -1372,8 +1370,8 @@
opPos = nextOpPos;
}
- XObject* const theResult =
- extfunction(context, opPos, ns->str(), funcName->str(), args,
executionContext);
+ const XObject* const theResult =
+ extfunction(context, opPos, ns, funcName, args,
executionContext);
XObjectFactory& theFactory =
executionContext.getXObjectFactory();
@@ -1390,7 +1388,7 @@
-XObject*
+const XObject*
XPath::extfunction(
XalanNode*
context,
int
/* opPos */,
@@ -1407,7 +1405,7 @@
-XObject*
+const XObject*
XPath::runFunction(
XalanNode* context,
int opPos,
@@ -1423,8 +1421,8 @@
opPos++;
- // Number of args is next...
- const int argCount = m_expression.m_opMap[opPos];
+ // Number of args is next, not used for now...
+// const int argCount = m_expression.m_opMap[opPos];
opPos++;
@@ -1444,7 +1442,7 @@
opPos = nextOpPos;
}
- XObject* const theResult =
+ const XObject* const theResult =
function(context, opPos, funcID, args, executionContext);
XObjectFactory& theFactory =
executionContext.getXObjectFactory();
@@ -1462,7 +1460,7 @@
-XObject*
+const XObject*
XPath::function(
XalanNode*
context,
int
opPos,
1.14 +37 -37 xml-xalan/c/src/XPath/XPath.hpp
Index: XPath.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPath.hpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XPath.hpp 2000/08/04 21:30:46 1.13
+++ XPath.hpp 2000/08/10 18:37:38 1.14
@@ -148,7 +148,7 @@
* @param executionContext current execution context
* @return pointer to union of node-set operands
*/
- virtual XObject*
+ virtual const XObject*
execute(
XalanNode* context,
const PrefixResolver& prefixResolver,
@@ -163,7 +163,7 @@
* @param executionContext current execution context
* @return pointer to union of node-set operands
*/
- virtual XObject*
+ virtual const XObject*
execute(
XalanNode* context,
const PrefixResolver& prefixResolver,
@@ -178,7 +178,7 @@
* @param executionContext current execution context
* @return pointer to result XObject
*/
- virtual XObject*
+ virtual const XObject*
execute(XPathExecutionContext& executionContext) const;
/**
@@ -189,7 +189,7 @@
* @param executionContext current execution context
* @return pointer to union of node-set operands
*/
- virtual XObject*
+ virtual const XObject*
executeMore(
XalanNode* context,
int opPos,
@@ -203,7 +203,7 @@
* @param executionContext current execution context
* @return node-set
*/
- virtual XObject*
+ virtual const XObject*
locationPath(
XalanNode* context,
int opPos,
@@ -328,7 +328,7 @@
* @param executionContext current execution context
* @return pointer to either a boolean or a number
*/
- virtual XObject*
+ virtual const XObject*
predicate(
XalanNode* context,
int opPos,
@@ -429,7 +429,7 @@
* @param opPos The current position in the m_opMap array.
* @return The result of the expression.
*/
- virtual XObject*
+ virtual const XObject*
xpath(
XalanNode* context,
int opPos,
@@ -441,7 +441,7 @@
* @param opPos The current position in the m_opMap array.
* @return the match score in the form of an XObject.
*/
- virtual XObject*
+ virtual const XObject*
matchPattern(
XalanNode* context,
int opPos,
@@ -469,7 +469,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if the one of the two arguments are
true.
*/
- virtual XObject*
+ const XObject*
Or(
XalanNode* context,
int opPos,
@@ -481,7 +481,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if the two arguments are both true.
*/
- virtual XObject*
+ const XObject*
And(
XalanNode* context,
int opPos,
@@ -493,7 +493,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if the two arguments are not equal.
*/
- virtual XObject*
+ const XObject*
notequals(
XalanNode* context,
int opPos,
@@ -505,7 +505,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if the two arguments are equal.
*/
- virtual XObject*
+ const XObject*
equals(
XalanNode* context,
int opPos,
@@ -517,7 +517,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if arg 1 is less than or equal to arg 2.
*/
- virtual XObject*
+ const XObject*
lte(
XalanNode* context,
int opPos,
@@ -529,7 +529,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if arg 1 is less than arg 2.
*/
- virtual XObject*
+ const XObject*
lt(
XalanNode* context,
int opPos,
@@ -541,7 +541,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if arg 1 is greater than or equal to
arg 2.
*/
- virtual XObject*
+ const XObject*
gte(
XalanNode* context,
int opPos,
@@ -553,7 +553,7 @@
* @param opPos The current position in the m_opMap array.
* @return XBoolean set to true if arg 1 is greater than arg 2.
*/
- virtual XObject*
+ const XObject*
gt(
XalanNode* context,
int opPos,
@@ -565,7 +565,7 @@
* @param opPos The current position in the m_opMap array.
* @return sum of arg1 and arg2.
*/
- virtual XObject*
+ const XObject*
plus(
XalanNode* context,
int opPos,
@@ -577,7 +577,7 @@
* @param opPos The current position in the m_opMap array.
* @return difference of arg1 and arg2.
*/
- virtual XObject*
+ const XObject*
minus(
XalanNode* context,
int opPos,
@@ -589,7 +589,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg1 * arg2.
*/
- virtual XObject*
+ const XObject*
mult(
XalanNode* context,
int opPos,
@@ -601,7 +601,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg1 / arg2.
*/
- virtual XObject*
+ const XObject*
div(
XalanNode* context,
int opPos,
@@ -613,7 +613,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg1 mod arg2.
*/
- virtual XObject*
+ const XObject*
mod(
XalanNode* context,
int opPos,
@@ -626,7 +626,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg1 mod arg2.
*/
- virtual XObject*
+ const XObject*
quo(
XalanNode* context,
int opPos,
@@ -638,7 +638,7 @@
* @param opPos The current position in the m_opMap array.
* @return -arg.
*/
- virtual XObject*
+ const XObject*
neg(
XalanNode* context,
int opPos,
@@ -650,7 +650,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg cast to a string.
*/
- virtual XObject*
+ const XObject*
string(
XalanNode* context,
int opPos,
@@ -662,7 +662,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg cast to a boolean.
*/
- virtual XObject*
+ const XObject*
boolean(
XalanNode* context,
int opPos,
@@ -674,7 +674,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg cast to a number.
*/
- virtual XObject*
+ const XObject*
number(
XalanNode* context,
int opPos,
@@ -686,7 +686,7 @@
* @param opPos The current position in the m_opMap array.
* @return the union of node-set operands.
*/
- virtual XObject*
+ const XObject*
Union(
XalanNode* context,
int opPos,
@@ -698,7 +698,7 @@
* @param opPos The current position in the m_opMap array.
* @return an XObject object.
*/
- virtual XObject*
+ const XObject*
literal(
XalanNode* context,
int opPos,
@@ -710,7 +710,7 @@
* @param opPos The current position in the m_opMap array.
* @return an XObject object.
*/
- virtual XObject*
+ const XObject*
variable(
XalanNode* context,
int opPos,
@@ -722,7 +722,7 @@
* @param opPos The current position in the m_opMap array.
* @return arg.
*/
- virtual XObject*
+ const XObject*
group(
XalanNode* context,
int opPos,
@@ -734,7 +734,7 @@
* @param opPos The current position in the m_opMap array.
* @return an XObject object.
*/
- virtual XObject*
+ const XObject*
numberlit(
XalanNode* context,
int opPos,
@@ -746,7 +746,7 @@
* @param opPos The current position in the m_opMap array.
* @return the result of the argument expression.
*/
- virtual XObject*
+ const XObject*
arg(
XalanNode* context,
int opPos,
@@ -759,7 +759,7 @@
* @return score in an XNumber, one of MATCH_SCORE_NODETEST,
* MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
*/
- virtual XObject*
+ const XObject*
locationPathPattern(
XalanNode* context,
int opPos,
@@ -768,7 +768,7 @@
/**
* Setup for and run an extension function.
*/
- virtual XObject*
+ const XObject*
runExtFunction(
XalanNode* context,
int opPos,
@@ -777,7 +777,7 @@
/**
* Handle an extension function.
*/
- virtual XObject*
+ const XObject*
extfunction(
XalanNode*
context,
int
opPos,
@@ -789,7 +789,7 @@
/**
* Setup for and run a function.
*/
- virtual XObject*
+ const XObject*
runFunction(
XalanNode* context,
int opPos,
@@ -798,7 +798,7 @@
/**
* Handle a built-in function.
*/
- virtual XObject*
+ const XObject*
function(
XalanNode*
context,
int
opPos,
1.18 +32 -3 xml-xalan/c/src/XPath/XPathExecutionContext.hpp
Index: XPathExecutionContext.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContext.hpp,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- XPathExecutionContext.hpp 2000/07/28 22:01:56 1.17
+++ XPathExecutionContext.hpp 2000/08/10 18:37:38 1.18
@@ -93,8 +93,9 @@
class XObject;
class XObjectFactory;
class XalanDocument;
-class XalanNode;
class XalanElement;
+class XalanNode;
+class XalanText;
@@ -164,6 +165,16 @@
getXObjectFactory() const = 0;
/**
+ * Tell if the node is ignorable whitespace. This should be in the DOM.
+ * Return false if the parser doesn't handle this.
+ *
+ * @param node text node queried
+ * @return true if white space can be ignored
+ */
+ virtual bool
+ isIgnorableWhitespace(const XalanText& node) const = 0;
+
+ /**
* Retrieve namespace corresponding to a DOM node.
*
* @param n DOM node queried
@@ -327,7 +338,7 @@
* @param argVec vector of arguments to function
* @return pointer to XObject result
*/
- virtual XObject*
+ virtual const XObject*
extFunction(
const XalanDOMString& theNamespace,
const XalanDOMString& functionName,
@@ -457,6 +468,16 @@
return m_mutableNodeRefList;
}
+ BorrowReturnMutableNodeRefList
+ clone() const
+ {
+ BorrowReturnMutableNodeRefList
theResult(m_xpathExecutionContext);
+
+ *theResult = *m_mutableNodeRefList;
+
+ return theResult;
+ }
+
private:
XPathExecutionContext& m_xpathExecutionContext;
@@ -545,7 +566,7 @@
* @param theName name of variable
* @return pointer to an XObject if the variable was found, 0 if it was
not
*/
- virtual XObject*
+ virtual const XObject*
getVariable(const QName& name) const = 0;
/**
@@ -606,6 +627,14 @@
*/
virtual XalanDOMString
findURIFromDoc(const XalanDocument* owner) const = 0;
+
+ /**
+ * Get a DOM document, primarily for creating result tree fragments.
+ *
+ * @return DOM document
+ */
+ virtual XalanDocument*
+ getDOMFactory() const = 0;
/**
* The getUnparsedEntityURI function returns the URI of the unparsed
1.15 +20 -4 xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp
Index: XPathExecutionContextDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XPathExecutionContextDefault.cpp 2000/07/28 22:01:57 1.14
+++ XPathExecutionContextDefault.cpp 2000/08/10 18:37:38 1.15
@@ -149,6 +149,14 @@
+bool
+XPathExecutionContextDefault::isIgnorableWhitespace(const XalanText& node)
const
+{
+ return m_xpathSupport.isIgnorableWhitespace(node);
+}
+
+
+
XalanDOMString
XPathExecutionContextDefault::getNamespaceOfNode(const XalanNode& n) const
{
@@ -322,7 +330,7 @@
-XObject*
+const XObject*
XPathExecutionContextDefault::extFunction(
const XalanDOMString& theNamespace,
const XalanDOMString& functionName,
@@ -369,7 +377,7 @@
// that's the cheapest thing.
if (m_availableCachedNodeLists.size() == 0)
{
- m_busyCachedNodeLists.push_back(new
MutableNodeRefList(&m_xpathSupport));
+ m_busyCachedNodeLists.push_back(new MutableNodeRefList);
}
else
{
@@ -415,7 +423,7 @@
MutableNodeRefList*
XPathExecutionContextDefault::createMutableNodeRefList() const
{
- return new MutableNodeRefList(&m_xpathSupport);
+ return new MutableNodeRefList;
}
@@ -475,7 +483,7 @@
-XObject*
+const XObject*
XPathExecutionContextDefault::getVariable(const QName& name) const
{
return m_xobjectFactory.createUnknown(name.getLocalPart());
@@ -505,6 +513,14 @@
assert(m_prefixResolver != 0);
return m_prefixResolver->getNamespaceForPrefix(prefix);
+}
+
+
+
+XalanDocument*
+XPathExecutionContextDefault::getDOMFactory() const
+{
+ return m_xpathEnvSupport.getDOMFactory();
}
1.16 +8 -2 xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp
Index: XPathExecutionContextDefault.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExecutionContextDefault.hpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- XPathExecutionContextDefault.hpp 2000/07/28 22:01:57 1.15
+++ XPathExecutionContextDefault.hpp 2000/08/10 18:37:38 1.16
@@ -127,6 +127,9 @@
virtual XObjectFactory&
getXObjectFactory() const;
+ virtual bool
+ isIgnorableWhitespace(const XalanText& node) const;
+
virtual XalanDOMString
getNamespaceOfNode(const XalanNode& n) const;
@@ -180,7 +183,7 @@
virtual void
popArgVector();
- virtual XObject*
+ virtual const XObject*
extFunction(
const XalanDOMString& theNamespace,
const XalanDOMString& functionName,
@@ -232,7 +235,7 @@
const XalanDOMString& ref,
const PrefixResolver& resolver);
- virtual XObject*
+ virtual const XObject*
getVariable(
const QName& name) const;
@@ -244,6 +247,9 @@
virtual XalanDOMString
getNamespaceForPrefix(const XalanDOMString& prefix) const;
+
+ virtual XalanDocument*
+ getDOMFactory() const;
virtual XalanDOMString
findURIFromDoc(const XalanDocument* owner) const;
1.12 +140 -28 xml-xalan/c/src/XPath/XPathExpression.cpp
Index: XPathExpression.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- XPathExpression.cpp 2000/08/04 21:30:46 1.11
+++ XPathExpression.cpp 2000/08/10 18:37:39 1.12
@@ -60,15 +60,16 @@
#include <algorithm>
+#include <cstdio>
+#include <strstream>
-#include "XObjectFactory.hpp"
+#include <PlatformSupport/DoubleSupport.hpp>
-#include <cstdio>
-#include <strstream>
+#include "XObjectTypeCallback.hpp"
@@ -248,17 +249,129 @@
+XPathExpression::XToken::XToken(const XalanDOMString& theString) :
+ m_stringValue(theString),
+ m_numberValue(DoubleSupport::toDouble(theString))
+{
+}
+
+
+
+ XPathExpression::XToken::XToken(double theNumber) :
+ m_stringValue(DoubleToDOMString(theNumber)),
+ m_numberValue(theNumber)
+{
+}
+
+
+
+XPathExpression::XToken::XToken(const XToken& theSource) :
+ m_stringValue(theSource.m_stringValue),
+ m_numberValue(theSource.m_numberValue)
+{
+}
+
+
+
+XPathExpression::XToken::~XToken()
+{
+}
+
+
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XPathExpression::XToken*
+#endif
+XPathExpression::XToken::clone(void* theAddress) const
+{
+ return theAddress == 0 ? new XToken(*this) : new (theAddress)
XToken(*this);
+}
+
+
+
+XalanDOMString
+XPathExpression::XToken::getTypeString() const
+{
+ return XALAN_STATIC_UCODE_STRING("#TOKEN");
+}
+
+
+
+double
+XPathExpression::XToken::num() const
+{
+ return m_numberValue;
+}
+
+
+
+XalanDOMString
+XPathExpression::XToken::str() const
+{
+ return m_stringValue;
+}
+
+
+
+void
+XPathExpression::XToken::ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject)
+{
+ theCallbackObject.String(*this, m_stringValue);
+}
+
+
+
+void
+XPathExpression::XToken::ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject) const
+{
+ theCallbackObject.String(*this, m_stringValue);
+}
+
+
+
+XPathExpression::XToken::eObjectType
+XPathExpression::XToken::getType() const
+{
+ return eTypeString;
+}
+
+
+
+XPathExpression::XToken&
+XPathExpression::XToken::operator=(const XalanDOMString& theString)
+{
+ m_stringValue = theString;
+
+ m_numberValue = DoubleSupport::toDouble(theString);
+
+ return *this;
+}
+
+
+
+XPathExpression::XToken&
+XPathExpression::XToken::operator=(double theNumber)
+{
+ m_stringValue = DoubleToDOMString(theNumber);
+
+ m_numberValue = theNumber;
+
+ return *this;
+}
+
+
+
XPathExpression::XPathExpression() :
m_opMap(),
m_lastOpCodeIndex(0),
m_tokenQueue(),
m_currentPosition(0),
m_patternMap(100),
- m_currentPattern(),
- m_xobjectFactory(0)
+ m_currentPattern()
{
m_opMap.reserve(eDefaultOpMapSize);
- m_tokenQueue.reserve(eDefaultTokenQueueSize);
}
@@ -278,14 +391,6 @@
using std::for_each;
#endif
- if (m_xobjectFactory != 0)
- {
- for_each(
- m_tokenQueue.begin(),
- m_tokenQueue.end(),
-
XObjectFactory::DeleteXObjectFunctor(*m_xobjectFactory));
- }
-
m_opMap.clear();
m_tokenQueue.clear();
@@ -302,11 +407,6 @@
OpCodeMapType(m_opMap).swap(m_opMap);
}
- if (m_tokenQueue.capacity() > m_tokenQueue.size())
- {
- TokenQueueType(m_tokenQueue).swap(m_tokenQueue);
- }
-
if (m_patternMap.capacity() > m_patternMap.size())
{
PatternMapType(m_patternMap).swap(m_patternMap);
@@ -678,9 +778,8 @@
void
-XPathExpression::pushArgumentOnOpCodeMap(XObject* theToken)
+XPathExpression::pushArgumentOnOpCodeMap(const XalanDOMString&
theToken)
{
- assert(theToken != 0);
assert(m_currentPosition != 0);
const TokenQueueSizeType thePosition = m_currentPosition - 1;
@@ -688,15 +787,28 @@
assert(thePosition < tokenQueueSize());
// Set the entry in the token queue to the XObject.
- XObject* const thePreviousToken = m_tokenQueue[thePosition];
- assert(thePreviousToken != 0);
-
m_tokenQueue[thePosition] = theToken;
- if (m_xobjectFactory != 0)
- {
- m_xobjectFactory->returnObject(thePreviousToken);
- }
+ // Push the index onto the op map.
+ m_opMap.push_back(thePosition);
+
+ // Update the op map length.
+ m_opMap[s__opCodeMapLengthIndex]++;
+}
+
+
+
+void
+XPathExpression::pushArgumentOnOpCodeMap(double theToken)
+{
+ assert(m_currentPosition != 0);
+
+ const TokenQueueSizeType thePosition = m_currentPosition - 1;
+
+ assert(thePosition < tokenQueueSize());
+
+ // Set the entry in the token queue to the XObject.
+ m_tokenQueue[thePosition] = theToken;
// Push the index onto the op map.
m_opMap.push_back(thePosition);
1.7 +129 -49 xml-xalan/c/src/XPath/XPathExpression.hpp
Index: XPathExpression.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathExpression.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XPathExpression.hpp 2000/07/06 20:16:28 1.6
+++ XPathExpression.hpp 2000/08/10 18:37:39 1.7
@@ -64,6 +64,7 @@
+#include <deque>
#include <map>
#include <set>
#include <vector>
@@ -84,11 +85,6 @@
-class XObject;
-class XObjectFactory;
-
-
-
class XALAN_XPATH_EXPORT XPathExpression
{
public:
@@ -736,6 +732,75 @@
FormatErrorMessage(int theOffset);
};
+ class XToken : public XObject
+ {
+ public:
+
+ XToken(const XalanDOMString& theString);
+
+ XToken(double theNumber);
+
+ XToken(const XToken& theSource);
+
+ virtual
+ ~XToken();
+
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XToken*
+#endif
+ clone(void* theAddress = 0) const;
+
+ virtual XalanDOMString
+ getTypeString() const;
+
+ virtual double
+ num() const;
+
+ virtual XalanDOMString
+ str() const;
+
+ virtual void
+ ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject);
+
+ virtual void
+ ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject) const;
+
+ virtual eObjectType
+ getType() const;
+
+ XToken&
+ operator=(const XToken& theRHS)
+ {
+ if (&theRHS != this)
+ {
+ m_stringValue = theRHS.m_stringValue;
+
+ m_numberValue = theRHS.m_numberValue;
+ }
+
+ return *this;
+ }
+
+ XToken&
+ operator=(const XalanDOMString& theString);
+
+ XToken&
+ operator=(double theNumber);
+
+ private:
+
+ // Not defined...
+ bool
+ operator==(const XToken&) const;
+
+ // Data members...
+ XalanDOMString m_stringValue;
+
+ double m_numberValue;
+ };
+
#if defined(XALAN_NO_NAMESPACES)
# define XALAN_STD
@@ -745,9 +810,7 @@
typedef XALAN_STD vector<int> OpCodeMapType;
- // $$$ ToDo: I really think that the queue should just contain strings,
not
- // XObjects, since they're always used as strings...
- typedef XALAN_STD vector<XObject*> TokenQueueType;
+ typedef XALAN_STD deque<XToken> TokenQueueType;
typedef XALAN_STD vector<int> PatternMapType;
typedef XALAN_STD map<int, int>
OpCodeLengthMapType;
@@ -762,7 +825,7 @@
typedef XALAN_STD vector<OpCodeMapValueType> OpCodeMapValueVectorType;
#undef XALAN_STD
-
+
explicit
XPathExpression();
@@ -1056,12 +1119,12 @@
* @param thePosition position in queue
* @return pointer to XObject token
*/
- XObject*
+ const XObject*
getToken(TokenQueueSizeType thePosition) const
{
assert(thePosition < tokenQueueSize());
- return m_tokenQueue[thePosition];
+ return &m_tokenQueue[thePosition];
}
/**
@@ -1069,7 +1132,7 @@
*
* @return pointer to XObject token
*/
- XObject*
+ const XObject*
getNextToken()
{
if (hasMoreTokens() == true)
@@ -1087,7 +1150,7 @@
*
* @return pointer to XObject token
*/
- XObject*
+ const XObject*
getPreviousToken()
{
if (m_currentPosition > 0)
@@ -1107,7 +1170,7 @@
* @param theOffset offset from current position
* @return pointer to XObject token
*/
- XObject*
+ const XObject*
getRelativeToken(int theOffset) const
{
const int thePosition =
@@ -1127,27 +1190,35 @@
/**
* Push a token onto the token queue.
*
- * @param theToken pointer to XObject token to push
+ * @param theToken the string value to push
*/
void
- pushToken(XObject* theToken)
+ pushToken(const XalanDOMString& theToken)
{
- assert(theToken != 0);
+ m_tokenQueue.push_back(XToken(theToken));
+ }
- m_tokenQueue.push_back(theToken);
+ /**
+ * Push a token onto the token queue.
+ *
+ * @param theToken the number value to push
+ */
+ void
+ pushToken(double theToken)
+ {
+ m_tokenQueue.push_back(XToken(theToken));
}
/**
* Replace a token in the token queue.
*
* @param theOffset the offset at which to replace the token.
- * @param theToken pointer to new XObject token
- * @return a pointer to the old token
+ * @param theToken string value for the new token
*/
- XObject*
+ void
replaceRelativeToken(
- int theOffset,
- XObject* theToken)
+ int
theOffset,
+ const XalanDOMString& theToken)
{
assert(theToken != 0);
@@ -1160,11 +1231,32 @@
throw InvalidRelativeTokenPosition(theOffset);
}
- XObject* const theOldToken = m_tokenQueue[thePosition];
-
m_tokenQueue[thePosition] = theToken;
+ }
+
+ /**
+ * Replace a token in the token queue.
+ *
+ * @param theOffset the offset at which to replace the token.
+ * @param theToken double value for the new token
+ */
+ void
+ replaceRelativeToken(
+ int theOffset,
+ double theToken)
+ {
+ assert(theToken != 0);
+
+ const int thePosition =
+ static_cast<int>(m_currentPosition) + theOffset;
+
+ if (thePosition < 0 ||
+ thePosition >= static_cast<int>(tokenQueueSize()))
+ {
+ throw InvalidRelativeTokenPosition(theOffset);
+ }
- return theOldToken;
+ m_tokenQueue[thePosition] = theToken;
}
/**
@@ -1199,12 +1291,21 @@
* Push a token onto the token queue and its index onto the operations
code
* map.
*
- * @param theToken pointer to XObject token to push
+ * @param theToken string value of the token to push
*/
void
- pushArgumentOnOpCodeMap(XObject* theToken);
+ pushArgumentOnOpCodeMap(const XalanDOMString& theToken);
/**
+ * Push a token onto the token queue and its index onto the operations
code
+ * map.
+ *
+ * @param theToken number value of the token to push
+ */
+ void
+ pushArgumentOnOpCodeMap(double theToken);
+
+ /**
* Push the current position in the token queue onto the operations code
* map.
*/
@@ -1329,35 +1430,14 @@
*/
XalanDOMString m_currentPattern;
- XObjectFactory*
- getXObjectFactory() const
- {
- return m_xobjectFactory;
- }
-
- void
- setXObjectFactory(XObjectFactory* theFactory)
- {
- m_xobjectFactory = theFactory;
- }
-
private:
// Default vector allocation sizes.
enum
{
- eDefaultTokenQueueSize = 100,
eDefaultOpMapSize = 100,
eDefaultPatternMapSize = 100
};
-
- /**
- *
- * This is the factory that was used to create any internal XObjects.
- *
- */
-
- XObjectFactory*
m_xobjectFactory;
// A map of Op codes to op code lengths.
const static OpCodeLengthMapType s_opCodeLengths;
1.7 +7 -7 xml-xalan/c/src/XPath/XPathFactory.hpp
Index: XPathFactory.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFactory.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XPathFactory.hpp 2000/07/25 14:47:25 1.6
+++ XPathFactory.hpp 2000/08/10 18:37:39 1.7
@@ -206,7 +206,7 @@
*/
XPathGuard(
XPathFactory& theFactory,
- XPath* theXPath) :
+ const XPath* theXPath) :
m_factory(&theFactory),
m_object(theXPath)
{
@@ -239,7 +239,7 @@
*
* @return pointer to XPath
*/
- XPath*
+ const XPath*
operator->() const
{
assert(m_object != 0);
@@ -252,7 +252,7 @@
*
* @return pointer to XPath
*/
- XPath*
+ const XPath*
get() const
{
return m_object;
@@ -281,10 +281,10 @@
*
* @return pointer to XPath
*/
- XPath*
+ const XPath*
release()
{
- XPath* const theTemp = m_object;
+ const XPath* const theTemp = m_object;
m_object = 0;
@@ -301,8 +301,8 @@
// Data members...
- XPathFactory* m_factory;
- XPath* m_object;
+ XPathFactory* m_factory;
+ const XPath* m_object;
};
#endif // XPATHFACTORY_HEADER_GUARD_1357924680
1.5 +0 -3 xml-xalan/c/src/XPath/XPathProcessor.hpp
Index: XPathProcessor.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessor.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathProcessor.hpp 2000/04/11 14:46:20 1.4
+++ XPathProcessor.hpp 2000/08/10 18:37:39 1.5
@@ -71,7 +71,6 @@
class Function;
class PrefixResolver;
-class XObjectFactory;
class XPath;
class XPathEnvSupport;
@@ -102,7 +101,6 @@
XPath& pathObj,
const XalanDOMString& expression,
const PrefixResolver& resolver,
- XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport) = 0;
/**
@@ -119,7 +117,6 @@
XPath& pathObj,
const XalanDOMString& expression,
const PrefixResolver& resolver,
- XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport) = 0;
/**
1.19 +4 -25 xml-xalan/c/src/XPath/XPathProcessorImpl.cpp
Index: XPathProcessorImpl.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- XPathProcessorImpl.cpp 2000/08/07 19:51:50 1.18
+++ XPathProcessorImpl.cpp 2000/08/10 18:37:39 1.19
@@ -69,7 +69,6 @@
#include "PrefixResolver.hpp"
-#include "XObjectFactory.hpp"
#include "XPathEnvSupport.hpp"
#include "XPathExecutionContext.hpp"
#include "XPathParserException.hpp"
@@ -125,7 +124,6 @@
m_xpath(0),
m_expression(0),
m_prefixResolver(0),
- m_xobjectFactory(0),
m_envSupport(0)
{
// $$$ ToDo: This is not thread-safe!!!
@@ -145,16 +143,12 @@
XPath& pathObj,
const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
- XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport)
{
m_xpath = &pathObj;
m_expression = &m_xpath->getExpression();
- m_expression->setXObjectFactory(&xobjectFactory);
-
m_prefixResolver = &prefixResolver;
- m_xobjectFactory = &xobjectFactory;
m_envSupport = &envSupport;
tokenize(expression);
@@ -168,7 +162,6 @@
m_xpath = 0;
m_expression = 0;
m_prefixResolver = 0;
- m_xobjectFactory = 0;
m_envSupport = 0;
}
@@ -179,16 +172,12 @@
XPath& pathObj,
const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
- XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport)
{
m_xpath = &pathObj;
m_expression = &m_xpath->getExpression();
- m_expression->setXObjectFactory(&xobjectFactory);
-
m_prefixResolver = &prefixResolver;
- m_xobjectFactory = &xobjectFactory;
m_envSupport = &envSupport;
m_expression->reset();
@@ -208,7 +197,6 @@
m_xpath = 0;
m_expression = 0;
m_prefixResolver = 0;
- m_xobjectFactory = 0;
m_envSupport = 0;
}
@@ -596,9 +584,8 @@
{
assert(m_xpath != 0);
assert(m_expression != 0);
- assert(m_xobjectFactory != 0);
- m_expression->pushToken(m_xobjectFactory->createString(s));
+ m_expression->pushToken(s);
}
@@ -1996,7 +1983,7 @@
m_expression->replaceRelativeToken(
-1,
-
m_xobjectFactory->createString(theNamespace));
+
theNamespace);
}
m_expression->pushCurrentTokenOnOpCodeMap();
@@ -2099,7 +2086,6 @@
{
assert(m_xpath != 0);
assert(m_expression != 0);
- assert(m_xobjectFactory != 0);
const int last = length(m_token) - 1;
@@ -2111,8 +2097,7 @@
if((c0 == '\"' && cX == '\"') ||
(c0 == '\'' && cX == '\''))
{
- XObject* const theArgument =
- m_xobjectFactory->createString(substring(m_token, 1,
last));
+ const XalanDOMString theArgument = substring(m_token, 1,
last);
m_expression->pushArgumentOnOpCodeMap(theArgument);
@@ -2133,18 +2118,12 @@
{
assert(m_xpath != 0);
assert(m_expression != 0);
- assert(m_xobjectFactory != 0);
if(0 != length(m_token))
{
- // Mutate the token to remove the quotes and have the XNumber
object
- // already made.
const double num = DoubleSupport::toDouble(m_token);
- XObject* const theArgument =
- m_xobjectFactory->createNumber(num);
-
- m_expression->pushArgumentOnOpCodeMap(theArgument);
+ m_expression->pushArgumentOnOpCodeMap(num);
nextToken();
}
1.7 +0 -4 xml-xalan/c/src/XPath/XPathProcessorImpl.hpp
Index: XPathProcessorImpl.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathProcessorImpl.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XPathProcessorImpl.hpp 2000/08/04 21:30:47 1.6
+++ XPathProcessorImpl.hpp 2000/08/10 18:37:39 1.7
@@ -122,7 +122,6 @@
XPath& pathObj,
const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
- XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport);
virtual void
@@ -130,7 +129,6 @@
XPath& pathObj,
const XalanDOMString& expression,
const PrefixResolver& prefixResolver,
- XObjectFactory& xobjectFactory,
const XPathEnvSupport& envSupport);
private:
@@ -779,8 +777,6 @@
* A pointer to the current executionContext.
*/
const PrefixResolver* m_prefixResolver;
-
- XObjectFactory* m_xobjectFactory;
const XPathEnvSupport* m_envSupport;
1.10 +10 -27 xml-xalan/c/src/XPath/XResultTreeFrag.cpp
Index: XResultTreeFrag.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XResultTreeFrag.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XResultTreeFrag.cpp 2000/07/28 22:01:57 1.9
+++ XResultTreeFrag.cpp 2000/08/10 18:37:40 1.10
@@ -76,11 +76,8 @@
-XResultTreeFrag::XResultTreeFrag(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- ResultTreeFragBase* val) :
- XObject(&envSupport, &support),
+XResultTreeFrag::XResultTreeFrag(ResultTreeFragBase* val) :
+ XObject(),
NodeRefListBase(),
m_value(val),
m_cachedStringValue(),
@@ -168,13 +165,14 @@
const XalanText* const theTextNode =
static_cast<const XalanText*>(theCurrentNode);
- if (m_support->isIgnorableWhitespace(*theTextNode) ||
+ if (theTextNode->isIgnorableWhitespace() ||
length(trim(theTextNode->getData())) == 0)
{
continue;
}
fResult = true;
+
break;
}
@@ -192,9 +190,9 @@
if (isEmpty(m_cachedStringValue) == true)
{
#if defined(XALAN_NO_MUTABLE)
- ((XResultTreeFrag*)this)->m_cachedStringValue =
m_support->getNodeData(*m_value.get());
+ ((XResultTreeFrag*)this)->m_cachedStringValue =
m_value->getXSLTData();
#else
- m_cachedStringValue = m_support->getNodeData(*m_value.get());
+ m_cachedStringValue = m_value->getXSLTData();
#endif
}
@@ -204,15 +202,15 @@
const ResultTreeFragBase&
-XResultTreeFrag::rtree() const
+XResultTreeFrag::rtree(XPathExecutionContext& /* executionContext */)
const
{
return *m_value.get();
}
-ResultTreeFragBase&
-XResultTreeFrag::rtree()
+const ResultTreeFragBase&
+XResultTreeFrag::rtree() const
{
return *m_value.get();
}
@@ -245,14 +243,6 @@
-bool
-XResultTreeFrag::equals(const XObject& theRHS) const
-{
- return ::equals(str(), theRHS.str());
-}
-
-
-
XalanNode*
XResultTreeFrag::item(unsigned int index) const
{
@@ -307,19 +297,12 @@
else
{
theIndex++;
+
theCurrentChild = theCurrentChild->getNextSibling();
}
}
return fFound == true ? theIndex : NodeRefListBase::npos;
-}
-
-
-
-XPathSupport*
-XResultTreeFrag::getSupport() const
-{
- return m_support;
}
1.11 +4 -16 xml-xalan/c/src/XPath/XResultTreeFrag.hpp
Index: XResultTreeFrag.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XResultTreeFrag.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XResultTreeFrag.hpp 2000/07/28 22:01:57 1.10
+++ XResultTreeFrag.hpp 2000/08/10 18:37:40 1.11
@@ -89,15 +89,9 @@
/**
* Construct an XResultTreeFrag object from a result tree fragment
*
- * @param envSupport XPath environment support class instance
- * @param support XPath support class instance
* @param val source result tree fragment. The XResultTreeFrag
instance will adopt the object.
- * @param deepClone true to copy all subobjects, default is false
*/
- XResultTreeFrag(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- ResultTreeFragBase* val);
+ XResultTreeFrag(ResultTreeFragBase* val);
/**
* Construct an XResultTreeFrag object from another
@@ -137,10 +131,10 @@
str() const;
virtual const ResultTreeFragBase&
- rtree() const;
+ rtree(XPathExecutionContext& executionContext) const;
- virtual ResultTreeFragBase&
- rtree();
+ virtual const ResultTreeFragBase&
+ rtree() const;
virtual const NodeRefListBase&
nodeset() const;
@@ -151,9 +145,6 @@
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject) const;
- virtual bool
- equals(const XObject& theRHS) const;
-
private:
// These methods are inherited from NodeRefListBase...
@@ -166,9 +157,6 @@
virtual unsigned int
indexOf(const XalanNode* theNode) const;
-
- virtual XPathSupport*
- getSupport() const;
virtual NodeRefListBase*
clone() const;
1.6 +4 -30 xml-xalan/c/src/XPath/XSpan.cpp
Index: XSpan.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XSpan.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSpan.cpp 2000/07/28 22:01:58 1.5
+++ XSpan.cpp 2000/08/10 18:37:40 1.6
@@ -58,13 +58,8 @@
-XSpan::XSpan(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- NodeRefListBase* value) :
- XNodeSet(envSupport,
- support,
- value),
+XSpan::XSpan(NodeRefListBase* value) :
+ XNodeSet(value),
m_start(-1),
m_end(-1)
{
@@ -72,29 +67,8 @@
-#if 0
-XSpan::XSpan(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const MutableNodeRefList& value) :
- XNodeSet(envSupport,
- support,
- value),
- m_start(-1),
- m_end(-1)
-{
-}
-#endif
-
-
-
-XSpan::XSpan(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- XalanNode& value) :
- XNodeSet(envSupport,
- support,
- value),
+XSpan::XSpan(XalanNode& value) :
+ XNodeSet(value),
m_start(-1),
m_end(-1)
{
1.7 +2 -12 xml-xalan/c/src/XPath/XSpan.hpp
Index: XSpan.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XSpan.hpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XSpan.hpp 2000/07/28 22:01:58 1.6
+++ XSpan.hpp 2000/08/10 18:37:40 1.7
@@ -76,26 +76,16 @@
/**
* Construct an XSpan object from a node list.
*
- * @param envSupport XPath environment support class instance
- * @param support XPath support class instance
* @param value source node list. The instance will adopt the
value instance.
*/
- XSpan(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- NodeRefListBase* value = 0);
+ XSpan(NodeRefListBase* value);
/**
* Construct an XSpan object from a DOM node.
*
- * @param envSupport XPath environment support class instance
- * @param support XPath support class instance
* @param value source node
*/
- XSpan(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- XalanNode& value);
+ XSpan(XalanNode& value);
XSpan(const XSpan& source);
1.11 +6 -77 xml-xalan/c/src/XPath/XString.cpp
Index: XString.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XString.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XString.cpp 2000/07/28 22:01:58 1.10
+++ XString.cpp 2000/08/10 18:37:40 1.11
@@ -70,16 +70,12 @@
#include "ResultTreeFrag.hpp"
#include "XObjectTypeCallback.hpp"
-#include "XPathEnvSupport.hpp"
-#include "XPathSupport.hpp"
+#include "XPathExecutionContext.hpp"
-XString::XString(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const XalanDOMString& val) :
- XObject(&envSupport, &support),
+XString::XString(const XalanDOMString& val) :
+ XObject(),
m_value(val),
m_cachedNumberValue(0.0),
m_resultTreeFrag(0)
@@ -168,20 +164,15 @@
const ResultTreeFragBase&
-XString::rtree() const
+XString::rtree(XPathExecutionContext& executionContext) const
{
- assert(m_support != 0);
- assert(m_envSupport != 0);
-
if (m_resultTreeFrag.get() == 0)
{
- XalanDocument* const theFactory =
- m_envSupport->getDOMFactory();
+ XalanDocument* const theFactory =
executionContext.getDOMFactory();
assert(theFactory != 0);
ResultTreeFrag* const theFrag =
- new ResultTreeFrag(*theFactory,
- *m_support);
+ new ResultTreeFrag(*theFactory);
XalanNode* const textNode =
theFactory->createTextNode(str());
@@ -213,68 +204,6 @@
}
return *m_resultTreeFrag.get();
-}
-
-
-
-ResultTreeFragBase&
-XString::rtree()
-{
- assert(m_support != 0);
- assert(m_envSupport != 0);
-
- if (m_resultTreeFrag.get() == 0)
- {
- XalanDocument* const theFactory =
- m_envSupport->getDOMFactory();
- assert(theFactory != 0);
-
- ResultTreeFrag* const theFrag =
- new ResultTreeFrag(*theFactory,
- *m_support);
-
- XalanNode* const textNode =
- theFactory->createTextNode(str());
- assert(textNode != 0);
-
- theFrag->appendChild(textNode);
-
-#if defined(XALAN_OLD_AUTO_PTR)
-
-#if !defined (XALAN_NO_NAMESPACES)
- using std::auto_ptr;
-#endif
-
-#if defined(XALAN_NO_MUTABLE)
- ((XString*)this)->m_resultTreeFrag =
auto_ptr<ResultTreeFragBase>(theFrag);
-#else
- m_resultTreeFrag = auto_ptr<ResultTreeFragBase>(theFrag);
-#endif
-
-#else
-
-#if defined(XALAN_NO_MUTABLE)
- ((XString*)this)->m_resultTreeFrag.reset(theFrag);
-#else
- m_resultTreeFrag.reset(theFrag);
-#endif
-
-#endif
- }
-
- return *m_resultTreeFrag.get();
-}
-
-
-
-const NodeRefListBase&
-XString::nodeset() const
-{
- error("Can't cast XString to NodeRefListBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<NodeRefListBase*>(0);
}
1.10 +3 -13 xml-xalan/c/src/XPath/XString.hpp
Index: XString.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XString.hpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XString.hpp 2000/07/28 22:01:59 1.9
+++ XString.hpp 2000/08/10 18:37:40 1.10
@@ -79,7 +79,7 @@
class ResultTreeFragBase;
-class XPathSupport;
+class XPathEnvSupport;
@@ -91,13 +91,9 @@
* Construct an XString object from a string.
*
* @param envSupport XPath environment support class instance
- * @param support XPath support class instance
* @param value source string
*/
- XString(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const XalanDOMString& val);
+ XString(const XalanDOMString& val);
XString(const XString& source);
@@ -130,13 +126,7 @@
str() const;
virtual const ResultTreeFragBase&
- rtree() const;
-
- virtual ResultTreeFragBase&
- rtree();
-
- virtual const NodeRefListBase&
- nodeset() const;
+ rtree(XPathExecutionContext& executionContext) const;
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject);
1.7 +2 -50 xml-xalan/c/src/XPath/XUnknown.cpp
Index: XUnknown.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XUnknown.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- XUnknown.cpp 2000/07/28 22:01:59 1.6
+++ XUnknown.cpp 2000/08/10 18:37:40 1.7
@@ -67,11 +67,8 @@
-XUnknown::XUnknown(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const XalanDOMString& name) :
- XObject(&envSupport, &support),
+XUnknown::XUnknown(const XalanDOMString& name) :
+ XObject(),
m_name(name)
{
}
@@ -144,42 +141,6 @@
-const ResultTreeFragBase&
-XUnknown::rtree() const
-{
- error("Can't cast XUnknown to ResultTreeFragBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<ResultTreeFragBase*>(0);
-}
-
-
-
-ResultTreeFragBase&
-XUnknown::rtree()
-{
- error("Can't cast XUnknown to ResultTreeFragBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<ResultTreeFragBase*>(0);
-}
-
-
-
-const NodeRefListBase&
-XUnknown::nodeset() const
-{
- error("Can't cast XUnknown to NodeRefListBase");
-
- // error will throw, so this is just a dummy
- // value to satisfy the compiler.
- return *static_cast<NodeRefListBase*>(0);
-}
-
-
-
void
XUnknown::ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject)
{
@@ -194,13 +155,4 @@
{
theCallbackObject.Unknown(*this,
m_name);
-}
-
-
-
-bool
-XUnknown::equals(const XObject& theRHS) const
-{
- return theRHS.getType() == eUnknown &&
- ::equals(m_name, static_cast<const
XUnknown&>(theRHS).m_name);
}
1.8 +1 -17 xml-xalan/c/src/XPath/XUnknown.hpp
Index: XUnknown.hpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XUnknown.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XUnknown.hpp 2000/07/28 22:01:59 1.7
+++ XUnknown.hpp 2000/08/10 18:37:40 1.8
@@ -80,13 +80,9 @@
/**
* Construct an XUnknown object from a string.
*
- * @param envSupport XPath environment support class instance
* @param name source string
*/
- XUnknown(
- XPathEnvSupport& envSupport,
- XPathSupport& support,
- const XalanDOMString& name);
+ XUnknown(const XalanDOMString& name);
XUnknown(const XUnknown& source);
@@ -117,23 +113,11 @@
virtual XalanDOMString
str() const;
- virtual const ResultTreeFragBase&
- rtree() const;
-
- virtual ResultTreeFragBase&
- rtree();
-
- virtual const NodeRefListBase&
- nodeset() const;
-
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject);
virtual void
ProcessXObjectTypeCallback(XObjectTypeCallback&
theCallbackObject) const;
-
- virtual bool
- equals(const XObject& theRHS) const;
private: