tng 2003/01/30 13:55:22 Modified: c/src/xercesc/util XMLAbstractDoubleFloat.cpp XMLAbstractDoubleFloat.hpp XMLBigDecimal.cpp XMLBigDecimal.hpp XMLBigInteger.hpp XMLDateTime.cpp XMLDateTime.hpp XMLNumber.hpp Log: Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory. Revision Changes Path 1.8 +8 -1 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp Index: XMLAbstractDoubleFloat.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- XMLAbstractDoubleFloat.cpp 11 Dec 2002 00:20:02 -0000 1.7 +++ XMLAbstractDoubleFloat.cpp 30 Jan 2003 21:55:22 -0000 1.8 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.8 2003/01/30 21:55:22 tng + * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory. + * * Revision 1.7 2002/12/11 00:20:02 peiyongz * Doing businesss in value space. Converting out-of-bound value into special values. * @@ -179,6 +182,10 @@ return XMLString::replicate(fRawData); } +XMLCh* XMLAbstractDoubleFloat::getRawData() const +{ + return fRawData; +} int XMLAbstractDoubleFloat::getSign() const { return fSign; 1.7 +6 -1 xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp Index: XMLAbstractDoubleFloat.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLAbstractDoubleFloat.hpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- XMLAbstractDoubleFloat.hpp 11 Dec 2002 00:20:02 -0000 1.6 +++ XMLAbstractDoubleFloat.hpp 30 Jan 2003 21:55:22 -0000 1.7 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.7 2003/01/30 21:55:22 tng + * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory. + * * Revision 1.6 2002/12/11 00:20:02 peiyongz * Doing businesss in value space. Converting out-of-bound value into special values. * @@ -145,6 +148,8 @@ virtual ~XMLAbstractDoubleFloat(); virtual XMLCh* toString() const; + + virtual XMLCh* getRawData() const; virtual int getSign() const; 1.4 +8 -0 xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp Index: XMLBigDecimal.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigDecimal.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- XMLBigDecimal.cpp 4 Nov 2002 15:22:05 -0000 1.3 +++ XMLBigDecimal.cpp 30 Jan 2003 21:55:22 -0000 1.4 @@ -56,6 +56,9 @@ /* * $Log$ + * Revision 1.4 2003/01/30 21:55:22 tng + * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory. + * * Revision 1.3 2002/11/04 15:22:05 tng * C++ Namespace Support. * @@ -354,6 +357,11 @@ } return; +} + +XMLCh* XMLBigDecimal::getRawData() const +{ + return fRawData; } // 1.5 +3 -1 xml-xerces/c/src/xercesc/util/XMLBigDecimal.hpp Index: XMLBigDecimal.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigDecimal.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XMLBigDecimal.hpp 4 Nov 2002 15:22:05 -0000 1.4 +++ XMLBigDecimal.hpp 30 Jan 2003 21:55:22 -0000 1.5 @@ -105,6 +105,8 @@ virtual XMLCh* toString() const; + + virtual XMLCh* getRawData() const; virtual int getSign() const; 1.5 +62 -50 xml-xerces/c/src/xercesc/util/XMLBigInteger.hpp Index: XMLBigInteger.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLBigInteger.hpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XMLBigInteger.hpp 4 Nov 2002 15:22:05 -0000 1.4 +++ XMLBigInteger.hpp 30 Jan 2003 21:55:22 -0000 1.5 @@ -70,22 +70,22 @@ { public: - /** - * Constructs a newly allocated <code>XMLBigInteger</code> object that - * represents the value represented by the string. The string is - * converted to an int value as if by the <code>valueOf</code> method. - * - * @param strValue the <code>String</code> to be converted to an - * <code>XMLBigInteger</code>. - * @exception NumberFormatException if the <code>String</code> does not - * contain a parsable XMLBigInteger. - */ + /** + * Constructs a newly allocated <code>XMLBigInteger</code> object that + * represents the value represented by the string. The string is + * converted to an int value as if by the <code>valueOf</code> method. + * + * @param strValue the <code>String</code> to be converted to an + * <code>XMLBigInteger</code>. + * @exception NumberFormatException if the <code>String</code> does not + * contain a parsable XMLBigInteger. + */ - XMLBigInteger(const XMLCh* const strValue); + XMLBigInteger(const XMLCh* const strValue); - ~XMLBigInteger(); + ~XMLBigInteger(); - XMLBigInteger(const XMLBigInteger& toCopy); + XMLBigInteger(const XMLBigInteger& toCopy); static void parseBigInteger(const XMLCh* const toConvert , XMLCh* const retBuffer @@ -101,66 +101,73 @@ int getTotalDigit() const; - /** - * Return a copy of the fMagnitue. + /** + * Return a copy of the fMagnitue. * A leading sign is ALWAYS in place and the caller of this method * is responsible for the de-allocation of the memory. - */ + */ inline XMLCh* toString() const; - - /** - * Compares this object to the specified object. - * The result is <code>true</code> if and only if the argument is not - * <code>null</code> and is an <code>XMLBigInteger</code> object that contains - * the same <code>int</code> value as this object. - * - * @param toCompare the object to compare with. - * @return <code>true</code> if the objects are the same; - * <code>false</code> otherwise. - */ - bool operator==(const XMLBigInteger& toCompare) const; - - /** - * Returns the signum function of this number (i.e., -1, 0 or 1 as - * the value of this number is negative, zero or positive). - */ - int getSign() const; + + /** + * Return a copy of the fMagnitue. + * This is similar to toString, except the internal buffer is returned directly + * Caller is not required to delet the returned memory. + */ + inline XMLCh* getRawData() const; + + /** + * Compares this object to the specified object. + * The result is <code>true</code> if and only if the argument is not + * <code>null</code> and is an <code>XMLBigInteger</code> object that contains + * the same <code>int</code> value as this object. + * + * @param toCompare the object to compare with. + * @return <code>true</code> if the objects are the same; + * <code>false</code> otherwise. + */ + bool operator==(const XMLBigInteger& toCompare) const; + + /** + * Returns the signum function of this number (i.e., -1, 0 or 1 as + * the value of this number is negative, zero or positive). + */ + int getSign() const; int intValue() const; private: - void setSign(int); + void setSign(int); - /* - * The number is internally stored in "minimal" sign-fMagnitude format - * (i.e., no BigIntegers have a leading zero byte in their magnitudes). - * Zero is represented with a signum of 0 (and a zero-length fMagnitude). - * Thus, there is exactly one representation for each value. - */ + /* + * The number is internally stored in "minimal" sign-fMagnitude format + * (i.e., no BigIntegers have a leading zero byte in their magnitudes). + * Zero is represented with a signum of 0 (and a zero-length fMagnitude). + * Thus, there is exactly one representation for each value. + */ // ----------------------------------------------------------------------- // Private data members // // fSign // to represent the sign of the number. // - // fMagnitude + // fMagnitude // the buffer holding the number. // - // fRawData - // to preserve the original string used to construct this object, - // needed for pattern matching. - // + // fRawData + // to preserve the original string used to construct this object, + // needed for pattern matching. + // // ----------------------------------------------------------------------- int fSign; - XMLCh* fMagnitude; //null terminated - XMLCh* fRawData; + XMLCh* fMagnitude; //null terminated + XMLCh* fRawData; }; inline int XMLBigInteger::getSign() const -{ +{ return fSign; } @@ -177,6 +184,11 @@ inline void XMLBigInteger::setSign(int newSign) { fSign = newSign; +} + +inline XMLCh* XMLBigInteger::getRawData() const +{ + return fRawData; } // 1.5 +14 -1 xml-xerces/c/src/xercesc/util/XMLDateTime.cpp Index: XMLDateTime.cpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDateTime.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- XMLDateTime.cpp 28 Nov 2002 20:39:27 -0000 1.4 +++ XMLDateTime.cpp 30 Jan 2003 21:55:22 -0000 1.5 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.5 2003/01/30 21:55:22 tng + * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory. + * * Revision 1.4 2002/11/28 20:39:27 peiyongz * Schema Errata: E2-23 seconds part shall have at least one digit after the dot * if it appears. @@ -502,6 +505,15 @@ XMLCh* retBuf = XMLString::replicate(fBuffer); return retBuf; +} + +// +// We may simply return the handle to fBuffer +// +XMLCh* XMLDateTime::getRawData() const +{ + assertBuffer(); + return fBuffer; } int XMLDateTime::getSign() const 1.3 +6 -1 xml-xerces/c/src/xercesc/util/XMLDateTime.hpp Index: XMLDateTime.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLDateTime.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- XMLDateTime.hpp 4 Nov 2002 15:22:05 -0000 1.2 +++ XMLDateTime.hpp 30 Jan 2003 21:55:22 -0000 1.3 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.3 2003/01/30 21:55:22 tng + * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory. + * * Revision 1.2 2002/11/04 15:22:05 tng * C++ Namespace Support. * @@ -147,6 +150,8 @@ // ----------------------------------------------------------------------- virtual XMLCh* toString() const; + + virtual XMLCh* getRawData() const; virtual int getSign() const; 1.3 +13 -1 xml-xerces/c/src/xercesc/util/XMLNumber.hpp Index: XMLNumber.hpp =================================================================== RCS file: /home/cvs/xml-xerces/c/src/xercesc/util/XMLNumber.hpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- XMLNumber.hpp 4 Nov 2002 15:22:05 -0000 1.2 +++ XMLNumber.hpp 30 Jan 2003 21:55:22 -0000 1.3 @@ -57,6 +57,9 @@ /* * $Id$ * $Log$ + * Revision 1.3 2003/01/30 21:55:22 tng + * Performance: create getRawData which is similar to toString but return the internal data directly, user is not required to delete the returned memory. + * * Revision 1.2 2002/11/04 15:22:05 tng * C++ Namespace Support. * @@ -91,6 +94,15 @@ * de-allocation of the memory. */ virtual XMLCh* toString() const = 0; + + /** + * Return string representation of the decimal value. + * A decimal point will be included as necessary. + * Similar to toString above, but the internal buffer is + * returned directly, user is not required to delete + * the returned buffer + */ + virtual XMLCh* getRawData() const = 0; /** * Returns the sign of this number
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]