1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_monetary.c Wed Mar 31 12:27:01 2010 +0100
1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_monetary.c Wed Mar 31 12:33:34 2010 +0100
1.3 @@ -1,22 +1,22 @@
1.4 /*
1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
1.6 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.7 *
1.8 * Copyright (c) 1999
1.9 * Silicon Graphics Computer Systems, Inc.
1.10 *
1.11 - * Copyright (c) 1999
1.12 + * Copyright (c) 1999
1.13 * Boris Fomitchev
1.14 *
1.15 * This material is provided "as is", with absolutely no warranty expressed
1.16 * or implied. Any use is at your own risk.
1.17 *
1.18 - * Permission to use or copy this software for any purpose is hereby granted
1.19 + * Permission to use or copy this software for any purpose is hereby granted
1.20 * without fee, provided the above notices are retained on all copies.
1.21 * Permission to modify the code and to distribute modified code is granted,
1.22 * provided the above notices are retained, and a notice that the code was
1.23 * modified is included with the above copyright notice.
1.24 *
1.25 - */
1.26 + */
1.27 #ifndef _STLP_MONETARY_C
1.28 #define _STLP_MONETARY_C
1.29
1.30 @@ -24,8 +24,6 @@
1.31 # include <stl/_monetary.h>
1.32 # endif
1.33
1.34 -# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
1.35 -
1.36 #ifndef _STLP_INTERNAL_IOS_H
1.37 # include <stl/_ios.h>
1.38 #endif
1.39 @@ -40,91 +38,144 @@
1.40
1.41 _STLP_BEGIN_NAMESPACE
1.42
1.43 -# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
1.44 -# if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
1.45 +#if (_STLP_STATIC_TEMPLATE_DATA > 0)
1.46 +#if !defined(__SYMBIAN32__WSD__)
1.47 +
1.48 +# if !defined (__BORLANDC__) && (defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL))
1.49 template <class _CharT, class _InputIterator>
1.50 locale::id money_get<_CharT, _InputIterator>::id;
1.51
1.52 template <class _CharT, class _OutputIterator>
1.53 locale::id money_put<_CharT, _OutputIterator>::id;
1.54 +# endif
1.55 +
1.56 +# if ((defined (__CYGWIN__) || defined (__MINGW32__)) && \
1.57 + defined (_STLP_USE_DYNAMIC_LIB) && !defined (__BUILDING_STLPORT)) || (defined (__SYMBIAN32__) && defined(_STLP_DESIGNATED_DLL))
1.58 +/*
1.59 + * Under cygwin, when STLport is used as a shared library, the id needs
1.60 + * to be specified as imported otherwise they will be duplicated in the
1.61 + * calling executable.
1.62 + */
1.63 +#if defined (__SYMBIAN32__)
1.64 +template <>
1.65 +locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id; //_STLP_DECLSPEC removed; data should not be exported in symbian.
1.66 +/*
1.67 +template <>
1.68 +_STLP_DECLSPEC locale::id money_get<char, const char*>::id;
1.69 +*/
1.70 +
1.71 +template <>
1.72 +locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.73 +template <>
1.74 +locale::id money_put<char, char*>::id;
1.75 +
1.76 +# if !defined (_STLP_NO_WCHAR_T)
1.77 +template <>
1.78 +locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.79 +template <>
1.80 +locale::id money_get<wchar_t, const wchar_t*>::id;
1.81 +
1.82 +template <>
1.83 +locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.84 +template <>
1.85 +locale::id money_put<wchar_t, wchar_t*>::id;
1.86 +# endif /* _STLP_NO_WCHAR_T */
1.87 +
1.88 +#else
1.89 +template <>
1.90 +_STLP_DECLSPEC locale::id money_get<char, istreambuf_iterator<char, char_traits<char> > >::id;
1.91 +/*
1.92 +template <>
1.93 +_STLP_DECLSPEC locale::id money_get<char, const char*>::id;
1.94 +*/
1.95 +
1.96 +template <>
1.97 +_STLP_DECLSPEC locale::id money_put<char, ostreambuf_iterator<char, char_traits<char> > >::id;
1.98 +template <>
1.99 +_STLP_DECLSPEC locale::id money_put<char, char*>::id;
1.100 +
1.101 +# if !defined (_STLP_NO_WCHAR_T)
1.102 +template <>
1.103 +_STLP_DECLSPEC locale::id money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.104 +template <>
1.105 +_STLP_DECLSPEC locale::id money_get<wchar_t, const wchar_t*>::id;
1.106 +
1.107 +template <>
1.108 +_STLP_DECLSPEC locale::id money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >::id;
1.109 +template <>
1.110 +_STLP_DECLSPEC locale::id money_put<wchar_t, wchar_t*>::id;
1.111 +# endif /* _STLP_NO_WCHAR_T */
1.112 +
1.113 #endif
1.114 -# else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.115
1.116 -typedef money_get<char, const char*> money_get_char;
1.117 -typedef money_put<char, char*> money_put_char;
1.118 +#endif /* (defined (__CYGWIN__) || defined (__MINGW32__)) */
1.119 +#endif /* __SYMBIAN32__WSD__ */
1.120 +
1.121 +#else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.122 +
1.123 +//typedef money_get<char, const char*> money_get_char;
1.124 +//typedef money_put<char, char*> money_put_char;
1.125 typedef money_get<char, istreambuf_iterator<char, char_traits<char> > > money_get_char_2;
1.126 typedef money_put<char, ostreambuf_iterator<char, char_traits<char> > > money_put_char_2;
1.127
1.128 -#ifndef __SYMBIAN32__
1.129 -__DECLARE_INSTANCE(locale::id, money_get_char::id, );
1.130 -__DECLARE_INSTANCE(locale::id, money_put_char::id, );
1.131 +//__DECLARE_INSTANCE(locale::id, money_get_char::id, );
1.132 +//__DECLARE_INSTANCE(locale::id, money_put_char::id, );
1.133 __DECLARE_INSTANCE(locale::id, money_get_char_2::id, );
1.134 __DECLARE_INSTANCE(locale::id, money_put_char_2::id, );
1.135 -#endif
1.136
1.137 -# ifndef _STLP_NO_WCHAR_T
1.138 +# ifndef _STLP_NO_WCHAR_T
1.139
1.140 -typedef money_get<wchar_t, const wchar_t*> money_get_wchar_t;
1.141 -typedef money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_get_wchar_t_2;
1.142 +//typedef money_get<wchar_t, const wchar_t*> money_get_wchar_t;
1.143 +//typedef money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_get_wchar_t_2;
1.144 typedef money_put<wchar_t, wchar_t*> money_put_wchar_t;
1.145 typedef money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_put_wchar_t_2;
1.146
1.147 -#ifndef __SYMBIAN32__
1.148 -__DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, );
1.149 -__DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, );
1.150 +//__DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, );
1.151 +//__DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, );
1.152 __DECLARE_INSTANCE(locale::id, money_get_wchar_t_2::id, );
1.153 __DECLARE_INSTANCE(locale::id, money_put_wchar_t_2::id, );
1.154 -#endif
1.155
1.156 -# endif
1.157 -# endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.158 +# endif /* _STLP_NO_WCHAR_T */
1.159 +#endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
1.160
1.161 // money_get facets
1.162
1.163 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.164
1.165 // helper functions for do_get
1.166 template <class _InIt1, class _InIt2>
1.167 -pair<_InIt1, bool> __get_string(_InIt1 __first, _InIt1 __last,
1.168 - _InIt2 __str_first, _InIt2 __str_last) {
1.169 - pair<_InIt1, _InIt2> __pr = mismatch(__first, __last, __str_first);
1.170 - return make_pair(__pr.first, __pr.second == __str_last);
1.171 +pair<_InIt1, bool> __get_string( _InIt1 __first, _InIt1 __last,
1.172 + _InIt2 __str_first, _InIt2 __str_last) {
1.173 + while ( __first != __last && __str_first != __str_last && *__first == *__str_first ) {
1.174 + ++__first;
1.175 + ++__str_first;
1.176 + }
1.177 + return make_pair(__first, __str_first == __str_last);
1.178 }
1.179
1.180 template <class _InIt, class _OuIt, class _CharT>
1.181 bool
1.182 -__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __stl_out,
1.183 +__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __out_ite,
1.184 const ctype<_CharT>& _c_type,
1.185 - _CharT __point,
1.186 - int __frac_digits,
1.187 - _CharT __sep,
1.188 - const string& __grouping,
1.189 - bool& __syntax_ok)
1.190 -{
1.191 -
1.192 - size_t __digits = 0;
1.193 -
1.194 + _CharT __point, int __frac_digits, _CharT __sep,
1.195 + const string& __grouping, bool &__syntax_ok) {
1.196 if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
1.197 return false;
1.198
1.199 char __group_sizes[128];
1.200 - char* __group_sizes_end = __grouping.size() == 0 ? 0 : __group_sizes;
1.201 + char* __group_sizes_end = __grouping.empty()? 0 : __group_sizes;
1.202 char __current_group_size = 0;
1.203
1.204 while (__first != __last) {
1.205 if (_c_type.is(ctype_base::digit, *__first)) {
1.206 ++__current_group_size;
1.207 - *__stl_out++ = *__first++;
1.208 - __digits++;
1.209 + *__out_ite++ = *__first++;
1.210 }
1.211 -#ifdef __SYMBIAN32__
1.212 -else if ( (__current_group_size)&&(__group_sizes_end) ){
1.213 -#else
1.214 else if (__group_sizes_end) {
1.215 -#endif
1.216 if (*__first == __sep) {
1.217 - *__group_sizes_end++ = __current_group_size;
1.218 - __current_group_size = 0;
1.219 - ++__first;
1.220 + *__group_sizes_end++ = __current_group_size;
1.221 + __current_group_size = 0;
1.222 + ++__first;
1.223 }
1.224 else break;
1.225 }
1.226 @@ -132,134 +183,84 @@
1.227 break;
1.228 }
1.229
1.230 - if (__grouping.size() == 0)
1.231 + if (__grouping.empty())
1.232 __syntax_ok = true;
1.233 else {
1.234 if (__group_sizes_end != __group_sizes)
1.235 - *__group_sizes_end++ = __current_group_size;
1.236 -
1.237 + *__group_sizes_end++ = __current_group_size;
1.238 +
1.239 __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
1.240 - __grouping.data(), __grouping.data()+ __grouping.size());
1.241 -
1.242 + __grouping.data(), __grouping.data()+ __grouping.size());
1.243 +
1.244 if (__first == __last || *__first != __point) {
1.245 for (int __digits = 0; __digits != __frac_digits; ++__digits)
1.246 - *__stl_out++ = _CharT('0');
1.247 + *__out_ite++ = _CharT('0');
1.248 return true; // OK not to have decimal point
1.249 }
1.250 }
1.251 -//bug fix testcase_22427 - commented
1.252 -// ++__first;
1.253
1.254 + ++__first;
1.255
1.256 - //bug fix testcase_22427 - added if
1.257 + int __digits = 0;
1.258
1.259 - if (__first != __last && *__first == __point && __frac_digits)
1.260 - {
1.261 - //bug fix testcase_22427 - commented
1.262 - ++__first;
1.263 - while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
1.264 - *__stl_out++ = *__first++;
1.265 - ++__digits;
1.266 - }
1.267 + while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
1.268 + *__out_ite++ = *__first++;
1.269 + ++__digits;
1.270 }
1.271
1.272 - //bug fix testcase_22427 - condition changed
1.273 -// __syntax_ok = __syntax_ok && (__digits == __frac_digits);
1.274 -
1.275 - if(__digits == 0)
1.276 - __syntax_ok = false;
1.277 + __syntax_ok = __syntax_ok && (__digits == __frac_digits);
1.278
1.279 return true;
1.280 }
1.281
1.282 -# ifndef _STLP_NO_LONG_DOUBLE
1.283
1.284 -//===== methods ======
1.285 -template <class _CharT, class _InputIter>
1.286 -_InputIter
1.287 -money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl,
1.288 - ios_base& __str, ios_base::iostate& __err,
1.289 - long double& __units) const {
1.290 - string_type __buf;
1.291 - __s = do_get(__s, __end, __intl, __str, __err, __buf);
1.292 -
1.293 - if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
1.294 - __buf.push_back(0);
1.295 - typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
1.296 - // Can't use atold, since it might be wchar_t. Don't get confused by name below :
1.297 - // it's perfectly capable of reading long double.
1.298 - __get_decimal_integer(__b, __e, __units);
1.299 - }
1.300 - if (__s == __end)
1.301 - __err |= ios_base::eofbit;
1.302 - return __s;
1.303 -}
1.304 -# endif
1.305 -
1.306 -template <class _CharT, class _InputIter>
1.307 -_InputIter
1.308 -money_get<_CharT, _InputIter>::do_get(iter_type __s,
1.309 - iter_type __end, bool __intl,
1.310 - ios_base& __str, ios_base::iostate& __err,
1.311 - string_type& __digits) const {
1.312 - __err = 0;
1.313 +template <class _CharT, class _InputIter, class _StrType>
1.314 +_InputIter __money_do_get(_InputIter __s, _InputIter __end, bool __intl,
1.315 + ios_base& __str, ios_base::iostate& __err,
1.316 + _StrType& __digits, bool &__is_positive, _CharT* /*__dummy*/) {
1.317 if (__s == __end) {
1.318 __err |= ios_base::eofbit;
1.319 return __s;
1.320 }
1.321
1.322 - typedef moneypunct<_CharT, false> _Punct;
1.323 - typedef moneypunct<_CharT, true> _Punct_intl;
1.324 - typedef ctype<_CharT> _Ctype;
1.325 -#ifdef __SYMBIAN32__
1.326 - bool __isSignSympresent = false;
1.327 -#endif
1.328 + typedef _CharT char_type;
1.329 + typedef _StrType string_type;
1.330 + typedef _InputIter iter_type;
1.331 + typedef moneypunct<char_type, false> _Punct;
1.332 + typedef moneypunct<char_type, true> _Punct_intl;
1.333 + typedef ctype<char_type> _Ctype;
1.334
1.335 - bool __testvalid = true;
1.336 locale __loc = __str.getloc();
1.337 const _Punct& __punct = use_facet<_Punct>(__loc) ;
1.338 const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
1.339 - const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
1.340 -
1.341 + const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
1.342 +
1.343 money_base::pattern __format = __intl ? __punct_intl.neg_format()
1.344 : __punct.neg_format();
1.345 string_type __ns = __intl ? __punct_intl.negative_sign()
1.346 : __punct.negative_sign();
1.347 string_type __ps = __intl ? __punct_intl.positive_sign()
1.348 : __punct.positive_sign();
1.349 - string_type __sign = __ps;
1.350 int __i;
1.351 - bool __is_positive = true;
1.352 - bool __symbol_required = (__str.flags() & ios_base::showbase) !=0;
1.353 + bool __symbol_required = (__str.flags() & ios_base::showbase) != 0;
1.354 string_type __buf;
1.355 - back_insert_iterator<string_type> __stl_out(__buf);
1.356 -// pair<iter_type, bool> __result;
1.357 + back_insert_iterator<string_type> __out_ite(__buf);
1.358
1.359 for (__i = 0; __i < 4; ++__i) {
1.360 switch (__format.field[__i]) {
1.361 - case (char) money_base::none:
1.362 -#ifndef __SYMBIAN32__
1.363 - case (char) money_base::space:
1.364 -#endif
1.365 -
1.366 + case money_base::none:
1.367 if (__i == 3) {
1.368 - //if (__c_type.is(ctype_base::space, *__s)) { //gnu buf fix, 22/12/06
1.369 - if((__s != __end) && (!__c_type.is(ctype_base::space, *__s)) && (__ps.size()<=1) && (__ns.size()<=1) ){
1.370 + if (__c_type.is(ctype_base::space, *__s)) {
1.371 __err = ios_base::failbit;
1.372 return __s;
1.373 }
1.374 - // break; //gnu bug fix 2/1/07
1.375 + break;
1.376 }
1.377 while (__s != __end && __c_type.is(ctype_base::space, *__s))
1.378 ++__s;
1.379 break;
1.380 -#ifdef __SYMBIAN32__
1.381 - case (char) money_base::space:
1.382 + case money_base::space:
1.383 if (!__c_type.is(ctype_base::space, *__s)) {
1.384 -#ifdef __SYMBIAN32__
1.385 - if(!__isSignSympresent) //if no sign symbol present, space is not mandatory.
1.386 - break;
1.387 -#endif
1.388 __err = ios_base::failbit;
1.389 return __s;
1.390 }
1.391 @@ -267,10 +268,9 @@
1.392 while (__s != __end && __c_type.is(ctype_base::space, *__s))
1.393 ++__s;
1.394 break;
1.395 -#endif
1.396 case money_base::symbol: {
1.397 string_type __curs = __intl ? __punct_intl.curr_symbol()
1.398 - : __punct.curr_symbol();
1.399 + : __punct.curr_symbol();
1.400 pair<iter_type, bool>
1.401 __result = __get_string(__s, __end, __curs.begin(), __curs.end());
1.402 if (!__result.second && __symbol_required)
1.403 @@ -280,74 +280,45 @@
1.404 }
1.405 case money_base::sign: {
1.406 if (__s == __end) {
1.407 - if (__ps.size() == 0)
1.408 + if (__ps.empty())
1.409 break;
1.410 - if (__ns.size() == 0) {
1.411 + if (__ns.empty()) {
1.412 __is_positive = false;
1.413 - __sign = __ns;
1.414 break;
1.415 }
1.416 __err = ios_base::failbit;
1.417 return __s;
1.418 }
1.419 else {
1.420 - if (__ps.size() == 0) {
1.421 - if (__ns.size() == 0)
1.422 + if (__ps.empty()) {
1.423 + if (__ns.empty())
1.424 break;
1.425 if (*__s == __ns[0]) {
1.426 ++__s;
1.427 __is_positive = false;
1.428 - __sign = __ns;
1.429 -#ifdef __SYMBIAN32__
1.430 - __isSignSympresent = true;
1.431 -#endif
1.432 -
1.433 - break;
1.434 }
1.435 - // __err = ios_base::failbit; //if ps !=0 and ns!=0, and no negative sign mean it is positive, not fail.
1.436 - // return __s;
1.437 - break;
1.438 - }
1.439 + break;
1.440 + }
1.441 else {
1.442 if (*__s == __ps[0]) {
1.443 ++__s;
1.444 -#ifdef __SYMBIAN32__
1.445 - __isSignSympresent = true;
1.446 -#endif
1.447 -
1.448 break;
1.449 }
1.450 -#ifdef __SYMBIAN32__
1.451 - if (__ns.size() == 0) //here positive have symbol,negative have no symbol
1.452 - {
1.453 - __is_positive = false; // in this case if symbol not present means it is negative
1.454 - __sign = __ns;
1.455 - break;
1.456 - }
1.457 -
1.458 -#else
1.459 - if (__ns.size() == 0)
1.460 + if (__ns.empty())
1.461 break;
1.462 -#endif
1.463 if (*__s == __ns[0]) {
1.464 ++__s;
1.465 __is_positive = false;
1.466 - __sign = __ns;
1.467 -#ifdef __SYMBIAN32__
1.468 - __isSignSympresent = true;
1.469 -#endif
1.470 break;
1.471 }
1.472 __err = ios_base::failbit;
1.473 - // return __s;
1.474 }
1.475 }
1.476 return __s;
1.477 - // break;
1.478 }
1.479 case money_base::value: {
1.480 - _CharT __point = __intl ? __punct_intl.decimal_point()
1.481 - : __punct.decimal_point();
1.482 + char_type __point = __intl ? __punct_intl.decimal_point()
1.483 + : __punct.decimal_point();
1.484 int __frac_digits = __intl ? __punct_intl.frac_digits()
1.485 : __punct.frac_digits();
1.486 string __grouping = __intl ? __punct_intl.grouping()
1.487 @@ -356,13 +327,13 @@
1.488
1.489 bool __result;
1.490
1.491 - _CharT __sep = __grouping.size() == 0 ? _CharT() :
1.492 - __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
1.493 + char_type __sep = __grouping.empty() ? char_type() :
1.494 + __intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
1.495
1.496 - __result = __get_monetary_value(__s, __end, __stl_out, __c_type,
1.497 + __result = __get_monetary_value(__s, __end, __out_ite, __c_type,
1.498 __point, __frac_digits,
1.499 __sep,
1.500 - __grouping, __syntax_ok);
1.501 + __grouping, __syntax_ok);
1.502
1.503 if (!__syntax_ok)
1.504 __err |= ios_base::failbit;
1.505 @@ -371,111 +342,34 @@
1.506 return __s;
1.507 }
1.508 break;
1.509 -
1.510 +
1.511 } // Close money_base::value case
1.512 -
1.513 -
1.514 } // Close switch statement
1.515 } // Close for loop
1.516
1.517 -#ifndef __SYMBIAN32__ //find the given number pos or neg, required for cases where sign is present at string starting and ending
1.518 - do{
1.519 - bool type = true;
1.520 -
1.521 - int si = __ps.size();
1.522 - for (int i = 1;i<__ps.size();i++)
1.523 - {
1.524 - if(__s[i-1]!=__ps[i])
1.525 - {
1.526 - type = false;
1.527 - break;
1.528 - }
1.529 - }
1.530 -
1.531 - if ((si!=0) && (type ==true))
1.532 - {
1.533 - __sign = __ps;
1.534 - break;
1.535 - }
1.536 - if (__ns.size() == 0)
1.537 - break;
1.538 - type = true;
1.539 - for (int i =1;i<__ns.size();i++)
1.540 - {
1.541 - if(__s[i-1]!=__ns[i])
1.542 - {
1.543 - type = false;
1.544 - break;
1.545 - }
1.546 - }
1.547 - if (type ==true) {
1.548 - __is_positive = false;
1.549 - __sign = __ns;
1.550 - break;
1.551 - }
1.552 - }while(0);
1.553 -
1.554 -#endif
1.555 -
1.556 -
1.557 -#ifdef __SYMBIAN32__
1.558 -// Need to get the rest of the sign characters, if they exist.
1.559 - if (__sign.size() > 1)
1.560 - {
1.561 - int __len = __sign.size();
1.562 - int __i = 1;
1.563 - char_type __c = *__s;
1.564 - char_type __eol = '\0';
1.565 - for (; __c != __eol && __i < __len; __i++)
1.566 - {
1.567 - if (__s != __end)
1.568 - __c = *(++__s);
1.569 -
1.570 - }
1.571 - //checking sign completely extracted successfully
1.572 -
1.573 - if (__i != __len)
1.574 - __testvalid = false;
1.575 - }
1.576 -
1.577 -#endif
1.578 -
1.579 if (__is_positive) {
1.580 if (__ps.size() > 1) {
1.581 -#ifndef __SYMBIAN32__
1.582 pair<_InputIter, bool>
1.583 __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
1.584 __s = __result.first;
1.585 if (!__result.second)
1.586 - __err |= ios::failbit;
1.587 -#endif
1.588 - if(!__testvalid)
1.589 - __err |= ios::failbit;
1.590 + __err |= ios::failbit;
1.591 }
1.592 if (!(__err & ios_base::failbit))
1.593 __digits = __buf;
1.594 }
1.595 else {
1.596 if (__ns.size() > 1) {
1.597 -#ifndef __SYMBIAN32__
1.598 pair<_InputIter, bool>
1.599 __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
1.600 __s = __result.first;
1.601 if (!__result.second)
1.602 - __err |= ios::failbit;
1.603 -#endif
1.604 - if(!__testvalid)
1.605 - __err |= ios::failbit;
1.606 + __err |= ios::failbit;
1.607 }
1.608 - if (!(__err & ios::failbit) && (__ns == __sign)) {
1.609 - __buf.insert(__buf.begin(),__c_type.widen('-'));
1.610 + if (!(__err & ios::failbit)) {
1.611 + __digits = __c_type.widen('-');
1.612 + __digits += __buf;
1.613 }
1.614 -#ifdef __SYMBIAN32__
1.615 - if (!(__err & ios_base::failbit))
1.616 - __digits = __buf;
1.617 -#else
1.618 - __digits = __buf;
1.619 -#endif
1.620 }
1.621 if (__s == __end)
1.622 __err |= ios::eofbit;
1.623 @@ -483,50 +377,90 @@
1.624 return __s;
1.625 }
1.626
1.627 +_STLP_MOVE_TO_STD_NAMESPACE
1.628 +
1.629 +//===== methods ======
1.630 +template <class _CharT, class _InputIter>
1.631 +_InputIter
1.632 +money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter __end, bool __intl,
1.633 + ios_base& __str, ios_base::iostate& __err_,
1.634 + _STLP_LONGEST_FLOAT_TYPE& __units) const {
1.635 + ios_base::iostate __err = 0;
1.636 + string_type __buf;
1.637 + bool __is_positive = true;
1.638 + __s = _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __buf, __is_positive, (_CharT*)0);
1.639 +
1.640 + if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
1.641 + typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
1.642 +
1.643 + if (!__is_positive) ++__b;
1.644 + // Can't use atold, since it might be wchar_t. Don't get confused by name below :
1.645 + // it's perfectly capable of reading long double.
1.646 + _STLP_PRIV __get_decimal_integer(__b, __e, __units, (_CharT*)0);
1.647 +
1.648 + if (!__is_positive) {
1.649 + __units = -__units;
1.650 + }
1.651 + }
1.652 + if ( (__err & ios_base::failbit == 1) || (__err & ios_base::eofbit == 1) ) {
1.653 + __err_ |= __err;
1.654 + }
1.655 + return __s;
1.656 +}
1.657 +
1.658 +template <class _CharT, class _InputIter>
1.659 +_InputIter
1.660 +money_get<_CharT, _InputIter>::do_get(iter_type __s, iter_type __end, bool __intl,
1.661 + ios_base& __str, ios_base::iostate& __err,
1.662 + string_type& __digits) const {
1.663 + bool __is_positive = true;
1.664 + return _STLP_PRIV __money_do_get(__s, __end, __intl, __str, __err, __digits, __is_positive, (_CharT*)0);
1.665 +}
1.666 +
1.667 // money_put facets
1.668
1.669 -template <class _CharT, class _OutputIter>
1.670 -_OutputIter
1.671 -money_put<_CharT, _OutputIter>
1.672 - ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
1.673 - char_type __fill,
1.674 - const string_type& __digits) const {
1.675 - typedef ctype<_CharT> _Ctype;
1.676 - typedef moneypunct<_CharT, false> _Punct;
1.677 - typedef moneypunct<_CharT, true> _Punct_intl;
1.678 +_STLP_MOVE_TO_PRIV_NAMESPACE
1.679 +
1.680 +template <class _CharT, class _OutputIter, class _Str_Type, class _Str>
1.681 +_OutputIter __money_do_put(_OutputIter __s, bool __intl, ios_base& __str,
1.682 + _CharT __fill, const _Str& __digits, bool __check_digits,
1.683 + _Str_Type * /*__dummy*/) {
1.684 + typedef _CharT char_type;
1.685 + typedef _Str_Type string_type;
1.686 + typedef ctype<char_type> _Ctype;
1.687 + typedef moneypunct<char_type, false> _Punct;
1.688 + typedef moneypunct<char_type, true> _Punct_intl;
1.689
1.690 locale __loc = __str.getloc();
1.691 - const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
1.692 + const _Ctype& __c_type = use_facet<_Ctype>(__loc) ;
1.693 const _Punct& __punct = use_facet<_Punct>(__loc) ;
1.694 const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
1.695
1.696 // some special characters
1.697 -
1.698 char_type __minus = __c_type.widen('-');
1.699 char_type __plus = __c_type.widen('+');
1.700 char_type __space = __c_type.widen(' ');
1.701 char_type __zero = __c_type.widen('0');
1.702 - char_type __point = __intl ? __c_type.widen(__punct_intl.decimal_point())
1.703 - : __c_type.widen(__punct.decimal_point());
1.704 + char_type __point = __intl ? __punct_intl.decimal_point()
1.705 + : __punct.decimal_point();
1.706
1.707 char_type __sep = __intl ? __punct_intl.thousands_sep()
1.708 - : __punct .thousands_sep();
1.709 + : __punct.thousands_sep();
1.710
1.711 string __grouping = __intl ? __punct_intl.grouping()
1.712 - : __punct .grouping();
1.713 -
1.714 - int __frac_digits = __intl ? __punct_intl.frac_digits()
1.715 + : __punct.grouping();
1.716 +
1.717 + int __frac_digits = __intl ? __punct_intl.frac_digits()
1.718 : __punct.frac_digits();
1.719
1.720 - string_type __curr_sym = __intl ? __punct_intl.curr_symbol()
1.721 + string_type __curr_sym = __intl ? __punct_intl.curr_symbol()
1.722 : __punct.curr_symbol();
1.723
1.724 - // if there are no digits we are going to return __s. If there
1.725 - // are digits, but not enough to fill the frac_digits, we are
1.726 - // going to add zeros. I don't know whether this is right or
1.727 - // not.
1.728 -
1.729 - if (__digits.size() == 0)
1.730 + // if there are no digits we are going to return __s. If there
1.731 + // are digits, but not enough to fill the frac_digits, we are
1.732 + // going to add zeros. I don't know whether this is right or
1.733 + // not.
1.734 + if (__digits.empty())
1.735 return __s;
1.736
1.737 typename string_type::const_iterator __digits_first = __digits.begin();
1.738 @@ -536,292 +470,177 @@
1.739 if (__is_negative)
1.740 ++__digits_first;
1.741
1.742 - string_type __sign = __intl ?
1.743 - __is_negative ? __punct_intl.negative_sign()
1.744 - : __punct_intl.positive_sign()
1.745 - :
1.746 - __is_negative ? __punct.negative_sign()
1.747 - : __punct.positive_sign();
1.748 - typename string_type::const_iterator __cp = __digits_first;
1.749 - while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
1.750 - ++__cp;
1.751 - if (__cp == __digits_first)
1.752 - return __s;
1.753 - __digits_last = __cp;
1.754 +#if !defined (__BORLANDC__)
1.755 + string_type __sign = __intl ? __is_negative ? __punct_intl.negative_sign()
1.756 + : __punct_intl.positive_sign()
1.757 + : __is_negative ? __punct.negative_sign()
1.758 + : __punct.positive_sign();
1.759 +#else
1.760 + string_type __sign;
1.761 + if (__intl) {
1.762 + if (__is_negative)
1.763 + __sign = __punct_intl.negative_sign();
1.764 + else
1.765 + __sign = __punct_intl.positive_sign();
1.766 + }
1.767 + else {
1.768 + if (__is_negative)
1.769 + __sign = __punct.negative_sign();
1.770 + else
1.771 + __sign = __punct.positive_sign();
1.772 + }
1.773 +#endif
1.774 +
1.775 + if (__check_digits) {
1.776 + typename string_type::const_iterator __cp = __digits_first;
1.777 + while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
1.778 + ++__cp;
1.779 + if (__cp == __digits_first)
1.780 + return __s;
1.781 + __digits_last = __cp;
1.782 + }
1.783
1.784 // If grouping is required, we make a copy of __digits and
1.785 // insert the grouping.
1.786 -
1.787 - // To handle the fractional digits, we augment the first group
1.788 - // by frac_digits. If there is only one group, we need first
1.789 - // to duplicate it.
1.790 -
1.791 - string_type __new_digits(__digits_first, __digits_last);
1.792 -#ifdef __SYMBIAN32__
1.793 - int __numberofseperators = 0;
1.794 - if (__grouping.size()>0)
1.795 - __numberofseperators = (__new_digits.size()/__grouping[0])+1;
1.796 - else
1.797 - __numberofseperators = 0;
1.798 - __new_digits.resize(__new_digits.size()+__numberofseperators);
1.799 -#endif
1.800 - if (__grouping.size() != 0) {
1.801 - if (__grouping.size() == 1)
1.802 - __grouping.push_back(__grouping[0]);
1.803 - __grouping[0] += __frac_digits;
1.804 - _CharT* __data_ptr = __CONST_CAST(_CharT*,__new_digits.data());
1.805 - _CharT* __data_end = __data_ptr + __new_digits.size();
1.806 -
1.807 -
1.808 - ptrdiff_t __value_length = __insert_grouping(__data_ptr,
1.809 -#ifdef __SYMBIAN32__
1.810 - __data_end-__numberofseperators,
1.811 -#else
1.812 - __data_end,
1.813 -#endif
1.814 - __grouping,
1.815 - __sep,
1.816 - __plus, __minus, 0);
1.817 - __digits_first = __new_digits.begin();
1.818 - __digits_last = __digits_first + __value_length;
1.819 + _STLP_BASIC_IOSTRING(char_type) __new_digits;
1.820 + if (!__grouping.empty()) {
1.821 + __new_digits.assign(__digits_first, __digits_last);
1.822 + __insert_grouping(__new_digits,
1.823 + __new_digits.size() - __frac_digits,
1.824 + __grouping,
1.825 + __sep, __plus, __minus, 0);
1.826 + __digits_first = __new_digits.begin(); // <<--
1.827 + __digits_last = __new_digits.end(); // <<--
1.828 }
1.829
1.830 - // Determine the amount of padding required, if any.
1.831 -#ifdef __SYMBIAN32__
1.832 - int __width = __str.width(); //width returns signed value.
1.833 -#else
1.834 - size_t __width = __str.width();
1.835 -#endif
1.836 + // Determine the amount of padding required, if any.
1.837 + streamsize __width = __str.width();
1.838
1.839 -#if defined(_STLP_DEBUG) && (defined(__HP_aCC) || (__HP_aCC <= 1))
1.840 +#if defined (_STLP_DEBUG) && (defined(__HP_aCC) && (__HP_aCC <= 1))
1.841 size_t __value_length = operator -(__digits_last, __digits_first);
1.842 #else
1.843 size_t __value_length = __digits_last - __digits_first;
1.844 #endif
1.845
1.846 - size_t __length = __value_length;
1.847 -
1.848 - __length += __sign.size();
1.849 + size_t __length = __value_length + __sign.size();
1.850 +
1.851 if (__frac_digits != 0)
1.852 ++__length;
1.853
1.854 bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
1.855 if (__generate_curr)
1.856 __length += __curr_sym.size();
1.857 - money_base::pattern __format =
1.858 - __intl ? (__is_negative ? __punct_intl.neg_format()
1.859 - : __punct_intl.pos_format())
1.860 - : (__is_negative ? __punct.neg_format()
1.861 - : __punct.pos_format());
1.862 + money_base::pattern __format = __intl ? (__is_negative ? __punct_intl.neg_format()
1.863 + : __punct_intl.pos_format())
1.864 + : (__is_negative ? __punct.neg_format()
1.865 + : __punct.pos_format());
1.866 {
1.867 - for (int __i = 0; __i < 4; ++__i)
1.868 - if (__format.field[__i] == (char) money_base::space)
1.869 - ++__length;
1.870 + //For the moment the following is commented for decoding reason.
1.871 + //No reason to add a space last if the money symbol do not have to be display
1.872 + //if (__format.field[3] == (char) money_base::symbol && !__generate_curr) {
1.873 + // if (__format.field[2] == (char) money_base::space) {
1.874 + // __format.field[2] = (char) money_base::none;
1.875 + // }
1.876 + //}
1.877 + //space can only be second or third and only once (22.2.6.3-1):
1.878 + if ((__format.field[1] == (char) money_base::space) ||
1.879 + (__format.field[2] == (char) money_base::space))
1.880 + ++__length;
1.881 }
1.882
1.883 - size_t __fill_amt = (int)__length < __width ? __width - __length : 0;
1.884 + const bool __need_fill = (((sizeof(streamsize) > sizeof(size_t)) && (__STATIC_CAST(streamsize, __length) < __width)) ||
1.885 + ((sizeof(streamsize) <= sizeof(size_t)) && (__length < __STATIC_CAST(size_t, __width))));
1.886 + streamsize __fill_amt = __need_fill ? __width - __length : 0;
1.887
1.888 ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
1.889
1.890 if (__fill_amt != 0 &&
1.891 !(__fill_pos & (ios_base::left | ios_base::internal)))
1.892 - __s = fill_n(__s, __fill_amt, __fill);
1.893 -
1.894 + __s = __fill_n(__s, __fill_amt, __fill);
1.895 +
1.896 for (int __i = 0; __i < 4; ++__i) {
1.897 char __ffield = __format.field[__i];
1.898 - if (__ffield == money_base::none) {
1.899 - if (__fill_amt != 0 && __fill_pos == ios_base::internal)
1.900 - __s = fill_n(__s, __fill_amt, __fill);
1.901 - }
1.902 - else if (__ffield == money_base::space) {
1.903 -#ifdef __SYMBIAN32__
1.904 - if(__fill != __space)
1.905 - *__s++ = __fill;
1.906 - else
1.907 -#endif
1.908 - *__s++ = __space;
1.909 - if (__fill_amt != 0 && __fill_pos == ios_base::internal)
1.910 - __s = fill_n(__s, __fill_amt, __fill);
1.911 - }
1.912 - else if (__ffield == money_base::symbol) {
1.913 - if (__generate_curr)
1.914 - __s = copy(__curr_sym.begin(), __curr_sym.end(), __s);
1.915 - }
1.916 - else if (__ffield == money_base::sign) {
1.917 - if (__sign.size() != 0)
1.918 - *__s++ = __sign[0];
1.919 - }
1.920 - else if (__ffield == money_base::value) {
1.921 - if (__frac_digits == 0)
1.922 - __s = copy(__digits_first, __digits_last, __s);
1.923 - else {
1.924 - if ((int)__value_length <= __frac_digits) {
1.925 - *__s++ = __point;
1.926 + switch (__ffield) {
1.927 + case money_base::none:
1.928 + if (__fill_amt != 0 && __fill_pos == ios_base::internal)
1.929 + __s = __fill_n(__s, __fill_amt, __fill);
1.930 + break;
1.931 + case money_base::space:
1.932 + if( !__need_fill )
1.933 + {
1.934 + *__s++ = __space;
1.935 + }
1.936 + else
1.937 + {
1.938 + *__s++ = __fill;
1.939 + }
1.940 + if (__fill_amt != 0 && __fill_pos == ios_base::internal)
1.941 + __s = __fill_n(__s, __fill_amt, __fill);
1.942 + break;
1.943 + case money_base::symbol:
1.944 + if (__generate_curr)
1.945 + __s = copy(__curr_sym.begin(), __curr_sym.end(), __s);
1.946 + break;
1.947 + case money_base::sign:
1.948 + if (!__sign.empty())
1.949 + *__s++ = __sign[0];
1.950 + break;
1.951 + case money_base::value:
1.952 + if (__frac_digits == 0) {
1.953 __s = copy(__digits_first, __digits_last, __s);
1.954 - __s = fill_n(__s, __frac_digits - __value_length, __zero);
1.955 - }
1.956 - else {
1.957 -#ifdef __SYMBIAN32__
1.958 - if (__frac_digits>0)
1.959 - {
1.960 -#endif
1.961 - __s = copy(__digits_first, __digits_last - __frac_digits, __s);
1.962 - if (__frac_digits != 0) {
1.963 - *__s++ = __point;
1.964 - __s = copy(__digits_last - __frac_digits, __digits_last, __s);
1.965 -#ifdef __SYMBIAN32__
1.966 - }
1.967 -#endif
1.968 + } else {
1.969 + if ((int)__value_length <= __frac_digits) {
1.970 + // if we see '9' here, we should out 0.09
1.971 + *__s++ = __zero; // integer part is zero
1.972 + *__s++ = __point; // decimal point
1.973 + __s = __fill_n(__s, __frac_digits - __value_length, __zero); // zeros
1.974 + __s = copy(__digits_first, __digits_last, __s); // digits
1.975 + } else {
1.976 + __s = copy(__digits_first, __digits_last - __frac_digits, __s);
1.977 + if (__frac_digits != 0) {
1.978 + *__s++ = __point;
1.979 + __s = copy(__digits_last - __frac_digits, __digits_last, __s);
1.980 + }
1.981 }
1.982 }
1.983 - }
1.984 - }
1.985 + break;
1.986 + } //Close for switch
1.987 } // Close for loop
1.988
1.989 // Ouput rest of sign if necessary.
1.990 -
1.991 if (__sign.size() > 1)
1.992 __s = copy(__sign.begin() + 1, __sign.end(), __s);
1.993 - if (!(__fill_pos & (ios_base::right | ios_base::internal)))
1.994 - __s = fill_n(__s, __fill_amt, __fill);
1.995 -
1.996 -#ifdef __SYMBIAN32__
1.997 - __str.width(0);
1.998 -#endif
1.999 + if (__fill_amt != 0 &&
1.1000 + !(__fill_pos & (ios_base::right | ios_base::internal)))
1.1001 + __s = __fill_n(__s, __fill_amt, __fill);
1.1002 +
1.1003 return __s;
1.1004 }
1.1005
1.1006 -#ifdef __SYMBIAN32__
1.1007 -/*
1.1008 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1009 -moneypunct<_CharT, _International>::moneypunct(size_t __refs = 0):_BaseFacet(__refs)
1.1010 -{
1.1011 -
1.1012 -
1.1013 -}*/
1.1014 +_STLP_MOVE_TO_STD_NAMESPACE
1.1015
1.1016 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1017 -_CharT moneypunct<_CharT,_International>::do_decimal_point() const
1.1018 -{
1.1019 - return _CharT('.');
1.1020 +template <class _CharT, class _OutputIter>
1.1021 +_OutputIter
1.1022 +money_put<_CharT, _OutputIter>
1.1023 + ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
1.1024 + char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const {
1.1025 + _STLP_BASIC_IOSTRING(char_type) __digits;
1.1026 + _STLP_PRIV __get_money_digits(__digits, __str, __units);
1.1027 + return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, false, __STATIC_CAST(string_type*, 0));
1.1028 }
1.1029
1.1030 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1031 -_CharT moneypunct<_CharT,_International>::do_thousands_sep() const
1.1032 -{
1.1033 - return _CharT(',');
1.1034 -}
1.1035 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1036 -basic_string<_CharT> moneypunct<_CharT,_International>::do_curr_symbol() const
1.1037 -{
1.1038 - return _M_currSym;
1.1039 +template <class _CharT, class _OutputIter>
1.1040 +_OutputIter
1.1041 +money_put<_CharT, _OutputIter>
1.1042 + ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
1.1043 + char_type __fill, const string_type& __digits) const {
1.1044 + return _STLP_PRIV __money_do_put(__s, __intl, __str, __fill, __digits, true, __STATIC_CAST(string_type*, 0));
1.1045 }
1.1046
1.1047 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1048 -basic_string<_CharT> moneypunct<_CharT,_International>::do_positive_sign() const
1.1049 -{
1.1050 - return _M_psign;
1.1051 -}
1.1052 -
1.1053 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1054 -basic_string<_CharT> moneypunct<_CharT,_International>::do_negative_sign() const
1.1055 -{
1.1056 - return _M_nsign;
1.1057 -}
1.1058 -
1.1059 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1060 -string moneypunct<_CharT,_International>::do_grouping() const
1.1061 -{
1.1062 - return _M_group;
1.1063 -}
1.1064 -
1.1065 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1066 -money_base::pattern moneypunct<_CharT,_International>::do_pos_format() const
1.1067 -{
1.1068 - return _M_pos_format;
1.1069 -}
1.1070 -
1.1071 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
1.1072 -money_base::pattern moneypunct<_CharT,_International>::do_neg_format() const
1.1073 -{
1.1074 - return _M_neg_format;
1.1075 -}
1.1076 -
1.1077 -template<class _CharT, bool _International>
1.1078 -int moneypunct<_CharT,_International>::do_frac_digits() const
1.1079 -{
1.1080 - return 0;
1.1081 -}
1.1082 -
1.1083 -
1.1084 -//monetary_byname<any>
1.1085 -
1.1086 -template<class _CharT, bool _International>
1.1087 -_CharT moneypunct_byname<_CharT, _International>::do_decimal_point() const
1.1088 - {return _Locale_mon_decimal_pointE(_M_monetary);}
1.1089 -
1.1090 -template<class _CharT, bool _International>
1.1091 -_CharT moneypunct_byname<_CharT, _International>::do_thousands_sep() const
1.1092 - {return _Locale_mon_thousands_sepE(_M_monetary);}
1.1093 -
1.1094 -template<class _CharT, bool _International>
1.1095 -string moneypunct_byname<_CharT, _International>::do_grouping() const
1.1096 - {return moneypunct<_CharT,_International>::_M_group;}
1.1097 -
1.1098 -template<class _CharT, bool _International>
1.1099 -basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_curr_symbol() const
1.1100 - {return moneypunct<_CharT,_International>::_M_currSym;}
1.1101 -
1.1102 -template<class _CharT, bool _International>
1.1103 -basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_positive_sign() const
1.1104 - {return moneypunct<_CharT,_International>::_M_psign;}
1.1105 -
1.1106 -template<class _CharT, bool _International>
1.1107 -basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_negative_sign() const
1.1108 - {return moneypunct<_CharT,_International>::_M_nsign;}
1.1109 -
1.1110 -template<class _CharT, bool _International>
1.1111 -int moneypunct_byname<_CharT, _International>::do_frac_digits() const
1.1112 - {return _Locale_int_frac_digitsE(_M_monetary);}
1.1113 -
1.1114 -template<class _CharT, bool _International>
1.1115 -void moneypunct_byname<_CharT, _International>::Convert_string2_string_chart(basic_string<_CharT> &dst, string src)
1.1116 - {
1.1117 - int length = src.length();
1.1118 - const char* str = src.c_str();
1.1119 - for(int i = 0; i<length;i++)
1.1120 - {
1.1121 - dst.append(1, (_CharT)*str++);
1.1122 -
1.1123 - }
1.1124 -
1.1125 - }
1.1126 -
1.1127 -template<class _CharT, bool _International>
1.1128 -moneypunct_byname<_CharT, _International>::moneypunct_byname(const char * name,
1.1129 - size_t refs):
1.1130 - moneypunct<_CharT, _International>(refs),
1.1131 - _M_monetary(__acquire_monetaryE(name))
1.1132 -{
1.1133 - if (!_M_monetary)
1.1134 - locale::_M_throw_runtime_error();
1.1135 -
1.1136 - moneypunct<_CharT,_International>::_M_group = _Locale_mon_groupingE(_M_monetary);
1.1137 - Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_psign, _Locale_positive_signE(_M_monetary));
1.1138 - Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_nsign, _Locale_negative_signE(_M_monetary));
1.1139 - Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_currSym, _Locale_int_curr_symbolE(_M_monetary));
1.1140 -}
1.1141 -
1.1142 -template<class _CharT, bool _International>
1.1143 -moneypunct_byname<_CharT, _International>::~moneypunct_byname()
1.1144 -{
1.1145 - __release_monetaryE(_M_monetary);
1.1146 -}
1.1147 -
1.1148 -
1.1149 -#endif
1.1150 _STLP_END_NAMESPACE
1.1151
1.1152 -# endif /* EXPOSE */
1.1153 +#endif /* _STLP_MONETARY_C */
1.1154
1.1155 -#endif /* _STLP_MONETARY_C */
1.1156 +// Local Variables:
1.1157 +// mode:C++
1.1158 +// End: