Xalan-C++ API Reference 1.12.0
XalanNumberFormat.hpp
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18#if !defined(XALANNUMBERFORMAT_HEADER_GUARD_1357924680)
19#define XALANNUMBERFORMAT_HEADER_GUARD_1357924680
20
21
22
23// Base include file. Must be first.
25
26
27
29
30
31
32namespace XALAN_CPP_NAMESPACE {
33
34
35
37{
38public:
39
40 explicit
42
43 static XalanNumberFormat*
44 create(MemoryManager& theManager)
45 {
47
48 return XalanConstruct(
52 }
53
54 virtual
56
57 MemoryManager&
59 {
60 return m_groupingSeparator.getMemoryManager();
61 }
62
63 /**
64 * Format a number into a string.
65 *
66 * @param theValue number to format
67 * @return string representation of number
68 */
69 virtual XalanDOMString&
72
73
74
75 /**
76 * Format a number into a string.
77 *
78 * @param theValue number to format
79 * @return string representation of number
80 */
81 virtual XalanDOMString&
84
85
86
87 /**
88 * Format a number into a string.
89 *
90 * @param theValue number to format
91 * @param theResult the string result
92 */
93 virtual XalanDOMString&
97
98 /**
99 * Format a number into a string.
100 *
101 * @param theValue number to format
102 * @return string representation of number
103 */
104 virtual XalanDOMString&
107
108
109 /**
110 * Format a number into a string.
111 *
112 * @param theValue number to format
113 * @param theResult the string result
114 */
115 virtual XalanDOMString&
119
120 /**
121 * Format a number into a string.
122 *
123 * @param theValue number to format
124 * @param theResult the string result
125 */
126 virtual XalanDOMString&
130
131 /**
132 * Format a number into a string.
133 *
134 * @param theValue number to format
135 * @param theResult the string result
136 */
137 virtual XalanDOMString&
141
142 /**
143 * Whether groupings are used for numbers, for example, "234,678"
144 *
145 * @return true if grouping used
146 */
147 virtual bool
149
150 /**
151 * Change whether groupings are used for numbers, for example, "234,678"
152 *
153 * @param bUsed true to use grouping
154 */
155 virtual void
157
158 /**
159 * Change the size of groupings, for example, "234,678" uses a size of "3"
160 *
161 * @param size the grouping size
162 */
163 virtual void
164 setGroupingSize(unsigned long size);
165
166 /**
167 * Change the separator string used for groupings, for example, "234,678"
168 * uses the separator ","
169 *
170 * @param s grouping separator string
171 */
172 virtual void
174
175protected:
176
177 void
179 const XalanDOMString& value,
181
182private:
183
184 // Not implemented...
186
188 operator=(const XalanNumberFormat&);
189
190 bool
192
193 // Data members...
194 bool m_isGroupingUsed;
195
196 XalanDOMString m_groupingSeparator;
197
198 unsigned long m_groupingSize;
199
200 static const XalanDOMChar s_defaultGroupingSeparator[];
201};
202
203
204
205}
206
207
208
209#endif // XALANNUMBERFORMAT_HEADER_GUARD_1357924680
#define XALAN_PLATFORMSUPPORT_EXPORT
#define XALAN_CPP_NAMESPACE
Xalan-C++ namespace, including major and minor version.
virtual void setGroupingUsed(bool bUsed)
Change whether groupings are used for numbers, for example, "234,678".
virtual XalanDOMString & format(XMLInt64 theValue, XalanDOMString &theResult)
Format a number into a string.
virtual bool isGroupingUsed() const
Whether groupings are used for numbers, for example, "234,678".
virtual void setGroupingSeparator(const XalanDOMString &s)
Change the separator string used for groupings, for example, "234,678" uses the separator ",...
XalanNumberFormat(MemoryManager &theManager)
virtual XalanDOMString & format(XMLInt32 theValue, XalanDOMString &theResult)
Format a number into a string.
virtual XalanDOMString & format(XMLUInt64 theValue, XalanDOMString &theResult)
Format a number into a string.
void applyGrouping(const XalanDOMString &value, XalanDOMString &result)
virtual XalanDOMString & format(XMLInt16 theValue, XalanDOMString &theResult)
Format a number into a string.
virtual void setGroupingSize(unsigned long size)
Change the size of groupings, for example, "234,678" uses a size of "3".
virtual XalanDOMString & format(XMLUInt16 theValue, XalanDOMString &theResult)
Format a number into a string.
virtual XalanDOMString & format(XMLUInt32 theValue, XalanDOMString &theResult)
Format a number into a string.
MemoryManager & getMemoryManager()
static XalanNumberFormat * create(MemoryManager &theManager)
virtual XalanDOMString & format(double theValue, XalanDOMString &theResult)
Format a number into a string.
Type * XalanConstruct(MemoryManager &theMemoryManager, Type *&theInstance)
bool operator==(const XalanVector< Type > &theLHS, const XalanVector< Type > &theRHS)