dbertoni 2003/01/03 00:03:14
Modified: c/src/XPath XObject.cpp XObject.hpp
Log:
New conversion functions.
Revision Changes Path
1.32 +35 -0 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.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- XObject.cpp 2 Jan 2003 17:39:08 -0000 1.31
+++ XObject.cpp 3 Jan 2003 08:03:14 -0000 1.32
@@ -144,6 +144,41 @@
+double
+XObject::number(
+ XPathExecutionContext& executionContext,
+ const XalanNode& theNode)
+{
+ XPathExecutionContext::GetAndReleaseCachedString
theGuard(executionContext);
+
+ XalanDOMString& theString = theGuard.get();
+
+ XObject::string(theNode, theString);
+
+ return XObject::number(theString);
+}
+
+
+
+double
+XObject::number(
+ XPathExecutionContext& executionContext,
+ const NodeRefListBase& theNodeList)
+{
+ if (theNodeList.getLength() == 0)
+ {
+ return number(s_nullString);
+ }
+ else
+ {
+ assert(theNodeList.item(0) != 0);
+
+ return number(executionContext, *theNodeList.item(0));
+ }
+}
+
+
+
void
XObject::dereferenced()
{
1.26 +51 -19 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.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- XObject.hpp 2 Jan 2003 17:39:08 -0000 1.25
+++ XObject.hpp 3 Jan 2003 08:03:14 -0000 1.26
@@ -340,7 +340,7 @@
static bool
boolean(double theNumber)
{
- return DoubleSupport::isNaN(theNumber) ||
DoubleSupport::isPositiveZero(theNumber) ? false : true;
+ return !DoubleSupport::isNaN(theNumber) &&
!DoubleSupport::equal(theNumber, 0.0);
}
/**
@@ -392,31 +392,48 @@
}
}
+ /**
+ * Static conversion function.
+ *
+ * @return The string value of the number
+ */
static void
string(
- const NodeRefListBase& theNodeList,
- FormatterListener& formatterListener,
- MemberFunctionPtr function)
+ double theNumber,
+ XalanDOMString& theString)
{
- if (theNodeList.getLength() > 0)
- {
- assert(theNodeList.item(0) != 0);
+ DoubleToDOMString(theNumber, theString);
+ }
- DOMServices::getNodeData(*theNodeList.item(0),
formatterListener, function);
- }
+ static void
+ string(
+ double theNumber,
+ FormatterListener& formatterListener,
+ MemberFunctionPtr function)
+ {
+ DOMStringHelper::DoubleToCharacters(theNumber,
formatterListener, function);
}
/**
* Static conversion function.
*
- * @return The string value of the number
+ * @return The string value of the node
*/
static void
string(
- double theNumber,
+ const XalanNode& theNode,
XalanDOMString& theString)
{
- DoubleToDOMString(theNumber, theString);
+ DOMServices::getNodeData(theNode, theString);
+ }
+
+ static void
+ string(
+ const XalanNode& theNode,
+ FormatterListener& formatterListener,
+ MemberFunctionPtr function)
+ {
+ DOMServices::getNodeData(theNode, formatterListener, function);
}
/**
@@ -433,17 +450,22 @@
{
assert(theNodeList.item(0) != 0);
- DOMServices::getNodeData(*theNodeList.item(0),
theString);
+ string(*theNodeList.item(0), theString);
}
}
static void
string(
- double theNumber,
- FormatterListener& formatterListener,
- MemberFunctionPtr function)
+ const NodeRefListBase& theNodeList,
+ FormatterListener& formatterListener,
+ MemberFunctionPtr function)
{
- DOMStringHelper::DoubleToCharacters(theNumber,
formatterListener, function);
+ if (theNodeList.getLength() > 0)
+ {
+ assert(theNodeList.item(0) != 0);
+
+ DOMServices::getNodeData(*theNodeList.item(0),
formatterListener, function);
+ }
}
/**
@@ -470,8 +492,18 @@
*/
static double
number(
- XPathExecutionContext& executionContext,
- const MutableNodeRefList& theNodeList);
+ XPathExecutionContext& executionContext,
+ const NodeRefListBase& theNodeList);
+
+ /**
+ * Static conversion function.
+ *
+ * @return The number value of the node
+ */
+ static double
+ number(
+ XPathExecutionContext& executionContext,
+ const XalanNode& theNode);
// All XObject instances are controlled by an instance of an
XObjectFactory.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]