XMLBigDecimal.hpp
Go to the documentation of this file.
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* $Id: XMLBigDecimal.hpp 932889 2010-04-11 13:10:10Z borisk $
*/
#if !defined(XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP)
#define XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP
#include <xercesc/util/XMLNumber.hpp>
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/PlatformUtils.hpp>
XERCES_CPP_NAMESPACE_BEGIN
class XMLUTIL_EXPORT XMLBigDecimal : public XMLNumber
{
public:
XMLBigDecimal
(
const XMLCh* const strValue
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager
);
~XMLBigDecimal();
static int compareValues(const XMLBigDecimal* const lValue
, const XMLBigDecimal* const rValue
, MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
static XMLCh* getCanonicalRepresentation
(
const XMLCh* const rawData
, MemoryManager* const memMgr = XMLPlatformUtils::fgMemoryManager
);
static void parseDecimal
(
const XMLCh* const toParse
, XMLCh* const retBuffer
, int& sign
, int& totalDigits
, int& fractDigits
, MemoryManager* const manager
);
static void parseDecimal
(
const XMLCh* const toParse
, MemoryManager* const manager
);
virtual XMLCh* getRawData() const;
virtual const XMLCh* getFormattedString() const;
virtual int getSign() const;
const XMLCh* getValue() const;
unsigned int getScale() const;
unsigned int getTotalDigit() const;
inline XMLCh* getIntVal() const;
int toCompare(const XMLBigDecimal& other) const;
/*
* Sets the value to be converted
*
* @param strValue the value to convert
*/
void setDecimalValue(const XMLCh* const strValue);
MemoryManager* getMemoryManager() const;
/***
* Support for Serialization/De-serialization
***/
DECL_XSERIALIZABLE(XMLBigDecimal)
XMLBigDecimal(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
private:
void cleanUp();
// -----------------------------------------------------------------------
// Unimplemented constructors and operators
// -----------------------------------------------------------------------
XMLBigDecimal(const XMLBigDecimal& other);
XMLBigDecimal& operator=(const XMLBigDecimal& other);
// -----------------------------------------------------------------------
// Private data members
//
// fSign
// sign
//
// fTotalDigits
// the total number of digits
//
// fScale
// the number of digits to the right of the decimal point
//
// fIntVal
// The value of this BigDecimal, w/o
// leading whitespace, leading zero
// decimal point
// trailing zero, trailing whitespace
//
// fRawData
// to preserve the original string used to construct this object,
// needed for pattern matching.
//
// -----------------------------------------------------------------------
int fSign;
unsigned int fTotalDigits;
unsigned int fScale;
XMLSize_t fRawDataLen;
XMLCh* fRawData;
XMLCh* fIntVal;
MemoryManager* fMemoryManager;
};
inline int XMLBigDecimal::getSign() const
{
return fSign;
}
inline const XMLCh* XMLBigDecimal::getValue() const
{
return fIntVal;
}
inline unsigned int XMLBigDecimal::getScale() const
{
return fScale;
}
inline unsigned int XMLBigDecimal::getTotalDigit() const
{
return fTotalDigits;
}
inline XMLCh* XMLBigDecimal::getRawData() const
{
return fRawData;
}
inline const XMLCh* XMLBigDecimal::getFormattedString() const
{
return fRawData;
}
inline MemoryManager* XMLBigDecimal::getMemoryManager() const
{
return fMemoryManager;
}
inline XMLCh* XMLBigDecimal::getIntVal() const
{
return fIntVal;
}
XERCES_CPP_NAMESPACE_END
#endif
XMLPlatformUtils::fgMemoryManager
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
XMLNumber.hpp
XMLBigDecimal
Definition: XMLBigDecimal.hpp:31
XMLBigDecimal::getTotalDigit
unsigned int getTotalDigit() const
Definition: XMLBigDecimal.hpp:179
XMLBigDecimal::getMemoryManager
MemoryManager * getMemoryManager() const
Definition: XMLBigDecimal.hpp:194
XMLBigDecimal::getIntVal
XMLCh * getIntVal() const
Definition: XMLBigDecimal.hpp:199
XMLBigDecimal::getSign
virtual int getSign() const
Returns the sign of this number.
Definition: XMLBigDecimal.hpp:164
PlatformUtils.hpp
MemoryManager
Configurable memory manager.
Definition: MemoryManager.hpp:39
XMLNumber::getRawData
virtual XMLCh * getRawData() const =0
Return string representation of the decimal value.
XMLBigDecimal::getFormattedString
virtual const XMLCh * getFormattedString() const
Return the original and converted value of the original data.
Definition: XMLBigDecimal.hpp:189
XMLCh
uint16_t XMLCh
Definition: Xerces_autoconf_config.hpp:118
XERCES_CPP_NAMESPACE_BEGIN
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
XMLString.hpp
XMLNumber
Definition: XMLNumber.hpp:30
XMLSize_t
size_t XMLSize_t
Definition: Xerces_autoconf_config.hpp:110
XMLUTIL_EXPORT
#define XMLUTIL_EXPORT
Definition: XercesDefs.hpp:162
XERCES_CPP_NAMESPACE_END
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
XMLBigDecimal::getRawData
virtual XMLCh * getRawData() const
Return string representation of the decimal value.
Definition: XMLBigDecimal.hpp:184
XMLNumber::getFormattedString
virtual const XMLCh * getFormattedString() const =0
Return the original and converted value of the original data.
XMLBigDecimal::getScale
unsigned int getScale() const
Definition: XMLBigDecimal.hpp:174
XMLNumber::getSign
virtual int getSign() const =0
Returns the sign of this number.
XMLBigDecimal::getValue
const XMLCh * getValue() const
Definition: XMLBigDecimal.hpp:169