You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2003/01/03 09:03:34 UTC

cvs commit: xml-xalan/c/src/XPath XToken.cpp XToken.hpp

dbertoni    2003/01/03 00:03:34

  Modified:    c/src/XPath XToken.cpp XToken.hpp
  Log:
  Implemented boolean() member function.
  
  Revision  Changes    Path
  1.8       +20 -4     xml-xalan/c/src/XPath/XToken.cpp
  
  Index: XToken.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XToken.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XToken.cpp	21 Nov 2002 01:26:18 -0000	1.7
  +++ XToken.cpp	3 Jan 2003 08:03:34 -0000	1.8
  @@ -74,7 +74,8 @@
   XToken::XToken() :
   	XObject(eTypeString),
   	m_stringValue(),
  -	m_numberValue(DoubleSupport::getNaN())
  +	m_numberValue(DoubleSupport::getNaN()),
  +	m_isString(true)
   {
   }
   
  @@ -83,7 +84,8 @@
   XToken::XToken(const XalanDOMString&	theString) :
   	XObject(eTypeString),
   	m_stringValue(theString),
  -	m_numberValue(DoubleSupport::toDouble(theString))
  +	m_numberValue(DoubleSupport::toDouble(theString)),
  +	m_isString(true)
   {
   }
   
  @@ -92,7 +94,8 @@
   XToken::XToken(double	theNumber) :
   	XObject(eTypeString),
   	m_stringValue(DoubleToDOMString(theNumber)),
  -	m_numberValue(theNumber)
  +	m_numberValue(theNumber),
  +	m_isString(false)
   {
   }
   
  @@ -101,7 +104,8 @@
   XToken::XToken(const XToken&	theSource) :
   	XObject(theSource),
   	m_stringValue(theSource.m_stringValue),
  -	m_numberValue(theSource.m_numberValue)
  +	m_numberValue(theSource.m_numberValue),
  +	m_isString(theSource.m_isString)
   {
   }
   
  @@ -141,6 +145,14 @@
   
   
   
  +bool
  +XToken::boolean() const
  +{
  +	return m_isString == true ? XObject::boolean(m_stringValue) : XObject::boolean(m_numberValue);
  +}
  +
  +
  +
   const XalanDOMString&
   XToken::str() const
   {
  @@ -200,6 +212,8 @@
   
   	m_numberValue = DoubleSupport::toDouble(theString);
   
  +	m_isString = true;
  +
   	return *this;
   }
   
  @@ -213,6 +227,8 @@
   	DoubleToDOMString(theNumber, m_stringValue);
   
   	m_numberValue = theNumber;
  +
  +	m_isString = false;
   
   	return *this;
   }
  
  
  
  1.6       +5 -0      xml-xalan/c/src/XPath/XToken.hpp
  
  Index: XToken.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/XPath/XToken.hpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XToken.hpp	21 Nov 2002 01:26:18 -0000	1.5
  +++ XToken.hpp	3 Jan 2003 08:03:34 -0000	1.6
  @@ -102,6 +102,9 @@
   	virtual double
   	num() const;
   
  +	virtual bool
  +	boolean() const;
  +
   	virtual const XalanDOMString&
   	str() const;
   
  @@ -156,6 +159,8 @@
   	XalanDOMString	m_stringValue;
   
   	double			m_numberValue;
  +
  +	bool			m_isString;
   };
   
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org