Xerces-C++  3.1.2
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: XMLBigDecimal.hpp 932887 2010-04-11 13:04:59Z borisk $
20  */
21 
22 #if !defined(XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP)
23 #define XERCESC_INCLUDE_GUARD_XML_BIGDECIMAL_HPP
24 
28 
30 
32 {
33 public:
34 
48  (
49  const XMLCh* const strValue
51  );
52 
53  ~XMLBigDecimal();
54 
55  static int compareValues(const XMLBigDecimal* const lValue
56  , const XMLBigDecimal* const rValue
58 
59  static XMLCh* getCanonicalRepresentation
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 
120 
121 private:
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 
164 inline int XMLBigDecimal::getSign() const
165 {
166  return fSign;
167 }
168 
169 inline const XMLCh* XMLBigDecimal::getValue() const
170 {
171  return fIntVal;
172 }
173 
174 inline unsigned int XMLBigDecimal::getScale() const
175 {
176  return fScale;
177 }
178 
179 inline 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
const XMLCh * getValue() const
Definition: XMLBigDecimal.hpp:169
static MemoryManager * fgMemoryManager
The configurable memory manager.
Definition: PlatformUtils.hpp:121
Definition: XMLBigDecimal.hpp:31
unsigned int getTotalDigit() const
Definition: XMLBigDecimal.hpp:179
virtual const XMLCh * getFormattedString() const
Return the original and converted value of the original data.
Definition: XMLBigDecimal.hpp:189
unsigned int getScale() const
Definition: XMLBigDecimal.hpp:174
Configurable memory manager.
Definition: MemoryManager.hpp:39
virtual XMLCh * getRawData() const =0
Return string representation of the decimal value.
SIZE_T XMLSize_t
Definition: Xerces_autoconf_config.borland.hpp:86
#define XERCES_CPP_NAMESPACE_BEGIN
Definition: XercesDefs.hpp:112
wchar_t XMLCh
Definition: Xerces_autoconf_config.borland.hpp:92
virtual int getSign() const
Returns the sign of this number.
Definition: XMLBigDecimal.hpp:164
Definition: XMLNumber.hpp:30
#define XMLUTIL_EXPORT
Definition: XercesDefs.hpp:162
#define XERCES_CPP_NAMESPACE_END
Definition: XercesDefs.hpp:113
virtual const XMLCh * getFormattedString() const =0
Return the original and converted value of the original data.
virtual int getSign() const =0
Returns the sign of this number.
virtual XMLCh * getRawData() const
Return string representation of the decimal value.
Definition: XMLBigDecimal.hpp:184
MemoryManager * getMemoryManager() const
Definition: XMLBigDecimal.hpp:194
XMLCh * getIntVal() const
Definition: XMLBigDecimal.hpp:199