00001 /* 00002 * Licensed to the Apache Software Foundation (ASF) under one 00003 * or more contributor license agreements. See the NOTICE file 00004 * distributed with this work for additional information 00005 * regarding copyright ownership. The ASF licenses this file 00006 * to you under the Apache License, Version 2.0 (the "License"); 00007 * you may not use this file except in compliance with the License. 00008 * You may obtain a copy of the License at 00009 * 00010 * http://www.apache.org/licenses/LICENSE-2.0 00011 * 00012 * Unless required by applicable law or agreed to in writing, software 00013 * distributed under the License is distributed on an "AS IS" BASIS, 00014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00015 * See the License for the specific language governing permissions and 00016 * limitations under the License. 00017 */ 00018 #if !defined(XALANNUMBERFORMAT_HEADER_GUARD_1357924680) 00019 #define XALANNUMBERFORMAT_HEADER_GUARD_1357924680 00020 00021 00022 00023 // Base include file. Must be first. 00024 #include <xalanc/PlatformSupport/PlatformSupportDefinitions.hpp> 00025 00026 00027 00028 #include <xalanc/XalanDOM/XalanDOMString.hpp> 00029 00030 00031 00032 XALAN_CPP_NAMESPACE_BEGIN 00033 00034 00035 00036 class XALAN_PLATFORMSUPPORT_EXPORT XalanNumberFormat 00037 { 00038 public: 00039 00040 explicit 00041 XalanNumberFormat(MemoryManager& theManager); 00042 00043 static XalanNumberFormat* 00044 create(MemoryManager& theManager) 00045 { 00046 XalanNumberFormat* theInstance; 00047 00048 return XalanConstruct( 00049 theManager, 00050 theInstance, 00051 theManager); 00052 } 00053 00054 virtual 00055 ~XalanNumberFormat(); 00056 00057 MemoryManager& 00058 getMemoryManager() 00059 { 00060 return m_groupingSeparator.getMemoryManager(); 00061 } 00062 00063 /** 00064 * Format a number into a string. 00065 * 00066 * @param theValue number to format 00067 * @return string representation of number 00068 */ 00069 virtual XalanDOMString& 00070 format(double theValue, 00071 XalanDOMString& theResult); 00072 00073 00074 00075 /** 00076 * Format a number into a string. 00077 * 00078 * @param theValue number to format 00079 * @return string representation of number 00080 */ 00081 virtual XalanDOMString& 00082 format(int theValue, 00083 XalanDOMString& theResult); 00084 00085 00086 00087 /** 00088 * Format a number into a string. 00089 * 00090 * @param theValue number to format 00091 * @param theResult the string result 00092 */ 00093 virtual XalanDOMString& 00094 format( 00095 unsigned int theValue, 00096 XalanDOMString& theResult); 00097 00098 /** 00099 * Format a number into a string. 00100 * 00101 * @param theValue number to format 00102 * @return string representation of number 00103 */ 00104 virtual XalanDOMString& 00105 format(long theValue, 00106 XalanDOMString& theResult); 00107 00108 00109 /** 00110 * Format a number into a string. 00111 * 00112 * @param theValue number to format 00113 * @param theResult the string result 00114 */ 00115 virtual XalanDOMString& 00116 format( 00117 unsigned long theValue, 00118 XalanDOMString& theResult); 00119 00120 /** 00121 * Format a number into a string. 00122 * 00123 * @param theValue number to format 00124 * @param theResult the string result 00125 */ 00126 virtual XalanDOMString& 00127 format( 00128 XALAN_INT64 theValue, 00129 XalanDOMString& theResult); 00130 00131 /** 00132 * Format a number into a string. 00133 * 00134 * @param theValue number to format 00135 * @param theResult the string result 00136 */ 00137 virtual XalanDOMString& 00138 format( 00139 XALAN_UINT64 theValue, 00140 XalanDOMString& theResult); 00141 00142 /** 00143 * Whether groupings are used for numbers, for example, "234,678" 00144 * 00145 * @return true if grouping used 00146 */ 00147 virtual bool 00148 isGroupingUsed() const; 00149 00150 /** 00151 * Change whether groupings are used for numbers, for example, "234,678" 00152 * 00153 * @param bUsed true to use grouping 00154 */ 00155 virtual void 00156 setGroupingUsed(bool bUsed); 00157 00158 /** 00159 * Change the size of groupings, for example, "234,678" uses a size of "3" 00160 * 00161 * @param size the grouping size 00162 */ 00163 virtual void 00164 setGroupingSize(unsigned long size); 00165 00166 /** 00167 * Change the separator string used for groupings, for example, "234,678" 00168 * uses the separator "," 00169 * 00170 * @param s grouping separator string 00171 */ 00172 virtual void 00173 setGroupingSeparator(const XalanDOMString& s); 00174 00175 protected: 00176 00177 void 00178 applyGrouping( 00179 const XalanDOMString& value, 00180 XalanDOMString& result); 00181 00182 private: 00183 00184 // Not implemented... 00185 XalanNumberFormat(const XalanNumberFormat&); 00186 00187 XalanNumberFormat& 00188 operator=(const XalanNumberFormat&); 00189 00190 bool 00191 operator==(const XalanNumberFormat&); 00192 00193 // Data members... 00194 bool m_isGroupingUsed; 00195 00196 XalanDOMString m_groupingSeparator; 00197 00198 unsigned long m_groupingSize; 00199 00200 static const XalanDOMChar s_defaultGroupingSeparator[]; 00201 }; 00202 00203 00204 00205 XALAN_CPP_NAMESPACE_END 00206 00207 00208 00209 #endif // XALANNUMBERFORMAT_HEADER_GUARD_1357924680
Doxygen and GraphViz are used to generate this API documentation from the Xalan-C header files.
Xalan-C++ XSLT Processor Version 1.11 |
|