1212#include < boost/locale/formatting.hpp>
1313#include < boost/locale/generator.hpp>
1414#include < boost/locale/encoding.hpp>
15+ #include < boost/locale/numpunct.hpp>
1516#include < boost/shared_ptr.hpp>
1617#include < sstream>
1718#include < stdlib.h>
@@ -119,11 +120,11 @@ class time_put_win : public std::time_put<CharType> {
119120
120121
121122template <typename CharType>
122- class num_punct_win : public std :: numpunct<CharType> {
123+ class num_punct_win : public numpunct <CharType> {
123124public:
124125 typedef std::basic_string<CharType> string_type;
125126 num_punct_win (winlocale const &lc,size_t refs = 0 ) :
126- std:: numpunct<CharType>(refs)
127+ numpunct<CharType>(refs)
127128 {
128129 numeric_info np = wcsnumformat_l (lc) ;
129130 if (sizeof (CharType) == 1 && np.thousands_sep == L" \xA0 " )
@@ -132,10 +133,6 @@ class num_punct_win : public std::numpunct<CharType> {
132133 to_str (np.thousands_sep ,thousands_sep_);
133134 to_str (np.decimal_point ,decimal_point_);
134135 grouping_ = np.grouping ;
135- if (thousands_sep_.size () > 1 )
136- grouping_ = std::string ();
137- if (decimal_point_.size () > 1 )
138- decimal_point_ = CharType (' .' );
139136 }
140137
141138 void to_str (std::wstring &s1,std::wstring &s2)
@@ -147,28 +144,18 @@ class num_punct_win : public std::numpunct<CharType> {
147144 {
148145 s2=conv::from_utf (s1," UTF-8" );
149146 }
150- virtual CharType do_decimal_point () const
147+ virtual string_type do_decimal_point_full () const
151148 {
152- return * decimal_point_. c_str () ;
149+ return decimal_point_;
153150 }
154- virtual CharType do_thousands_sep () const
151+ virtual string_type do_thousands_sep_full () const
155152 {
156- return * thousands_sep_. c_str () ;
153+ return thousands_sep_;
157154 }
158155 virtual std::string do_grouping () const
159156 {
160157 return grouping_;
161158 }
162- virtual string_type do_truename () const
163- {
164- static const char t[]=" true" ;
165- return string_type (t,t+sizeof (t)-1 );
166- }
167- virtual string_type do_falsename () const
168- {
169- static const char t[]=" false" ;
170- return string_type (t,t+sizeof (t)-1 );
171- }
172159private:
173160 string_type decimal_point_;
174161 string_type thousands_sep_;
@@ -179,7 +166,7 @@ template<typename CharType>
179166std::locale create_formatting_impl (std::locale const &in,winlocale const &lc)
180167{
181168 if (lc.is_c ()) {
182- std::locale tmp (in,new std::numpunct_byname <CharType>(" C " ));
169+ std::locale tmp (in, new numpunct <CharType>());
183170 tmp=std::locale (tmp,new std::time_put_byname<CharType>(" C" ));
184171 tmp = std::locale (tmp,new num_format<CharType>(lc));
185172 return tmp;
@@ -193,14 +180,12 @@ std::locale create_formatting_impl(std::locale const &in,winlocale const &lc)
193180}
194181
195182template <typename CharType>
196- std::locale create_parsing_impl (std::locale const &in ,winlocale const &lc)
183+ std::locale create_parsing_impl (std::locale tmp ,winlocale const &lc)
197184{
198- std::numpunct<CharType> *np = 0 ;
199185 if (lc.is_c ())
200- np = new std::numpunct_byname <CharType>(" C " );
186+ tmp = std::locale (tmp, new numpunct <CharType>() );
201187 else
202- np = new num_punct_win<CharType>(lc);
203- std::locale tmp (in,np);
188+ tmp = std::locale (tmp, new num_punct_win<CharType>(lc));
204189 tmp = std::locale (tmp,new util::base_num_parse<CharType>());
205190 return tmp;
206191}
0 commit comments