dbertoni 00/07/06 13:16:32
Modified: c/src/XPath MutableNodeRefList.cpp MutableNodeRefList.hpp
SimpleNodeLocator.cpp XBoolean.cpp XBoolean.hpp
XNodeSet.cpp XNodeSet.hpp XNull.cpp XNull.hpp
XNumber.cpp XNumber.hpp XObject.hpp
XObjectFactory.hpp XObjectFactoryDefault.cpp
XObjectFactoryDefault.hpp XPath.cpp XPath.hpp
XPathExecutionContext.hpp
XPathExecutionContextDefault.cpp
XPathExecutionContextDefault.hpp
XPathExpression.cpp XPathExpression.hpp
XPathFactoryDefault.cpp XPathProcessorImpl.cpp
XResultTreeFrag.cpp XResultTreeFrag.hpp XSpan.cpp
XSpan.hpp XString.cpp XString.hpp XUnknown.cpp
XUnknown.hpp
Log:
Changes for cleanup of temporary XObjects. Fixed
XPathExecutionContextDefault so that it no longer makes a copy of the context
node list.
Revision Changes Path
1.10 +7 -0 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.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- MutableNodeRefList.cpp 2000/05/29 22:22:09 1.9
+++ MutableNodeRefList.cpp 2000/07/06 20:16:27 1.10
@@ -78,6 +78,7 @@
NodeRefList(),
m_support(theSupport)
{
+ m_nodeList.reserve(eDefaultVectorSize);
}
@@ -244,6 +245,12 @@
MutableNodeRefList::addNodes(const XalanNodeList& nodelist)
{
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.
+ m_nodeList.reserve(getLength() + theLength);
for (unsigned int i = 0; i < theLength; i++)
{
1.6 +9 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- MutableNodeRefList.hpp 2000/05/05 15:12:17 1.5
+++ MutableNodeRefList.hpp 2000/07/06 20:16:27 1.6
@@ -218,6 +218,15 @@
virtual XPathSupport*
getSupport() const;
+protected:
+
+ // Default vector allocation size. It seems high, but
+ // it's really worth it...
+ enum
+ {
+ eDefaultVectorSize = 1000
+ };
+
private:
XPathSupport* m_support;
1.16 +20 -8 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.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- SimpleNodeLocator.cpp 2000/06/08 17:52:18 1.15
+++ SimpleNodeLocator.cpp 2000/07/06 20:16:27 1.16
@@ -167,9 +167,11 @@
if(XPathExpression::eOP_LOCATIONPATH == value)
{
- XObject* const xnl =
xpath.locationPath(doc, opPos, executionContext);
+ const XObjectGuard
xnl(
+
executionContext.getXObjectFactory(),
+
xpath.locationPath(doc, opPos, executionContext));
- if(0 != xnl)
+ if(0 != xnl.get())
{
theNodeList.addNodes(xnl->nodeset());
@@ -462,7 +464,10 @@
{
argLen = currentExpression.getOpCodeLength(opPos);
- const XObject* const obj =
xpath.executeMore(localContext, opPos, executionContext);
+ const XObjectGuard obj(
+
executionContext.getXObjectFactory(),
+
xpath.executeMore(localContext, opPos, executionContext));
+ assert(obj.get() != 0);
const NodeRefListBase& nl = obj->nodeset();
@@ -607,8 +612,10 @@
while(XPathExpression::eOP_PREDICATE == nextStepType)
{
- const XObject* const pred =
- xpath.predicate(localContext, opPos,
executionContext);
+ const XObjectGuard pred(
+
executionContext.getXObjectFactory(),
+
xpath.predicate(localContext, opPos, executionContext));
+ assert(pred.get() != 0);
if(XObject::eTypeNumber == pred->getType())
{
@@ -682,8 +689,11 @@
const XPathExpression& currentExpression =
xpath.getExpression();
- const XObject* const obj = xpath.executeMore(context, opPos,
executionContext);
+ const XObjectGuard obj(
+ executionContext.getXObjectFactory(),
+ xpath.executeMore(context, opPos,
executionContext));
+
const NodeRefListBase& nl = obj->nodeset();
// Should this be adding in doc order?
@@ -1704,8 +1714,10 @@
XalanNode* const theNode =
subQueryResults.item(i);
assert(theNode != 0);
- XObject* const pred = xpath.predicate(theNode,
opPos, executionContext);
- assert(pred != 0);
+ const XObjectGuard pred(
+
executionContext.getXObjectFactory(),
+ xpath.predicate(theNode, opPos,
executionContext));
+ assert(pred.get() != 0);
// Remove any node that doesn't satisfy the predicate.
if(XObject::eTypeNumber == pred->getType() &&
1.4 +12 -0 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XBoolean.cpp 2000/05/03 21:21:14 1.3
+++ XBoolean.cpp 2000/07/06 20:16:27 1.4
@@ -103,6 +103,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XBoolean*
+#endif
+XBoolean::clone() const
+{
+ return new XBoolean(*this);
+};
+
+
+
XBoolean::eObjectType
XBoolean::getType() const
{
1.5 +7 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XBoolean.hpp 2000/05/03 21:21:14 1.4
+++ XBoolean.hpp 2000/07/06 20:16:27 1.5
@@ -89,6 +89,13 @@
// These methods are inherited from XObject ...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XBoolean*
+#endif
+ clone() const;
+
virtual eObjectType
getType() const;
1.6 +12 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XNodeSet.cpp 2000/05/03 21:21:14 1.5
+++ XNodeSet.cpp 2000/07/06 20:16:27 1.6
@@ -130,6 +130,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XNodeSet*
+#endif
+XNodeSet::clone() const
+{
+ return new XNodeSet(*this, false);
+};
+
+
+
XNodeSet::eObjectType
XNodeSet::getType() const
{
1.6 +7 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XNodeSet.hpp 2000/05/03 21:21:14 1.5
+++ XNodeSet.hpp 2000/07/06 20:16:27 1.6
@@ -144,6 +144,13 @@
// These methods are inherited from XObject ...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XNodeSet*
+#endif
+ clone() const;
+
virtual eObjectType
getType() const;
1.4 +12 -0 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XNull.cpp 2000/05/03 21:21:15 1.3
+++ XNull.cpp 2000/07/06 20:16:27 1.4
@@ -96,6 +96,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XNull*
+#endif
+XNull::clone() const
+{
+ return new XNull(*this, false);
+};
+
+
+
XNull::eObjectType
XNull::getType() const
{
1.5 +7 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XNull.hpp 2000/05/03 21:21:15 1.4
+++ XNull.hpp 2000/07/06 20:16:27 1.5
@@ -114,6 +114,13 @@
// These methods are inherited from XObject ...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XNull*
+#endif
+ clone() const;
+
virtual eObjectType
getType() const;
1.5 +12 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XNumber.cpp 2000/06/29 21:09:46 1.4
+++ XNumber.cpp 2000/07/06 20:16:27 1.5
@@ -93,6 +93,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XNumber*
+#endif
+XNumber::clone() const
+{
+ return new XNumber(*this);
+};
+
+
+
XNumber::eObjectType
XNumber::getType() const
{
1.5 +7 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XNumber.hpp 2000/05/03 21:21:15 1.4
+++ XNumber.hpp 2000/07/06 20:16:27 1.5
@@ -95,6 +95,13 @@
// These methods are inherited from XObject ...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XNumber*
+#endif
+ clone() const;
+
virtual eObjectType
getType() const;
1.6 +8 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XObject.hpp 2000/05/03 21:21:15 1.5
+++ XObject.hpp 2000/07/06 20:16:28 1.6
@@ -101,6 +101,14 @@
XObject(const XObject& source);
/**
+ * Clone the instance
+ *
+ * @return a clone of the instance.
+ */
+ virtual XObject*
+ clone() const = 0;
+
+ /**
* Given a request type, return the equivalent string.
* For diagnostic purposes.
*
1.5 +9 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XObjectFactory.hpp 2000/04/11 14:46:15 1.4
+++ XObjectFactory.hpp 2000/07/06 20:16:28 1.5
@@ -111,6 +111,15 @@
// These interfaces are new to XObjectFactory...
/**
+ * Clone an XObject instance, and hold in the factory.
+ *
+ * @param theXObject the instance to clone
+ * @return a clone of the instance.
+ */
+ virtual XObject*
+ clone(const XObject& theXObject) = 0;
+
+ /**
* Create a boolean XObject from a boolean value.
*
* @param theValue value used to create object
1.8 +28 -1 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XObjectFactoryDefault.cpp 2000/05/03 21:21:15 1.7
+++ XObjectFactoryDefault.cpp 2000/07/06 20:16:28 1.8
@@ -149,6 +149,33 @@
XObject*
+XObjectFactoryDefault::clone(const XObject& theXObject)
+{
+ if (&theXObject == &theTrueBoolean)
+ {
+ return &theTrueBoolean;
+ }
+ else if (&theXObject == &theFalseBoolean)
+ {
+ return &theFalseBoolean;
+ }
+ else if (&theXObject == m_XNull)
+ {
+ return m_XNull;
+ }
+ else
+ {
+ XObject* const theClone = theXObject.clone();
+
+ m_xobjects.insert(theClone);
+
+ return theClone;
+ }
+}
+
+
+
+XObject*
XObjectFactoryDefault::createBoolean(
bool theValue,
bool fOptimize)
@@ -384,7 +411,7 @@
for_each(m_xobjects.begin(),
m_xobjects.end(),
- DeleteFactoryObjectFunctor(*this, true));
+ ProtectedDeleteFactoryObjectFunctor(*this, true));
m_xobjects.clear();
}
1.6 +4 -1 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XObjectFactoryDefault.hpp 2000/04/11 14:46:15 1.5
+++ XObjectFactoryDefault.hpp 2000/07/06 20:16:28 1.6
@@ -106,7 +106,10 @@
reset();
// These methods are inherited from XObjectFactory ...
-
+
+ virtual XObject*
+ clone(const XObject& theXObject);
+
virtual XObject*
createBoolean(
bool theValue,
1.19 +193 -80 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.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- XPath.cpp 2000/05/24 19:36:03 1.18
+++ XPath.cpp 2000/07/06 20:16:28 1.19
@@ -509,6 +509,8 @@
{
int opPos = 2;
+ targetStrings.reserve(eDefaultTargetStringsSize);
+
while(m_expression.m_opMap[opPos] ==
XPathExpression::eOP_LOCATIONPATHPATTERN)
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
@@ -637,18 +639,28 @@
{
XObject* score = 0;
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+
while(m_expression.m_opMap[opPos] ==
XPathExpression::eOP_LOCATIONPATHPATTERN)
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
score = executeMore(context, opPos, executionContext);
+ assert(score != 0);
if(score->num() != s_MatchScoreNone)
{
break;
}
+ else
+ {
+ // We're done with this object, so return it...
+ theFactory.returnObject(score);
- opPos = nextOpPos;
+ score = 0;
+
+ opPos = nextOpPos;
+ }
}
if(0 == score)
@@ -682,9 +694,11 @@
XPathExecutionContext& executionContext) const
{
opPos += 2;
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
bool fResult = expr1->boolean();
@@ -692,13 +706,13 @@
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
fResult = expr2->boolean();
}
- return executionContext.getXObjectFactory().createBoolean(fResult);
+ return theFactory.createBoolean(fResult);
}
@@ -713,15 +727,17 @@
opPos += 2;
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
+
if (expr1->boolean() == true)
{
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
if (expr2->boolean() == true)
{
@@ -729,7 +745,7 @@
}
}
- return executionContext.getXObjectFactory().createBoolean(fResult);
+ return theFactory.createBoolean(fResult);
}
@@ -741,16 +757,18 @@
XPathExecutionContext& executionContext) const
{
opPos += 2;
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return executionContext.getXObjectFactory().createBoolean(*expr1 !=
*expr2);
+ return theFactory.createBoolean(*expr1.get() != *expr2.get());
}
@@ -763,15 +781,17 @@
{
opPos += 2;
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
+
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return executionContext.getXObjectFactory().createBoolean(*expr1 ==
*expr2);
+ return theFactory.createBoolean(*expr1.get() == *expr2.get());
}
@@ -783,16 +803,18 @@
XPathExecutionContext& executionContext) const
{
opPos += 2;
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return executionContext.getXObjectFactory().createBoolean(*expr1 <=
*expr2);
+ return theFactory.createBoolean(*expr1.get() <= *expr2.get());
}
@@ -805,15 +827,17 @@
{
opPos += 2;
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
+
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return executionContext.getXObjectFactory().createBoolean(*expr1 <
*expr2);
+ return theFactory.createBoolean(*expr1.get() < *expr2.get());
}
@@ -825,16 +849,18 @@
XPathExecutionContext& executionContext) const
{
opPos += 2;
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return executionContext.getXObjectFactory().createBoolean(*expr1 >=
*expr2);
+ return theFactory.createBoolean(*expr1.get() >= *expr2.get());
}
@@ -847,15 +873,17 @@
{
opPos += 2;
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
+
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return executionContext.getXObjectFactory().createBoolean(*expr1 >
*expr2);
+ return theFactory.createBoolean(*expr1.get() > *expr2.get());
}
@@ -867,16 +895,18 @@
XPathExecutionContext& executionContext) const
{
opPos += 2;
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return
executionContext.getXObjectFactory().createNumber(DoubleSupport::add(expr1->num(),
expr2->num()));
+ return theFactory.createNumber(DoubleSupport::add(expr1->num(),
expr2->num()));
}
@@ -889,15 +919,17 @@
{
opPos += 2;
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
+
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return
executionContext.getXObjectFactory().createNumber(DoubleSupport::subtract(expr1->num(),
expr2->num()));
+ return theFactory.createNumber(DoubleSupport::subtract(expr1->num(),
expr2->num()));
}
@@ -909,16 +941,18 @@
XPathExecutionContext& executionContext) const
{
opPos += 2;
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return
executionContext.getXObjectFactory().createNumber(DoubleSupport::multiply(expr1->num(),
expr2->num()));
+ return theFactory.createNumber(DoubleSupport::multiply(expr1->num(),
expr2->num()));
}
@@ -931,15 +965,17 @@
{
opPos += 2;
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
+
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return
executionContext.getXObjectFactory().createNumber(DoubleSupport::divide(expr1->num(),
expr2->num()));
+ return theFactory.createNumber(DoubleSupport::divide(expr1->num(),
expr2->num()));
}
@@ -951,16 +987,18 @@
XPathExecutionContext& executionContext) const
{
opPos += 2;
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- XObject* const expr1 = executeMore(context, opPos, executionContext);
- assert(expr1 != 0);
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos,
executionContext));
+ assert(expr1.get() != 0);
const int expr2Pos =
m_expression.getNextOpCodePosition(opPos);
- XObject* const expr2 = executeMore(context, expr2Pos,
executionContext);
- assert(expr2 != 0);
+ const XObjectGuard expr2(theFactory, executeMore(context,
expr2Pos, executionContext));
+ assert(expr2.get() != 0);
- return
executionContext.getXObjectFactory().createNumber(DoubleSupport::modulus(expr1->num(),
expr2->num()));
+ return theFactory.createNumber(DoubleSupport::modulus(expr1->num(),
expr2->num()));
}
@@ -985,10 +1023,12 @@
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+
+ const XObjectGuard expr1(theFactory, executeMore(context, opPos +
2, executionContext));
+ assert(expr1.get() != 0);
- return
executionContext.getXObjectFactory().createNumber(DoubleSupport::negative(expr1->num()));
+ return theFactory.createNumber(DoubleSupport::negative(expr1->num()));
}
@@ -999,10 +1039,21 @@
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+
+ XObjectGuard expr1(theFactory, executeMore(context, opPos + 2,
executionContext));
+ assert(expr1.get() != 0);
- return executionContext.getXObjectFactory().createString(expr1->str());
+ // Try to optimize when the result of the execution is
+ // already a string.
+ if (expr1->getType() == XObject::eTypeString)
+ {
+ return expr1.release();
+ }
+ else
+ {
+ return theFactory.createString(expr1->str());
+ }
}
@@ -1013,10 +1064,21 @@
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+
+ XObjectGuard expr1(theFactory, executeMore(context, opPos + 2,
executionContext));
+ assert(expr1.get() != 0);
- return
executionContext.getXObjectFactory().createBoolean(expr1->boolean());
+ // Try to optimize when the result of the execution is
+ // already a string.
+ if (expr1->getType() == XObject::eTypeBoolean)
+ {
+ return expr1.release();
+ }
+ else
+ {
+ return theFactory.createBoolean(expr1->boolean());
+ }
}
@@ -1027,10 +1089,21 @@
int opPos,
XPathExecutionContext& executionContext) const
{
- XObject* const expr1 = executeMore(context, opPos + 2,
executionContext);
- assert(expr1 != 0);
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
- return executionContext.getXObjectFactory().createNumber(expr1->num());
+ XObjectGuard expr1(theFactory, executeMore(context, opPos + 2,
executionContext));
+ assert(expr1.get() != 0);
+
+ // Try to optimize when the result of the execution is
+ // already a string.
+ if (expr1->getType() == XObject::eTypeNumber)
+ {
+ return expr1.release();
+ }
+ else
+ {
+ return theFactory.createNumber(expr1->num());
+ }
}
@@ -1045,6 +1118,8 @@
XObject* resultNodeSet = 0;
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+
while(m_expression.m_opMap[opPos] != XPathExpression::eENDOP)
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
@@ -1061,6 +1136,8 @@
resultNodeSet->mutableNodeset();
nl.addNodesInDocOrder(expr->nodeset());
+
+ theFactory.returnObject(expr);
}
opPos = nextOpPos;
@@ -1119,6 +1196,12 @@
varName->str(),
context);
}
+ else
+ {
+ // Always clone the result of getting a variable, since it
doesn't
+ // necessarily belong to our context.
+ result = executionContext.getXObjectFactory().clone(*result);
+ }
return result;
}
@@ -1272,6 +1355,8 @@
Function::XObjectArgVectorType args;
+ args.reserve(eDefaultArgVectorSize);
+
while(opPos < endExtFunc)
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
@@ -1280,8 +1365,21 @@
opPos = nextOpPos;
}
+
+ XObject* const theResult =
+ extfunction(context, opPos, ns->str(), funcName->str(), args,
executionContext);
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+
+ // Return the args...
+ while(args.size() > 0)
+ {
+ theFactory.returnObject(args.back());
+
+ args.pop_back();
+ }
- return extfunction(context, opPos, ns->str(), funcName->str(), args,
executionContext);
+ return theResult;
}
@@ -1321,6 +1419,8 @@
Function::XObjectArgVectorType args;
+ args.reserve(eDefaultArgVectorSize);
+
while(opPos < endFunc)
{
const int nextOpPos =
m_expression.getNextOpCodePosition(opPos);
@@ -1329,8 +1429,21 @@
opPos = nextOpPos;
}
+
+ XObject* const theResult =
+ function(context, opPos, funcID, args, executionContext);
+
+ XObjectFactory& theFactory =
executionContext.getXObjectFactory();
+
+ // Return the args...
+ while(args.size() > 0)
+ {
+ theFactory.returnObject(args.back());
+
+ args.pop_back();
+ }
- return function(context, opPos, funcID, args, executionContext);
+ return theResult;
}
1.9 +7 -1 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.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- XPath.hpp 2000/05/26 19:20:40 1.8
+++ XPath.hpp 2000/07/06 20:16:28 1.9
@@ -95,7 +95,6 @@
class PrefixResolver;
class XLocator;
class XObject;
-class XObjectFactory;
class XPathEnvSupport;
class XPathSupport;
class XalanNode;
@@ -823,6 +822,13 @@
bool
operator==(const XPath&) const;
+
+ // Default vector allocation sizes.
+ enum
+ {
+ eDefaultTargetStringsSize = 5,
+ eDefaultArgVectorSize = 5 // for function call parameters
+ };
// Data members...
1.15 +2 -2 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.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- XPathExecutionContext.hpp 2000/06/01 16:27:23 1.14
+++ XPathExecutionContext.hpp 2000/07/06 20:16:28 1.15
@@ -270,8 +270,8 @@
private:
- XPathExecutionContext& m_executionContext;
- const MutableNodeRefList m_savedNodeList;
+ XPathExecutionContext& m_executionContext;
+ const NodeRefListBase& m_savedNodeList;
};
/*
1.11 +7 -7 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.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- XPathExecutionContextDefault.cpp 2000/06/01 16:27:23 1.10
+++ XPathExecutionContextDefault.cpp 2000/07/06 20:16:28 1.11
@@ -82,7 +82,7 @@
m_xpathSupport(theXPathSupport),
m_xobjectFactory(theXObjectFactory),
m_currentNode(theCurrentNode),
- m_contextNodeList(theContextNodeList),
+ m_contextNodeList(&theContextNodeList),
m_prefixResolver(thePrefixResolver),
m_throwFoundIndex(false)
{
@@ -183,7 +183,7 @@
const NodeRefListBase&
XPathExecutionContextDefault::getContextNodeList() const
{
- return m_contextNodeList;
+ return *m_contextNodeList;
}
@@ -191,7 +191,7 @@
void
XPathExecutionContextDefault::setContextNodeList(const NodeRefListBase&
theList)
{
- m_contextNodeList = theList;
+ m_contextNodeList = &theList;
}
@@ -204,7 +204,7 @@
throw FoundIndex();
}
- return m_contextNodeList.getLength();
+ return m_contextNodeList->getLength();
}
@@ -219,11 +219,11 @@
int pos = 0;
- const int nNodes = m_contextNodeList.getLength();
+ const unsigned int nNodes = m_contextNodeList->getLength();
- for(int i = 0; i < nNodes; i++)
+ for(unsigned int i = 0; i < nNodes; i++)
{
- if(m_contextNodeList.item(i) == &contextNode)
+ if(m_contextNodeList->item(i) == &contextNode)
{
pos = i + 1; // for 1-based XSL count.
1.13 +3 -1 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.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- XPathExecutionContextDefault.hpp 2000/06/01 16:27:23 1.12
+++ XPathExecutionContextDefault.hpp 2000/07/06 20:16:28 1.13
@@ -77,9 +77,11 @@
#include <XPath/XPathExecutionContext.hpp>
+
class XPathEnvSupport;
+
/**
* A basic implementation of the class XPathExecutionContext.
*/
@@ -292,7 +294,7 @@
XalanNode* m_currentNode;
- MutableNodeRefList m_contextNodeList;
+ const NodeRefListBase* m_contextNodeList;
const PrefixResolver* m_prefixResolver;
1.8 +42 -7 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.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- XPathExpression.cpp 2000/05/05 15:10:32 1.7
+++ XPathExpression.cpp 2000/07/06 20:16:28 1.8
@@ -59,6 +59,14 @@
+#include <algorithm>
+
+
+
+#include "XObjectFactory.hpp"
+
+
+
#include <cstdio>
#include <strstream>
@@ -246,16 +254,18 @@
m_tokenQueue(),
m_currentPosition(0),
m_patternMap(100),
- m_currentPattern()
+ m_currentPattern(),
+ m_xobjectFactory(0)
{
- m_opMap.reserve(100);
- m_tokenQueue.reserve(100);
+ m_opMap.reserve(eDefaultOpMapSize);
+ m_tokenQueue.reserve(eDefaultTokenQueueSize);
}
XPathExpression::~XPathExpression()
{
+ reset();
}
@@ -263,9 +273,23 @@
void
XPathExpression::reset()
{
+#if !defined(XALAN_NO_NAMESPACES)
+ using std::fill;
+ using std::for_each;
+#endif
+
+ if (m_xobjectFactory != 0)
+ {
+ for_each(
+ m_tokenQueue.begin(),
+ m_tokenQueue.end(),
+ DeleteFactoryObjectFunctor(*m_xobjectFactory));
+ }
+
m_opMap.clear();
m_tokenQueue.clear();
- m_patternMap.clear();
+
+ fill(m_patternMap.begin(), m_patternMap.end(), 0);
}
@@ -273,9 +297,20 @@
void
XPathExpression::shrink()
{
- OpCodeMapType(m_opMap).swap(m_opMap);
- TokenQueueType(m_tokenQueue).swap(m_tokenQueue);
- PatternMapType(m_patternMap).swap(m_patternMap);
+ if (m_opMap.capacity() > m_opMap.size())
+ {
+ 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);
+ }
}
1.6 +37 -5 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XPathExpression.hpp 2000/05/03 21:21:16 1.5
+++ XPathExpression.hpp 2000/07/06 20:16:28 1.6
@@ -85,6 +85,7 @@
class XObject;
+class XObjectFactory;
@@ -743,6 +744,9 @@
#endif
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 vector<int> PatternMapType;
typedef XALAN_STD map<int, int>
OpCodeLengthMapType;
@@ -887,9 +891,9 @@
*/
void
setOpCodeArgs(
- eOpCodes
theOpCode,
- OpCodeMapSizeType
theIndex,
- const OpCodeMapValueVectorType& theArgs);
+ eOpCodes
theOpCode,
+ OpCodeMapSizeType
theIndex,
+ const OpCodeMapValueVectorType& theArgs);
/**
* Add an operation code to the list.
@@ -906,8 +910,8 @@
* @param theArgs vector or arguments to supply
*/
void
- appendOpCode(eOpCodes
theOpCode,
- const OpCodeMapValueVectorType&
theArgs)
+ appendOpCode(eOpCodes
theOpCode,
+ const OpCodeMapValueVectorType& theArgs)
{
appendOpCode(theOpCode);
@@ -1325,7 +1329,35 @@
*/
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.5 +1 -1 xml-xalan/c/src/XPath/XPathFactoryDefault.cpp
Index: XPathFactoryDefault.cpp
===================================================================
RCS file: /home/cvs/xml-xalan/c/src/XPath/XPathFactoryDefault.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XPathFactoryDefault.cpp 2000/04/11 14:46:19 1.4
+++ XPathFactoryDefault.cpp 2000/07/06 20:16:28 1.5
@@ -94,7 +94,7 @@
for_each(m_xpaths.begin(),
m_xpaths.end(),
- DeleteFactoryObjectFunctor(*this, true));
+ ProtectedDeleteFactoryObjectFunctor(*this, true));
m_xpaths.clear();
}
1.14 +6 -0 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.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- XPathProcessorImpl.cpp 2000/05/31 16:57:37 1.13
+++ XPathProcessorImpl.cpp 2000/07/06 20:16:28 1.14
@@ -149,6 +149,9 @@
{
m_xpath = &pathObj;
m_expression = &m_xpath->getExpression();
+
+ m_expression->setXObjectFactory(&xobjectFactory);
+
m_prefixResolver = &prefixResolver;
m_xobjectFactory = &xobjectFactory;
m_envSupport = &envSupport;
@@ -180,6 +183,9 @@
{
m_xpath = &pathObj;
m_expression = &m_xpath->getExpression();
+
+ m_expression->setXObjectFactory(&xobjectFactory);
+
m_prefixResolver = &prefixResolver;
m_xobjectFactory = &xobjectFactory;
m_envSupport = &envSupport;
1.5 +12 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XResultTreeFrag.cpp 2000/05/03 21:21:17 1.4
+++ XResultTreeFrag.cpp 2000/07/06 20:16:28 1.5
@@ -105,6 +105,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XResultTreeFrag*
+#endif
+XResultTreeFrag::clone() const
+{
+ return new XResultTreeFrag(*this, false);
+};
+
+
+
XResultTreeFrag::eObjectType
XResultTreeFrag::getType() const
{
1.6 +7 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XResultTreeFrag.hpp 2000/05/03 21:21:17 1.5
+++ XResultTreeFrag.hpp 2000/07/06 20:16:28 1.6
@@ -115,6 +115,13 @@
// These methods are inherited from XObject ...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XResultTreeFrag*
+#endif
+ clone() const;
+
virtual eObjectType
getType() const;
1.3 +12 -0 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.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- XSpan.cpp 2000/04/11 14:46:23 1.2
+++ XSpan.cpp 2000/07/06 20:16:28 1.3
@@ -115,6 +115,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XSpan*
+#endif
+XSpan::clone() const
+{
+ return new XSpan(*this);
+};
+
+
+
int
XSpan::getStart() const
{
1.4 +7 -0 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XSpan.hpp 2000/04/11 14:46:23 1.3
+++ XSpan.hpp 2000/07/06 20:16:28 1.4
@@ -114,6 +114,13 @@
virtual
~XSpan();
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XSpan*
+#endif
+ clone() const;
+
/**
* Get the start span offset from the first node, or -1 if offset isn't
* set.
1.5 +12 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XString.cpp 2000/05/03 21:21:18 1.4
+++ XString.cpp 2000/07/06 20:16:28 1.5
@@ -103,6 +103,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XString*
+#endif
+XString::clone() const
+{
+ return new XString(*this);
+};
+
+
+
XString::eObjectType
XString::getType() const
{
1.6 +7 -0 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XString.hpp 2000/05/03 21:21:18 1.5
+++ XString.hpp 2000/07/06 20:16:28 1.6
@@ -107,6 +107,13 @@
// These methods are inherited from XObject ...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XString*
+#endif
+ clone() const;
+
virtual eObjectType
getType() const;
1.4 +12 -0 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.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- XUnknown.cpp 2000/05/03 21:21:18 1.3
+++ XUnknown.cpp 2000/07/06 20:16:29 1.4
@@ -92,6 +92,18 @@
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+XObject*
+#else
+XUnknown*
+#endif
+XUnknown::clone() const
+{
+ return new XUnknown(*this);
+};
+
+
+
XUnknown::eObjectType
XUnknown::getType() const
{
1.5 +7 -0 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- XUnknown.hpp 2000/05/03 21:21:18 1.4
+++ XUnknown.hpp 2000/07/06 20:16:29 1.5
@@ -95,6 +95,13 @@
// These methods are inherited from XObject ...
+#if defined(XALAN_NO_COVARIANT_RETURN_TYPE)
+ virtual XObject*
+#else
+ virtual XUnknown*
+#endif
+ clone() const;
+
virtual eObjectType
getType() const;