Xerces-C++ 3.2.5
XMLBigDecimal.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18/*
19 * $Id$
20 */
21
22#if !defined(XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP)
23#define XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP
24
28
30
32{
33public:
34
48 (
49 const XMLCh* const strValue
51 );
52
54
55 static int compareValues(const XMLBigDecimal* const lValue
56 , const XMLBigDecimal* const rValue
58
60 (
61 const XMLCh* const rawData
63 );
64
65 static void parseDecimal
66 (
67 const XMLCh* const toParse
68 , XMLCh* const retBuffer
69 , int& sign
70 , int& totalDigits
71 , int& fractDigits
72 , MemoryManager* const manager
73 );
74
75 static void parseDecimal
76 (
77 const XMLCh* const toParse
78 , MemoryManager* const manager
79 );
80
81 virtual XMLCh* getRawData() const;
82
83 virtual const XMLCh* getFormattedString() const;
84
85 virtual int getSign() const;
86
87 const XMLCh* getValue() const;
88
89 unsigned int getScale() const;
90
91 unsigned int getTotalDigit() const;
92
93 inline XMLCh* getIntVal() const;
94
103 int toCompare(const XMLBigDecimal& other) const;
104
105 /*
106 * Sets the value to be converted
107 *
108 * @param strValue the value to convert
109 */
110 void setDecimalValue(const XMLCh* const strValue);
111
112 MemoryManager* getMemoryManager() const;
113
114 /***
115 * Support for Serialization/De-serialization
116 ***/
117 DECL_XSERIALIZABLE(XMLBigDecimal)
118
119 XMLBigDecimal(MemoryManager* const manager = XMLPlatformUtils::fgMemoryManager);
120
121private:
122
123 void cleanUp();
124
125 // -----------------------------------------------------------------------
126 // Unimplemented constructors and operators
127 // -----------------------------------------------------------------------
128 XMLBigDecimal(const XMLBigDecimal& other);
129 XMLBigDecimal& operator=(const XMLBigDecimal& other);
130
131 // -----------------------------------------------------------------------
132 // Private data members
133 //
134 // fSign
135 // sign
136 //
137 // fTotalDigits
138 // the total number of digits
139 //
140 // fScale
141 // the number of digits to the right of the decimal point
142 //
143 // fIntVal
144 // The value of this BigDecimal, w/o
145 // leading whitespace, leading zero
146 // decimal point
147 // trailing zero, trailing whitespace
148 //
149 // fRawData
150 // to preserve the original string used to construct this object,
151 // needed for pattern matching.
152 //
153 // -----------------------------------------------------------------------
154 int fSign;
155 unsigned int fTotalDigits;
156 unsigned int fScale;
157 XMLSize_t fRawDataLen;
158 XMLCh* fRawData;
159 XMLCh* fIntVal;
160 MemoryManager* fMemoryManager;
161
162};
163
164inline int XMLBigDecimal::getSign() const
165{
166 return fSign;
167}
168
169inline const XMLCh* XMLBigDecimal::getValue() const
170{
171 return fIntVal;
172}
173
174inline unsigned int XMLBigDecimal::getScale() const
175{
176 return fScale;
177}
178
179inline unsigned int XMLBigDecimal::getTotalDigit() const
180{
181 return fTotalDigits;
182}
183
185{
186 return fRawData;
187}
188
190{
191 return fRawData;
192}
193
195{
196 return fMemoryManager;
197}
198
200{
201 return fIntVal;
202}
203
205
206#endif
#define XERCES_CPP_NAMESPACE_BEGIN
Definition XercesDefs.hpp:112
#define XMLUTIL_EXPORT
Definition XercesDefs.hpp:162
#define XERCES_CPP_NAMESPACE_END
Definition XercesDefs.hpp:113
uint16_t XMLCh
Definition Xerces_autoconf_config.hpp:120
size_t XMLSize_t
Definition Xerces_autoconf_config.hpp:112
Configurable memory manager.
Definition MemoryManager.hpp:40
Definition XMLBigDecimal.hpp:32
static int compareValues(const XMLBigDecimal *const lValue, const XMLBigDecimal *const rValue, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
int toCompare(const XMLBigDecimal &other) const
Compares this object to the specified object.
const XMLCh * getValue() const
Definition XMLBigDecimal.hpp:169
XMLCh * getIntVal() const
Definition XMLBigDecimal.hpp:199
static void parseDecimal(const XMLCh *const toParse, XMLCh *const retBuffer, int &sign, int &totalDigits, int &fractDigits, MemoryManager *const manager)
XMLBigDecimal(const XMLCh *const strValue, MemoryManager *const manager=XMLPlatformUtils::fgMemoryManager)
Constructs a newly allocated XMLBigDecimal object that represents the value represented by the string...
virtual const XMLCh * getFormattedString() const
Return the original and converted value of the original data.
Definition XMLBigDecimal.hpp:189
void setDecimalValue(const XMLCh *const strValue)
MemoryManager * getMemoryManager() const
Definition XMLBigDecimal.hpp:194
unsigned int getScale() const
Definition XMLBigDecimal.hpp:174
unsigned int getTotalDigit() const
Definition XMLBigDecimal.hpp:179
static void parseDecimal(const XMLCh *const toParse, MemoryManager *const manager)
static XMLCh * getCanonicalRepresentation(const XMLCh *const rawData, MemoryManager *const memMgr=XMLPlatformUtils::fgMemoryManager)
virtual XMLCh * getRawData() const
Return string representation of the decimal value.
Definition XMLBigDecimal.hpp:184
Definition XMLNumber.hpp:31
virtual int getSign() const =0
Returns the sign of this number.
virtual const XMLCh * getFormattedString() const =0
Return the original and converted value of the original data.
virtual XMLCh * getRawData() const =0
Return string representation of the decimal value.
Utilities that must be implemented in a platform-specific way.
Definition PlatformUtils.hpp:69
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition PlatformUtils.hpp:121