Xerces-C++
3.1.3
Main Page
Related Pages
Classes
Files
File List
File Members
src
xercesc
util
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
25
#include <
xercesc/util/XMLNumber.hpp
>
26
#include <
xercesc/util/XMLString.hpp
>
27
#include <
xercesc/util/PlatformUtils.hpp
>
28
29
XERCES_CPP_NAMESPACE_BEGIN
30
31
class
XMLUTIL_EXPORT
XMLBigDecimal
:
public
XMLNumber
32
{
33
public
:
34
47
XMLBigDecimal
48
(
49
const
XMLCh
*
const
strValue
50
,
MemoryManager
*
const
manager =
XMLPlatformUtils::fgMemoryManager
51
);
52
53
~
XMLBigDecimal
();
54
55
static
int
compareValues(
const
XMLBigDecimal
*
const
lValue
56
,
const
XMLBigDecimal
*
const
rValue
57
,
MemoryManager
*
const
manager =
XMLPlatformUtils::fgMemoryManager
);
58
59
static
XMLCh
* getCanonicalRepresentation
60
(
61
const
XMLCh
*
const
rawData
62
,
MemoryManager
*
const
memMgr =
XMLPlatformUtils::fgMemoryManager
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
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
184
inline
XMLCh
*
XMLBigDecimal::getRawData
()
const
185
{
186
return
fRawData;
187
}
188
189
inline
const
XMLCh
*
XMLBigDecimal::getFormattedString
()
const
190
{
191
return
fRawData;
192
}
193
194
inline
MemoryManager
*
XMLBigDecimal::getMemoryManager
()
const
195
{
196
return
fMemoryManager;
197
}
198
199
inline
XMLCh
*
XMLBigDecimal::getIntVal
()
const
200
{
201
return
fIntVal;
202
}
203
204
XERCES_CPP_NAMESPACE_END
205
206
#endif
Generated on Mon Feb 1 2016 13:04:19 for Xerces-C++ by
1.8.1.2