| williamr@2 |      1 | /*
 | 
| williamr@2 |      2 |  * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
 | 
| williamr@2 |      3 |  *
 | 
| williamr@2 |      4 |  * Copyright (c) 1999
 | 
| williamr@2 |      5 |  * Silicon Graphics Computer Systems, Inc.
 | 
| williamr@2 |      6 |  *
 | 
| williamr@2 |      7 |  * Copyright (c) 1999 
 | 
| williamr@2 |      8 |  * Boris Fomitchev
 | 
| williamr@2 |      9 |  *
 | 
| williamr@2 |     10 |  * This material is provided "as is", with absolutely no warranty expressed
 | 
| williamr@2 |     11 |  * or implied. Any use is at your own risk.
 | 
| williamr@2 |     12 |  *
 | 
| williamr@2 |     13 |  * Permission to use or copy this software for any purpose is hereby granted 
 | 
| williamr@2 |     14 |  * without fee, provided the above notices are retained on all copies.
 | 
| williamr@2 |     15 |  * Permission to modify the code and to distribute modified code is granted,
 | 
| williamr@2 |     16 |  * provided the above notices are retained, and a notice that the code was
 | 
| williamr@2 |     17 |  * modified is included with the above copyright notice.
 | 
| williamr@2 |     18 |  *
 | 
| williamr@2 |     19 |  */ 
 | 
| williamr@2 |     20 | #ifndef _STLP_MONETARY_C
 | 
| williamr@2 |     21 | #define _STLP_MONETARY_C
 | 
| williamr@2 |     22 | 
 | 
| williamr@2 |     23 | # ifndef _STLP_INTERNAL_MONETARY_H
 | 
| williamr@2 |     24 | #  include <stl/_monetary.h>
 | 
| williamr@2 |     25 | # endif
 | 
| williamr@2 |     26 | 
 | 
| williamr@2 |     27 | # if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
 | 
| williamr@2 |     28 | 
 | 
| williamr@2 |     29 | #ifndef _STLP_INTERNAL_IOS_H
 | 
| williamr@2 |     30 | # include <stl/_ios.h>
 | 
| williamr@2 |     31 | #endif
 | 
| williamr@2 |     32 | 
 | 
| williamr@2 |     33 | #ifndef _STLP_INTERNAL_NUM_PUT_H
 | 
| williamr@2 |     34 | # include <stl/_num_put.h>
 | 
| williamr@2 |     35 | #endif
 | 
| williamr@2 |     36 | 
 | 
| williamr@2 |     37 | #ifndef _STLP_INTERNAL_NUM_GET_H
 | 
| williamr@2 |     38 | # include <stl/_num_get.h>
 | 
| williamr@2 |     39 | #endif
 | 
| williamr@2 |     40 | 
 | 
| williamr@2 |     41 | _STLP_BEGIN_NAMESPACE
 | 
| williamr@2 |     42 | 
 | 
| williamr@2 |     43 | # if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
 | 
| williamr@2 |     44 | # if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
 | 
| williamr@2 |     45 | template <class _CharT, class _InputIterator>
 | 
| williamr@2 |     46 | locale::id money_get<_CharT, _InputIterator>::id;
 | 
| williamr@2 |     47 | 
 | 
| williamr@2 |     48 | template <class _CharT, class _OutputIterator>
 | 
| williamr@2 |     49 | locale::id money_put<_CharT, _OutputIterator>::id;
 | 
| williamr@2 |     50 | #endif
 | 
| williamr@2 |     51 | # else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
 | 
| williamr@2 |     52 | 
 | 
| williamr@2 |     53 | typedef money_get<char, const char*> money_get_char;
 | 
| williamr@2 |     54 | typedef money_put<char, char*> money_put_char;
 | 
| williamr@2 |     55 | typedef money_get<char, istreambuf_iterator<char, char_traits<char> > > money_get_char_2;
 | 
| williamr@2 |     56 | typedef money_put<char, ostreambuf_iterator<char, char_traits<char> > > money_put_char_2;
 | 
| williamr@2 |     57 | 
 | 
| williamr@2 |     58 | #ifndef __SYMBIAN32__
 | 
| williamr@2 |     59 | __DECLARE_INSTANCE(locale::id, money_get_char::id, );
 | 
| williamr@2 |     60 | __DECLARE_INSTANCE(locale::id, money_put_char::id, );
 | 
| williamr@2 |     61 | __DECLARE_INSTANCE(locale::id, money_get_char_2::id, );
 | 
| williamr@2 |     62 | __DECLARE_INSTANCE(locale::id, money_put_char_2::id, );
 | 
| williamr@2 |     63 | #endif
 | 
| williamr@2 |     64 | 
 | 
| williamr@2 |     65 | # ifndef _STLP_NO_WCHAR_T
 | 
| williamr@2 |     66 | 
 | 
| williamr@2 |     67 | typedef money_get<wchar_t, const wchar_t*> money_get_wchar_t;
 | 
| williamr@2 |     68 | typedef money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_get_wchar_t_2;
 | 
| williamr@2 |     69 | typedef money_put<wchar_t, wchar_t*> money_put_wchar_t;
 | 
| williamr@2 |     70 | typedef money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_put_wchar_t_2;
 | 
| williamr@2 |     71 | 
 | 
| williamr@2 |     72 | #ifndef __SYMBIAN32__
 | 
| williamr@2 |     73 | __DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, );
 | 
| williamr@2 |     74 | __DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, );
 | 
| williamr@2 |     75 | __DECLARE_INSTANCE(locale::id, money_get_wchar_t_2::id, );
 | 
| williamr@2 |     76 | __DECLARE_INSTANCE(locale::id, money_put_wchar_t_2::id, );
 | 
| williamr@2 |     77 | #endif
 | 
| williamr@2 |     78 | 
 | 
| williamr@2 |     79 | # endif
 | 
| williamr@2 |     80 | # endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
 | 
| williamr@2 |     81 | 
 | 
| williamr@2 |     82 | // money_get facets
 | 
| williamr@2 |     83 | 
 | 
| williamr@2 |     84 | 
 | 
| williamr@2 |     85 | // helper functions for do_get
 | 
| williamr@2 |     86 | template <class _InIt1, class _InIt2>
 | 
| williamr@2 |     87 | pair<_InIt1, bool> __get_string(_InIt1 __first,     _InIt1 __last,
 | 
| williamr@2 |     88 |                                _InIt2 __str_first, _InIt2 __str_last) {
 | 
| williamr@2 |     89 |   pair<_InIt1, _InIt2> __pr = mismatch(__first, __last, __str_first);
 | 
| williamr@2 |     90 |   return make_pair(__pr.first, __pr.second == __str_last);
 | 
| williamr@2 |     91 | }
 | 
| williamr@2 |     92 | 
 | 
| williamr@2 |     93 | template <class _InIt, class _OuIt, class _CharT>
 | 
| williamr@2 |     94 | bool
 | 
| williamr@2 |     95 | __get_monetary_value(_InIt& __first, _InIt __last, _OuIt __stl_out,
 | 
| williamr@2 |     96 |                      const ctype<_CharT>& _c_type,
 | 
| williamr@2 |     97 |                      _CharT   __point,
 | 
| williamr@2 |     98 |                      int      __frac_digits,
 | 
| williamr@2 |     99 |                      _CharT __sep,
 | 
| williamr@2 |    100 |                      const string& __grouping,
 | 
| williamr@2 |    101 |                      bool&         __syntax_ok)
 | 
| williamr@2 |    102 | {
 | 
| williamr@2 |    103 | 
 | 
| williamr@2 |    104 | 	size_t __digits = 0;
 | 
| williamr@2 |    105 | 
 | 
| williamr@2 |    106 |   if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
 | 
| williamr@2 |    107 |     return false;
 | 
| williamr@2 |    108 | 
 | 
| williamr@2 |    109 |   char __group_sizes[128];
 | 
| williamr@2 |    110 |   char* __group_sizes_end = __grouping.size() == 0 ? 0 : __group_sizes;
 | 
| williamr@2 |    111 |   char   __current_group_size = 0;
 | 
| williamr@2 |    112 | 
 | 
| williamr@2 |    113 |   while (__first != __last) {
 | 
| williamr@2 |    114 |     if (_c_type.is(ctype_base::digit, *__first)) {
 | 
| williamr@2 |    115 |       ++__current_group_size;
 | 
| williamr@2 |    116 |       *__stl_out++ = *__first++;
 | 
| williamr@2 |    117 | 	  __digits++;
 | 
| williamr@2 |    118 |     }
 | 
| williamr@2 |    119 | #ifdef __SYMBIAN32__
 | 
| williamr@2 |    120 | else if ( (__current_group_size)&&(__group_sizes_end) ){
 | 
| williamr@2 |    121 | #else
 | 
| williamr@2 |    122 |     else if (__group_sizes_end) {
 | 
| williamr@2 |    123 | #endif		
 | 
| williamr@2 |    124 |       if (*__first == __sep) {
 | 
| williamr@2 |    125 | 	*__group_sizes_end++ = __current_group_size; 
 | 
| williamr@2 |    126 | 	__current_group_size = 0;
 | 
| williamr@2 |    127 | 	++__first;
 | 
| williamr@2 |    128 |       }
 | 
| williamr@2 |    129 |       else break;
 | 
| williamr@2 |    130 |     }
 | 
| williamr@2 |    131 |     else
 | 
| williamr@2 |    132 |       break;
 | 
| williamr@2 |    133 |   }
 | 
| williamr@2 |    134 | 
 | 
| williamr@2 |    135 |   if (__grouping.size() == 0)
 | 
| williamr@2 |    136 |     __syntax_ok = true;
 | 
| williamr@2 |    137 |   else {
 | 
| williamr@2 |    138 |     if (__group_sizes_end != __group_sizes)
 | 
| williamr@2 |    139 |      *__group_sizes_end++ = __current_group_size; 
 | 
| williamr@2 |    140 |     
 | 
| williamr@2 |    141 |     __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
 | 
| williamr@2 |    142 |                                    __grouping.data(), __grouping.data()+ __grouping.size());  
 | 
| williamr@2 |    143 |     
 | 
| williamr@2 |    144 |     if (__first == __last || *__first != __point) {
 | 
| williamr@2 |    145 |       for (int __digits = 0; __digits != __frac_digits; ++__digits)
 | 
| williamr@2 |    146 |         *__stl_out++ = _CharT('0');
 | 
| williamr@2 |    147 |       return true; // OK not to have decimal point
 | 
| williamr@2 |    148 |     }
 | 
| williamr@2 |    149 |   }
 | 
| williamr@2 |    150 | //bug fix testcase_22427 - commented
 | 
| williamr@2 |    151 | //  ++__first; 
 | 
| williamr@2 |    152 | 
 | 
| williamr@2 |    153 | 
 | 
| williamr@2 |    154 |   //bug fix testcase_22427 - added if
 | 
| williamr@2 |    155 | 
 | 
| williamr@2 |    156 |   if (__first != __last && *__first == __point && __frac_digits)
 | 
| williamr@2 |    157 |   {  	
 | 
| williamr@2 |    158 | 	//bug fix testcase_22427 - commented
 | 
| williamr@2 |    159 | 	++__first; 
 | 
| williamr@2 |    160 | 	  while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
 | 
| williamr@2 |    161 | 	      *__stl_out++ = *__first++;
 | 
| williamr@2 |    162 | 	     ++__digits;
 | 
| williamr@2 |    163 | 	  }
 | 
| williamr@2 |    164 |   }
 | 
| williamr@2 |    165 | 
 | 
| williamr@2 |    166 |   //bug fix testcase_22427 - condition changed
 | 
| williamr@2 |    167 | //  __syntax_ok = __syntax_ok && (__digits == __frac_digits);
 | 
| williamr@2 |    168 |   
 | 
| williamr@2 |    169 |  if(__digits == 0)
 | 
| williamr@2 |    170 |   	__syntax_ok = false;
 | 
| williamr@2 |    171 | 
 | 
| williamr@2 |    172 |   return true;
 | 
| williamr@2 |    173 | }
 | 
| williamr@2 |    174 | 
 | 
| williamr@2 |    175 | # ifndef _STLP_NO_LONG_DOUBLE
 | 
| williamr@2 |    176 | 
 | 
| williamr@2 |    177 | //===== methods ======
 | 
| williamr@2 |    178 | template <class _CharT, class _InputIter>
 | 
| williamr@2 |    179 | _InputIter 
 | 
| williamr@2 |    180 | money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter  __end, bool  __intl,
 | 
| williamr@2 |    181 | 				      ios_base&  __str, ios_base::iostate& __err,
 | 
| williamr@2 |    182 | 				      long double& __units) const {
 | 
| williamr@2 |    183 |   string_type __buf;
 | 
| williamr@2 |    184 |   __s = do_get(__s, __end, __intl, __str, __err, __buf);
 | 
| williamr@2 |    185 | 
 | 
| williamr@2 |    186 |   if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
 | 
| williamr@2 |    187 |     __buf.push_back(0);
 | 
| williamr@2 |    188 |     typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
 | 
| williamr@2 |    189 |     // Can't use atold, since it might be wchar_t. Don't get confused by name below :
 | 
| williamr@2 |    190 |     // it's perfectly capable of reading long double.
 | 
| williamr@2 |    191 |     __get_decimal_integer(__b, __e, __units);
 | 
| williamr@2 |    192 |   }
 | 
| williamr@2 |    193 |   if (__s == __end)
 | 
| williamr@2 |    194 |     __err |= ios_base::eofbit;
 | 
| williamr@2 |    195 |   return __s;
 | 
| williamr@2 |    196 | }
 | 
| williamr@2 |    197 | # endif
 | 
| williamr@2 |    198 | 
 | 
| williamr@2 |    199 | template <class _CharT, class _InputIter>
 | 
| williamr@2 |    200 | _InputIter 
 | 
| williamr@2 |    201 | money_get<_CharT, _InputIter>::do_get(iter_type __s, 
 | 
| williamr@2 |    202 | 				      iter_type  __end, bool  __intl,
 | 
| williamr@2 |    203 | 				      ios_base&  __str, ios_base::iostate&  __err,
 | 
| williamr@2 |    204 | 				      string_type& __digits) const {
 | 
| williamr@2 |    205 | 	__err = 0;
 | 
| williamr@2 |    206 |   if (__s == __end) {
 | 
| williamr@2 |    207 |     __err |= ios_base::eofbit;
 | 
| williamr@2 |    208 |     return __s;
 | 
| williamr@2 |    209 |   }
 | 
| williamr@2 |    210 | 
 | 
| williamr@2 |    211 |   typedef moneypunct<_CharT, false> _Punct;
 | 
| williamr@2 |    212 |   typedef moneypunct<_CharT, true>  _Punct_intl;
 | 
| williamr@2 |    213 |   typedef ctype<_CharT>             _Ctype;
 | 
| williamr@2 |    214 | #ifdef __SYMBIAN32__			
 | 
| williamr@2 |    215 | 	bool		__isSignSympresent = false;
 | 
| williamr@2 |    216 | #endif			
 | 
| williamr@2 |    217 | 
 | 
| williamr@2 |    218 |  bool	__testvalid = true;
 | 
| williamr@2 |    219 |   locale __loc = __str.getloc();
 | 
| williamr@2 |    220 |   const _Punct&      __punct      = use_facet<_Punct>(__loc) ;
 | 
| williamr@2 |    221 |   const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
 | 
| williamr@2 |    222 |   const _Ctype&      __c_type      = use_facet<_Ctype>(__loc) ;
 | 
| williamr@2 |    223 |                    
 | 
| williamr@2 |    224 |   money_base::pattern __format = __intl ? __punct_intl.neg_format()
 | 
| williamr@2 |    225 |                                         : __punct.neg_format();
 | 
| williamr@2 |    226 |   string_type __ns = __intl ? __punct_intl.negative_sign()
 | 
| williamr@2 |    227 |                             : __punct.negative_sign();
 | 
| williamr@2 |    228 |   string_type __ps = __intl ? __punct_intl.positive_sign()
 | 
| williamr@2 |    229 |                             : __punct.positive_sign();
 | 
| williamr@2 |    230 |   string_type __sign  = __ps;
 | 
| williamr@2 |    231 |   int __i;
 | 
| williamr@2 |    232 |   bool __is_positive = true;
 | 
| williamr@2 |    233 |   bool __symbol_required = (__str.flags() & ios_base::showbase) !=0;
 | 
| williamr@2 |    234 |   string_type __buf;
 | 
| williamr@2 |    235 |   back_insert_iterator<string_type> __stl_out(__buf);
 | 
| williamr@2 |    236 | //  pair<iter_type, bool> __result;
 | 
| williamr@2 |    237 | 
 | 
| williamr@2 |    238 |   for (__i = 0; __i < 4; ++__i) {
 | 
| williamr@2 |    239 |     switch (__format.field[__i]) {
 | 
| williamr@2 |    240 |     case (char) money_base::none:
 | 
| williamr@2 |    241 | #ifndef	__SYMBIAN32__
 | 
| williamr@2 |    242 | 	  case (char) money_base::space:
 | 
| williamr@2 |    243 | #endif	  	
 | 
| williamr@2 |    244 | 
 | 
| williamr@2 |    245 |       if (__i == 3) {
 | 
| williamr@2 |    246 |         //if (__c_type.is(ctype_base::space, *__s)) { //gnu buf fix, 22/12/06
 | 
| williamr@2 |    247 |         if((__s != __end) && (!__c_type.is(ctype_base::space, *__s)) && (__ps.size()<=1) && (__ns.size()<=1) ){
 | 
| williamr@2 |    248 |           __err = ios_base::failbit;
 | 
| williamr@2 |    249 |           return __s;
 | 
| williamr@2 |    250 |         }
 | 
| williamr@2 |    251 |        // break; //gnu bug fix 2/1/07
 | 
| williamr@2 |    252 |       }
 | 
| williamr@2 |    253 |       while (__s != __end && __c_type.is(ctype_base::space, *__s))
 | 
| williamr@2 |    254 |         ++__s;
 | 
| williamr@2 |    255 |       break;
 | 
| williamr@2 |    256 | #ifdef	__SYMBIAN32__	  
 | 
| williamr@2 |    257 |     case (char) money_base::space:
 | 
| williamr@2 |    258 |       if (!__c_type.is(ctype_base::space, *__s)) {
 | 
| williamr@2 |    259 | #ifdef __SYMBIAN32__      
 | 
| williamr@2 |    260 |       	if(!__isSignSympresent) //if no sign symbol present, space is not mandatory.
 | 
| williamr@2 |    261 |       		break;
 | 
| williamr@2 |    262 | #endif      	
 | 
| williamr@2 |    263 |         __err = ios_base::failbit;
 | 
| williamr@2 |    264 |         return __s;
 | 
| williamr@2 |    265 |       }
 | 
| williamr@2 |    266 |       ++__s;
 | 
| williamr@2 |    267 |       while (__s != __end && __c_type.is(ctype_base::space, *__s))
 | 
| williamr@2 |    268 |         ++__s;
 | 
| williamr@2 |    269 |       break;
 | 
| williamr@2 |    270 | #endif	  
 | 
| williamr@2 |    271 |     case money_base::symbol: {
 | 
| williamr@2 |    272 |       string_type __curs = __intl ? __punct_intl.curr_symbol()
 | 
| williamr@2 |    273 |                                 : __punct.curr_symbol();
 | 
| williamr@2 |    274 |       pair<iter_type, bool>
 | 
| williamr@2 |    275 |       __result  = __get_string(__s, __end, __curs.begin(), __curs.end());
 | 
| williamr@2 |    276 |       if (!__result.second && __symbol_required)
 | 
| williamr@2 |    277 |         __err = ios_base::failbit;
 | 
| williamr@2 |    278 |       __s = __result.first;
 | 
| williamr@2 |    279 |       break;
 | 
| williamr@2 |    280 |     }
 | 
| williamr@2 |    281 |     case money_base::sign: {
 | 
| williamr@2 |    282 |       if (__s == __end) {
 | 
| williamr@2 |    283 |         if (__ps.size() == 0)
 | 
| williamr@2 |    284 |           break;
 | 
| williamr@2 |    285 |         if (__ns.size() == 0) {
 | 
| williamr@2 |    286 |           __is_positive = false;
 | 
| williamr@2 |    287 | 	__sign  = __ns;
 | 
| williamr@2 |    288 |           break;
 | 
| williamr@2 |    289 |         }
 | 
| williamr@2 |    290 |         __err = ios_base::failbit;
 | 
| williamr@2 |    291 |         return __s;
 | 
| williamr@2 |    292 |       }
 | 
| williamr@2 |    293 |       else {
 | 
| williamr@2 |    294 |         if (__ps.size() == 0) {
 | 
| williamr@2 |    295 |           if (__ns.size() == 0)
 | 
| williamr@2 |    296 |             break;
 | 
| williamr@2 |    297 |           if (*__s == __ns[0]) {
 | 
| williamr@2 |    298 |             ++__s;
 | 
| williamr@2 |    299 |             __is_positive = false;
 | 
| williamr@2 |    300 | 			__sign  = __ns;
 | 
| williamr@2 |    301 | #ifdef __SYMBIAN32__			
 | 
| williamr@2 |    302 | 			__isSignSympresent = true;
 | 
| williamr@2 |    303 | #endif			
 | 
| williamr@2 |    304 | 
 | 
| williamr@2 |    305 |             break;
 | 
| williamr@2 |    306 |           }
 | 
| williamr@2 |    307 |         //  __err = ios_base::failbit; //if ps !=0 and ns!=0, and no negative sign mean it is positive, not fail.
 | 
| williamr@2 |    308 | 	  //          return __s;
 | 
| williamr@2 |    309 | 	  break;
 | 
| williamr@2 |    310 |         } 
 | 
| williamr@2 |    311 |         else {
 | 
| williamr@2 |    312 |           if (*__s == __ps[0]) {
 | 
| williamr@2 |    313 |             ++__s;
 | 
| williamr@2 |    314 | #ifdef __SYMBIAN32__			
 | 
| williamr@2 |    315 | 			__isSignSympresent = true;
 | 
| williamr@2 |    316 | #endif			
 | 
| williamr@2 |    317 | 
 | 
| williamr@2 |    318 |             break;
 | 
| williamr@2 |    319 |           }
 | 
| williamr@2 |    320 | #ifdef	__SYMBIAN32__
 | 
| williamr@2 |    321 | 	    if (__ns.size() == 0) //here positive have symbol,negative have no symbol
 | 
| williamr@2 |    322 | 	    {
 | 
| williamr@2 |    323 | 	    	__is_positive = false; // in this case if symbol not present means it is negative
 | 
| williamr@2 |    324 | 	    	__sign = __ns;
 | 
| williamr@2 |    325 | 	    	break;
 | 
| williamr@2 |    326 | 	    }
 | 
| williamr@2 |    327 |             
 | 
| williamr@2 |    328 | #else          
 | 
| williamr@2 |    329 |           if (__ns.size() == 0)
 | 
| williamr@2 |    330 |             break;
 | 
| williamr@2 |    331 | #endif          
 | 
| williamr@2 |    332 |           if (*__s == __ns[0]) {
 | 
| williamr@2 |    333 |             ++__s;
 | 
| williamr@2 |    334 |             __is_positive = false;
 | 
| williamr@2 |    335 | 			__sign  = __ns;
 | 
| williamr@2 |    336 | #ifdef __SYMBIAN32__			
 | 
| williamr@2 |    337 | 			__isSignSympresent = true;
 | 
| williamr@2 |    338 | #endif			
 | 
| williamr@2 |    339 |             break;
 | 
| williamr@2 |    340 |           }
 | 
| williamr@2 |    341 |           __err = ios_base::failbit;
 | 
| williamr@2 |    342 | 	  //          return __s;
 | 
| williamr@2 |    343 |         }
 | 
| williamr@2 |    344 |       }
 | 
| williamr@2 |    345 |       return __s;
 | 
| williamr@2 |    346 |       //      break;
 | 
| williamr@2 |    347 |     }
 | 
| williamr@2 |    348 |     case money_base::value: {
 | 
| williamr@2 |    349 |       _CharT __point = __intl ? __punct_intl.decimal_point()
 | 
| williamr@2 |    350 |                               : __punct.decimal_point();
 | 
| williamr@2 |    351 |       int __frac_digits = __intl ? __punct_intl.frac_digits()
 | 
| williamr@2 |    352 |                                  : __punct.frac_digits();
 | 
| williamr@2 |    353 |       string __grouping = __intl ? __punct_intl.grouping()
 | 
| williamr@2 |    354 |                                  : __punct.grouping();
 | 
| williamr@2 |    355 |       bool __syntax_ok = true;
 | 
| williamr@2 |    356 | 
 | 
| williamr@2 |    357 |       bool __result;
 | 
| williamr@2 |    358 | 
 | 
| williamr@2 |    359 |       _CharT __sep = __grouping.size() == 0 ? _CharT() : 
 | 
| williamr@2 |    360 | 	__intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
 | 
| williamr@2 |    361 | 
 | 
| williamr@2 |    362 |       __result = __get_monetary_value(__s, __end, __stl_out, __c_type,
 | 
| williamr@2 |    363 |                                       __point, __frac_digits,
 | 
| williamr@2 |    364 |                                       __sep,
 | 
| williamr@2 |    365 |                                       __grouping, __syntax_ok);      
 | 
| williamr@2 |    366 | 
 | 
| williamr@2 |    367 |       if (!__syntax_ok)
 | 
| williamr@2 |    368 |         __err |= ios_base::failbit;
 | 
| williamr@2 |    369 |       if (!__result) {
 | 
| williamr@2 |    370 |         __err = ios_base::failbit;
 | 
| williamr@2 |    371 |         return __s;
 | 
| williamr@2 |    372 |       }
 | 
| williamr@2 |    373 |       break;
 | 
| williamr@2 |    374 |       
 | 
| williamr@2 |    375 |     }                           // Close money_base::value case
 | 
| williamr@2 |    376 | 
 | 
| williamr@2 |    377 | 
 | 
| williamr@2 |    378 |     }                           // Close switch statement
 | 
| williamr@2 |    379 |   }                             // Close for loop
 | 
| williamr@2 |    380 | 
 | 
| williamr@2 |    381 | #ifndef __SYMBIAN32__ //find the given number pos or neg, required for cases where sign is present at string starting and ending
 | 
| williamr@2 |    382 | 	do{
 | 
| williamr@2 |    383 | 	bool type = true;
 | 
| williamr@2 |    384 | 
 | 
| williamr@2 |    385 | 	int si = __ps.size();
 | 
| williamr@2 |    386 | 	for (int i = 1;i<__ps.size();i++)
 | 
| williamr@2 |    387 | 		{
 | 
| williamr@2 |    388 | 			if(__s[i-1]!=__ps[i])
 | 
| williamr@2 |    389 | 			{
 | 
| williamr@2 |    390 | 				type = false;
 | 
| williamr@2 |    391 | 				break;
 | 
| williamr@2 |    392 | 			}
 | 
| williamr@2 |    393 | 		}
 | 
| williamr@2 |    394 | 	
 | 
| williamr@2 |    395 | 	if ((si!=0) && (type ==true))
 | 
| williamr@2 |    396 | 	{
 | 
| williamr@2 |    397 | 		__sign = __ps;
 | 
| williamr@2 |    398 |             break;
 | 
| williamr@2 |    399 | 	}  
 | 
| williamr@2 |    400 |           if (__ns.size() == 0)
 | 
| williamr@2 |    401 |             break;
 | 
| williamr@2 |    402 | 	type = true;
 | 
| williamr@2 |    403 | 	for (int i =1;i<__ns.size();i++)
 | 
| williamr@2 |    404 | 		{
 | 
| williamr@2 |    405 | 			if(__s[i-1]!=__ns[i])
 | 
| williamr@2 |    406 | 			{
 | 
| williamr@2 |    407 | 				type = false;
 | 
| williamr@2 |    408 | 				break;
 | 
| williamr@2 |    409 | 			}
 | 
| williamr@2 |    410 | 		}
 | 
| williamr@2 |    411 |           if (type ==true) {
 | 
| williamr@2 |    412 |             __is_positive = false;
 | 
| williamr@2 |    413 | 		__sign = __ns;
 | 
| williamr@2 |    414 |             break;
 | 
| williamr@2 |    415 |           }
 | 
| williamr@2 |    416 | 	}while(0);
 | 
| williamr@2 |    417 | 
 | 
| williamr@2 |    418 | #endif
 | 
| williamr@2 |    419 | 
 | 
| williamr@2 |    420 | 
 | 
| williamr@2 |    421 | #ifdef __SYMBIAN32__
 | 
| williamr@2 |    422 | // Need to get the rest of the sign characters, if they exist.
 | 
| williamr@2 |    423 |       if (__sign.size() > 1)
 | 
| williamr@2 |    424 |         {
 | 
| williamr@2 |    425 |           int __len = __sign.size();
 | 
| williamr@2 |    426 |           int __i = 1;
 | 
| williamr@2 |    427 | 	  char_type __c = *__s;
 | 
| williamr@2 |    428 | 	  char_type __eol = '\0';
 | 
| williamr@2 |    429 |           for (; __c != __eol && __i < __len; __i++)
 | 
| williamr@2 |    430 |           	{
 | 
| williamr@2 |    431 |             	if (__s != __end)
 | 
| williamr@2 |    432 |               	__c = *(++__s);
 | 
| williamr@2 |    433 |             	
 | 
| williamr@2 |    434 |           }
 | 
| williamr@2 |    435 | 		  //checking sign completely extracted successfully
 | 
| williamr@2 |    436 | 		 
 | 
| williamr@2 |    437 |           if (__i != __len)
 | 
| williamr@2 |    438 |             __testvalid = false;
 | 
| williamr@2 |    439 |         }
 | 
| williamr@2 |    440 | 
 | 
| williamr@2 |    441 | #endif
 | 
| williamr@2 |    442 | 
 | 
| williamr@2 |    443 |   if (__is_positive) {
 | 
| williamr@2 |    444 |     if (__ps.size() > 1) {
 | 
| williamr@2 |    445 | #ifndef __SYMBIAN32__		
 | 
| williamr@2 |    446 |       pair<_InputIter, bool>
 | 
| williamr@2 |    447 |         __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
 | 
| williamr@2 |    448 |       __s = __result.first;
 | 
| williamr@2 |    449 |       if (!__result.second)
 | 
| williamr@2 |    450 | 	__err |= ios::failbit;
 | 
| williamr@2 |    451 | #endif
 | 
| williamr@2 |    452 | 	if(!__testvalid)
 | 
| williamr@2 |    453 | 		__err |= ios::failbit;
 | 
| williamr@2 |    454 |     }
 | 
| williamr@2 |    455 |     if (!(__err & ios_base::failbit))
 | 
| williamr@2 |    456 |       __digits = __buf;
 | 
| williamr@2 |    457 |   }
 | 
| williamr@2 |    458 |   else {
 | 
| williamr@2 |    459 |     if (__ns.size() > 1) {
 | 
| williamr@2 |    460 | #ifndef __SYMBIAN32__		
 | 
| williamr@2 |    461 |       pair<_InputIter, bool>
 | 
| williamr@2 |    462 |         __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
 | 
| williamr@2 |    463 |       __s = __result.first;
 | 
| williamr@2 |    464 |       if (!__result.second)
 | 
| williamr@2 |    465 | 	__err |= ios::failbit;
 | 
| williamr@2 |    466 | #endif
 | 
| williamr@2 |    467 | 	if(!__testvalid)
 | 
| williamr@2 |    468 | 		__err |= ios::failbit;
 | 
| williamr@2 |    469 |     }
 | 
| williamr@2 |    470 |     if (!(__err & ios::failbit) && (__ns == __sign)) {
 | 
| williamr@2 |    471 |       __buf.insert(__buf.begin(),__c_type.widen('-'));      
 | 
| williamr@2 |    472 |     }
 | 
| williamr@2 |    473 | #ifdef __SYMBIAN32__	
 | 
| williamr@2 |    474 |   if (!(__err & ios_base::failbit))
 | 
| williamr@2 |    475 |       __digits = __buf;	
 | 
| williamr@2 |    476 | #else  
 | 
| williamr@2 |    477 |    __digits = __buf;	
 | 
| williamr@2 |    478 | #endif
 | 
| williamr@2 |    479 |   }
 | 
| williamr@2 |    480 |   if (__s == __end)
 | 
| williamr@2 |    481 |     __err |= ios::eofbit;
 | 
| williamr@2 |    482 | 
 | 
| williamr@2 |    483 |   return __s;
 | 
| williamr@2 |    484 | }
 | 
| williamr@2 |    485 | 
 | 
| williamr@2 |    486 | // money_put facets
 | 
| williamr@2 |    487 | 
 | 
| williamr@2 |    488 | template <class _CharT, class _OutputIter>
 | 
| williamr@2 |    489 | _OutputIter
 | 
| williamr@2 |    490 | money_put<_CharT, _OutputIter>
 | 
| williamr@2 |    491 |  ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
 | 
| williamr@2 |    492 |           char_type __fill,
 | 
| williamr@2 |    493 |           const string_type& __digits) const { 
 | 
| williamr@2 |    494 |   typedef ctype<_CharT>             _Ctype;
 | 
| williamr@2 |    495 |   typedef moneypunct<_CharT, false> _Punct;
 | 
| williamr@2 |    496 |   typedef moneypunct<_CharT, true>  _Punct_intl;
 | 
| williamr@2 |    497 | 
 | 
| williamr@2 |    498 |   locale __loc = __str.getloc();
 | 
| williamr@2 |    499 |   const _Ctype&      __c_type      = use_facet<_Ctype>(__loc) ;
 | 
| williamr@2 |    500 |   const _Punct&      __punct      = use_facet<_Punct>(__loc) ;
 | 
| williamr@2 |    501 |   const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
 | 
| williamr@2 |    502 | 
 | 
| williamr@2 |    503 |   // some special characters
 | 
| williamr@2 |    504 | 
 | 
| williamr@2 |    505 |   char_type __minus = __c_type.widen('-');
 | 
| williamr@2 |    506 |   char_type __plus  = __c_type.widen('+');
 | 
| williamr@2 |    507 |   char_type __space = __c_type.widen(' ');
 | 
| williamr@2 |    508 |   char_type __zero  = __c_type.widen('0');
 | 
| williamr@2 |    509 |   char_type __point = __intl ? __c_type.widen(__punct_intl.decimal_point())
 | 
| williamr@2 |    510 | 			     : __c_type.widen(__punct.decimal_point());
 | 
| williamr@2 |    511 | 
 | 
| williamr@2 |    512 |   char_type __sep = __intl ? __punct_intl.thousands_sep()
 | 
| williamr@2 |    513 | 			   : __punct     .thousands_sep();
 | 
| williamr@2 |    514 | 
 | 
| williamr@2 |    515 |   string __grouping = __intl ? __punct_intl.grouping()
 | 
| williamr@2 |    516 | 		             : __punct     .grouping();
 | 
| williamr@2 |    517 | 				
 | 
| williamr@2 |    518 |   int __frac_digits      = __intl ? __punct_intl.frac_digits() 
 | 
| williamr@2 |    519 |                                   : __punct.frac_digits();
 | 
| williamr@2 |    520 | 
 | 
| williamr@2 |    521 |   string_type __curr_sym = __intl ? __punct_intl.curr_symbol() 
 | 
| williamr@2 |    522 |                                   : __punct.curr_symbol();
 | 
| williamr@2 |    523 | 
 | 
| williamr@2 |    524 |     // if there are no digits we are going to return __s.  If there
 | 
| williamr@2 |    525 |     // are digits, but not enough to fill the frac_digits, we are
 | 
| williamr@2 |    526 |     // going to add zeros.  I don't know whether this is right or
 | 
| williamr@2 |    527 |     // not.
 | 
| williamr@2 |    528 | 
 | 
| williamr@2 |    529 |   if (__digits.size() == 0) 
 | 
| williamr@2 |    530 |     return __s;
 | 
| williamr@2 |    531 | 
 | 
| williamr@2 |    532 |   typename string_type::const_iterator __digits_first = __digits.begin();
 | 
| williamr@2 |    533 |   typename string_type::const_iterator __digits_last  = __digits.end();
 | 
| williamr@2 |    534 | 
 | 
| williamr@2 |    535 |   bool __is_negative = *__digits_first == __minus;
 | 
| williamr@2 |    536 |   if (__is_negative)
 | 
| williamr@2 |    537 |     ++__digits_first;
 | 
| williamr@2 |    538 | 
 | 
| williamr@2 |    539 |   string_type __sign = __intl ?
 | 
| williamr@2 |    540 | 			 __is_negative ? __punct_intl.negative_sign()
 | 
| williamr@2 |    541 | 				       : __punct_intl.positive_sign()
 | 
| williamr@2 |    542 | 			      :
 | 
| williamr@2 |    543 | 			 __is_negative ? __punct.negative_sign()
 | 
| williamr@2 |    544 | 				       : __punct.positive_sign();
 | 
| williamr@2 |    545 |   typename string_type::const_iterator __cp = __digits_first;
 | 
| williamr@2 |    546 |   while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
 | 
| williamr@2 |    547 |     ++__cp;
 | 
| williamr@2 |    548 |   if (__cp == __digits_first)
 | 
| williamr@2 |    549 |     return __s;
 | 
| williamr@2 |    550 |   __digits_last = __cp;
 | 
| williamr@2 |    551 | 
 | 
| williamr@2 |    552 |   // If grouping is required, we make a copy of __digits and
 | 
| williamr@2 |    553 |   // insert the grouping.
 | 
| williamr@2 |    554 | 
 | 
| williamr@2 |    555 |   // To handle the fractional digits, we augment the first group
 | 
| williamr@2 |    556 |   // by frac_digits.  If there is only one group, we need first
 | 
| williamr@2 |    557 |   // to duplicate it.
 | 
| williamr@2 |    558 | 
 | 
| williamr@2 |    559 |   string_type __new_digits(__digits_first, __digits_last);
 | 
| williamr@2 |    560 | #ifdef	__SYMBIAN32__
 | 
| williamr@2 |    561 | 	int __numberofseperators = 0;
 | 
| williamr@2 |    562 | 	if (__grouping.size()>0)
 | 
| williamr@2 |    563 | 	__numberofseperators = (__new_digits.size()/__grouping[0])+1;
 | 
| williamr@2 |    564 | 	else
 | 
| williamr@2 |    565 | 		__numberofseperators = 0;
 | 
| williamr@2 |    566 |   __new_digits.resize(__new_digits.size()+__numberofseperators);
 | 
| williamr@2 |    567 | #endif  
 | 
| williamr@2 |    568 |   if (__grouping.size() != 0) {
 | 
| williamr@2 |    569 |     if (__grouping.size() == 1)
 | 
| williamr@2 |    570 |       __grouping.push_back(__grouping[0]);
 | 
| williamr@2 |    571 |     __grouping[0] += __frac_digits;
 | 
| williamr@2 |    572 |     _CharT* __data_ptr = __CONST_CAST(_CharT*,__new_digits.data());
 | 
| williamr@2 |    573 |     _CharT* __data_end = __data_ptr + __new_digits.size();
 | 
| williamr@2 |    574 |     
 | 
| williamr@2 |    575 |     
 | 
| williamr@2 |    576 |     ptrdiff_t __value_length = __insert_grouping(__data_ptr,
 | 
| williamr@2 |    577 | #ifdef	__SYMBIAN32__	    
 | 
| williamr@2 |    578 | 	  				         __data_end-__numberofseperators,
 | 
| williamr@2 |    579 | #else
 | 
| williamr@2 |    580 | 							__data_end,
 | 
| williamr@2 |    581 | #endif	  				         
 | 
| williamr@2 |    582 | 					         __grouping,
 | 
| williamr@2 |    583 | 					         __sep,
 | 
| williamr@2 |    584 | 					         __plus, __minus, 0);
 | 
| williamr@2 |    585 |     __digits_first = __new_digits.begin();
 | 
| williamr@2 |    586 |     __digits_last  = __digits_first + __value_length;
 | 
| williamr@2 |    587 |   }
 | 
| williamr@2 |    588 | 
 | 
| williamr@2 |    589 |   // Determine the amount of padding required, if any.  
 | 
| williamr@2 |    590 | #ifdef	__SYMBIAN32__
 | 
| williamr@2 |    591 | 	  int __width        = __str.width(); //width returns signed value.
 | 
| williamr@2 |    592 | #else    
 | 
| williamr@2 |    593 |   size_t __width        = __str.width();
 | 
| williamr@2 |    594 | #endif
 | 
| williamr@2 |    595 | 
 | 
| williamr@2 |    596 | #if defined(_STLP_DEBUG) && (defined(__HP_aCC) || (__HP_aCC <= 1))
 | 
| williamr@2 |    597 |   size_t __value_length = operator -(__digits_last, __digits_first);
 | 
| williamr@2 |    598 | #else
 | 
| williamr@2 |    599 |   size_t __value_length = __digits_last - __digits_first;
 | 
| williamr@2 |    600 | #endif
 | 
| williamr@2 |    601 | 
 | 
| williamr@2 |    602 |   size_t __length       = __value_length;
 | 
| williamr@2 |    603 |       
 | 
| williamr@2 |    604 |   __length += __sign.size();
 | 
| williamr@2 |    605 |   if (__frac_digits != 0)
 | 
| williamr@2 |    606 |     ++__length;
 | 
| williamr@2 |    607 | 
 | 
| williamr@2 |    608 |   bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
 | 
| williamr@2 |    609 |   if (__generate_curr)
 | 
| williamr@2 |    610 |     __length += __curr_sym.size();
 | 
| williamr@2 |    611 |   money_base::pattern __format =
 | 
| williamr@2 |    612 |     __intl ? (__is_negative ? __punct_intl.neg_format() 
 | 
| williamr@2 |    613 |                             : __punct_intl.pos_format())
 | 
| williamr@2 |    614 |            : (__is_negative ? __punct.neg_format() 
 | 
| williamr@2 |    615 |                             : __punct.pos_format());
 | 
| williamr@2 |    616 |   {
 | 
| williamr@2 |    617 |     for (int __i = 0; __i < 4; ++__i)
 | 
| williamr@2 |    618 |       if (__format.field[__i] == (char) money_base::space)
 | 
| williamr@2 |    619 |         ++__length;
 | 
| williamr@2 |    620 |   }
 | 
| williamr@2 |    621 | 
 | 
| williamr@2 |    622 |   size_t __fill_amt = (int)__length < __width ? __width - __length : 0;
 | 
| williamr@2 |    623 | 
 | 
| williamr@2 |    624 |   ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
 | 
| williamr@2 |    625 | 
 | 
| williamr@2 |    626 |   if (__fill_amt != 0 &&
 | 
| williamr@2 |    627 |       !(__fill_pos & (ios_base::left | ios_base::internal)))
 | 
| williamr@2 |    628 |     __s = fill_n(__s, __fill_amt, __fill);
 | 
| williamr@2 |    629 |     
 | 
| williamr@2 |    630 |   for (int __i = 0; __i < 4; ++__i) {
 | 
| williamr@2 |    631 |     char __ffield = __format.field[__i];
 | 
| williamr@2 |    632 |     if (__ffield == money_base::none) {
 | 
| williamr@2 |    633 |       if (__fill_amt != 0 && __fill_pos == ios_base::internal)
 | 
| williamr@2 |    634 |         __s = fill_n(__s, __fill_amt, __fill);
 | 
| williamr@2 |    635 |     }
 | 
| williamr@2 |    636 |     else if (__ffield == money_base::space) {
 | 
| williamr@2 |    637 | #ifdef __SYMBIAN32__
 | 
| williamr@2 |    638 | 	if(__fill != __space)
 | 
| williamr@2 |    639 | 		*__s++ = __fill;
 | 
| williamr@2 |    640 | 	else
 | 
| williamr@2 |    641 | #endif		
 | 
| williamr@2 |    642 |       *__s++ = __space;
 | 
| williamr@2 |    643 |       if (__fill_amt != 0 && __fill_pos == ios_base::internal)
 | 
| williamr@2 |    644 |         __s = fill_n(__s, __fill_amt, __fill);
 | 
| williamr@2 |    645 |     }
 | 
| williamr@2 |    646 |     else if (__ffield == money_base::symbol) {
 | 
| williamr@2 |    647 |       if (__generate_curr)
 | 
| williamr@2 |    648 |         __s = copy(__curr_sym.begin(), __curr_sym.end(), __s);
 | 
| williamr@2 |    649 |     }
 | 
| williamr@2 |    650 |     else if (__ffield == money_base::sign) {
 | 
| williamr@2 |    651 |       if (__sign.size() != 0)
 | 
| williamr@2 |    652 |         *__s++ = __sign[0];
 | 
| williamr@2 |    653 |     }
 | 
| williamr@2 |    654 |     else if (__ffield == money_base::value) {
 | 
| williamr@2 |    655 |       if (__frac_digits == 0)
 | 
| williamr@2 |    656 |         __s = copy(__digits_first, __digits_last, __s);
 | 
| williamr@2 |    657 |       else {
 | 
| williamr@2 |    658 |         if ((int)__value_length <= __frac_digits) {
 | 
| williamr@2 |    659 |           *__s++ = __point;
 | 
| williamr@2 |    660 |           __s = copy(__digits_first, __digits_last, __s);
 | 
| williamr@2 |    661 |           __s =  fill_n(__s, __frac_digits - __value_length, __zero);
 | 
| williamr@2 |    662 |         }
 | 
| williamr@2 |    663 |         else {
 | 
| williamr@2 |    664 | #ifdef	__SYMBIAN32__
 | 
| williamr@2 |    665 | 	  if (__frac_digits>0)
 | 
| williamr@2 |    666 | 	  	{
 | 
| williamr@2 |    667 | #endif	  	
 | 
| williamr@2 |    668 |           __s = copy(__digits_first, __digits_last - __frac_digits, __s);
 | 
| williamr@2 |    669 |           if (__frac_digits != 0) {
 | 
| williamr@2 |    670 |             *__s++ = __point;
 | 
| williamr@2 |    671 |             __s = copy(__digits_last - __frac_digits, __digits_last, __s);
 | 
| williamr@2 |    672 | #ifdef	__SYMBIAN32__
 | 
| williamr@2 |    673 | 	          }
 | 
| williamr@2 |    674 | #endif			  
 | 
| williamr@2 |    675 |           }
 | 
| williamr@2 |    676 |         }
 | 
| williamr@2 |    677 |       }
 | 
| williamr@2 |    678 |     }
 | 
| williamr@2 |    679 |   } // Close for loop
 | 
| williamr@2 |    680 | 
 | 
| williamr@2 |    681 |   // Ouput rest of sign if necessary.
 | 
| williamr@2 |    682 | 
 | 
| williamr@2 |    683 |   if (__sign.size() > 1)
 | 
| williamr@2 |    684 |     __s = copy(__sign.begin() + 1, __sign.end(), __s);
 | 
| williamr@2 |    685 |   if (!(__fill_pos & (ios_base::right | ios_base::internal)))
 | 
| williamr@2 |    686 |     __s = fill_n(__s, __fill_amt, __fill);
 | 
| williamr@2 |    687 |   
 | 
| williamr@2 |    688 | #ifdef __SYMBIAN32__
 | 
| williamr@2 |    689 | 	__str.width(0);
 | 
| williamr@2 |    690 | #endif
 | 
| williamr@2 |    691 |   return __s;
 | 
| williamr@2 |    692 | }
 | 
| williamr@2 |    693 | 
 | 
| williamr@2 |    694 | #ifdef	__SYMBIAN32__
 | 
| williamr@2 |    695 | /*
 | 
| williamr@2 |    696 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    697 | moneypunct<_CharT, _International>::moneypunct(size_t __refs = 0):_BaseFacet(__refs)
 | 
| williamr@2 |    698 | { 
 | 
| williamr@2 |    699 | 	
 | 
| williamr@2 |    700 | 	
 | 
| williamr@2 |    701 | }*/
 | 
| williamr@2 |    702 | 
 | 
| williamr@2 |    703 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    704 | _CharT        moneypunct<_CharT,_International>::do_decimal_point() const
 | 
| williamr@2 |    705 | {
 | 
| williamr@2 |    706 | 	return _CharT('.');
 | 
| williamr@2 |    707 | }
 | 
| williamr@2 |    708 | 
 | 
| williamr@2 |    709 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    710 | _CharT        moneypunct<_CharT,_International>::do_thousands_sep() const
 | 
| williamr@2 |    711 | {
 | 
| williamr@2 |    712 | 	return _CharT(',');
 | 
| williamr@2 |    713 | }
 | 
| williamr@2 |    714 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    715 | basic_string<_CharT>      moneypunct<_CharT,_International>::do_curr_symbol()   const
 | 
| williamr@2 |    716 | {
 | 
| williamr@2 |    717 | 	return _M_currSym;
 | 
| williamr@2 |    718 | }
 | 
| williamr@2 |    719 | 
 | 
| williamr@2 |    720 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    721 | basic_string<_CharT>      moneypunct<_CharT,_International>::do_positive_sign()   const
 | 
| williamr@2 |    722 | {
 | 
| williamr@2 |    723 | 	return _M_psign;
 | 
| williamr@2 |    724 | }
 | 
| williamr@2 |    725 | 
 | 
| williamr@2 |    726 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    727 | basic_string<_CharT>      moneypunct<_CharT,_International>::do_negative_sign()   const
 | 
| williamr@2 |    728 | {
 | 
| williamr@2 |    729 | 	return _M_nsign;
 | 
| williamr@2 |    730 | }
 | 
| williamr@2 |    731 | 
 | 
| williamr@2 |    732 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    733 | string      moneypunct<_CharT,_International>::do_grouping()   const
 | 
| williamr@2 |    734 | {
 | 
| williamr@2 |    735 | 	return _M_group;
 | 
| williamr@2 |    736 | }
 | 
| williamr@2 |    737 | 
 | 
| williamr@2 |    738 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    739 | money_base::pattern        moneypunct<_CharT,_International>::do_pos_format()   const
 | 
| williamr@2 |    740 | {
 | 
| williamr@2 |    741 | 	return _M_pos_format;
 | 
| williamr@2 |    742 | }
 | 
| williamr@2 |    743 | 
 | 
| williamr@2 |    744 | template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
 | 
| williamr@2 |    745 | money_base::pattern        moneypunct<_CharT,_International>::do_neg_format()   const
 | 
| williamr@2 |    746 | {
 | 
| williamr@2 |    747 | 	return _M_neg_format;
 | 
| williamr@2 |    748 | }
 | 
| williamr@2 |    749 | 
 | 
| williamr@2 |    750 | template<class _CharT, bool _International>
 | 
| williamr@2 |    751 | int       moneypunct<_CharT,_International>::do_frac_digits()   const
 | 
| williamr@2 |    752 | {
 | 
| williamr@2 |    753 | 	return 0;
 | 
| williamr@2 |    754 | }
 | 
| williamr@2 |    755 | 
 | 
| williamr@2 |    756 | 
 | 
| williamr@2 |    757 | //monetary_byname<any>
 | 
| williamr@2 |    758 | 
 | 
| williamr@2 |    759 | template<class _CharT, bool _International>
 | 
| williamr@2 |    760 | _CharT moneypunct_byname<_CharT, _International>::do_decimal_point() const 
 | 
| williamr@2 |    761 |   {return _Locale_mon_decimal_pointE(_M_monetary);}
 | 
| williamr@2 |    762 | 
 | 
| williamr@2 |    763 | template<class _CharT, bool _International>
 | 
| williamr@2 |    764 | _CharT moneypunct_byname<_CharT, _International>::do_thousands_sep() const
 | 
| williamr@2 |    765 |   {return _Locale_mon_thousands_sepE(_M_monetary);}
 | 
| williamr@2 |    766 | 
 | 
| williamr@2 |    767 | template<class _CharT, bool _International>
 | 
| williamr@2 |    768 | string  moneypunct_byname<_CharT, _International>::do_grouping() const
 | 
| williamr@2 |    769 |   {return moneypunct<_CharT,_International>::_M_group;}
 | 
| williamr@2 |    770 | 
 | 
| williamr@2 |    771 | template<class _CharT, bool _International>
 | 
| williamr@2 |    772 | basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_curr_symbol() const
 | 
| williamr@2 |    773 |   {return moneypunct<_CharT,_International>::_M_currSym;}
 | 
| williamr@2 |    774 | 
 | 
| williamr@2 |    775 | template<class _CharT, bool _International>
 | 
| williamr@2 |    776 | basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_positive_sign() const
 | 
| williamr@2 |    777 |   {return moneypunct<_CharT,_International>::_M_psign;}
 | 
| williamr@2 |    778 | 
 | 
| williamr@2 |    779 | template<class _CharT, bool _International>
 | 
| williamr@2 |    780 | basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_negative_sign() const
 | 
| williamr@2 |    781 |   {return moneypunct<_CharT,_International>::_M_nsign;}
 | 
| williamr@2 |    782 | 
 | 
| williamr@2 |    783 | template<class _CharT, bool _International>
 | 
| williamr@2 |    784 | int moneypunct_byname<_CharT, _International>::do_frac_digits() const 
 | 
| williamr@2 |    785 |   {return _Locale_int_frac_digitsE(_M_monetary);}
 | 
| williamr@2 |    786 | 
 | 
| williamr@2 |    787 | template<class _CharT, bool _International>
 | 
| williamr@2 |    788 | void moneypunct_byname<_CharT, _International>::Convert_string2_string_chart(basic_string<_CharT> &dst, string src)
 | 
| williamr@2 |    789 | 	{
 | 
| williamr@2 |    790 | 		int length = src.length();
 | 
| williamr@2 |    791 | 		const char* str = src.c_str();
 | 
| williamr@2 |    792 | 		for(int i = 0; i<length;i++)
 | 
| williamr@2 |    793 | 		{
 | 
| williamr@2 |    794 | 			dst.append(1, (_CharT)*str++);
 | 
| williamr@2 |    795 | 			
 | 
| williamr@2 |    796 | 		}
 | 
| williamr@2 |    797 | 			
 | 
| williamr@2 |    798 | 	}
 | 
| williamr@2 |    799 | 
 | 
| williamr@2 |    800 | template<class _CharT, bool _International>
 | 
| williamr@2 |    801 | moneypunct_byname<_CharT, _International>::moneypunct_byname(const char * name,
 | 
| williamr@2 |    802 | 						  size_t refs):
 | 
| williamr@2 |    803 |   moneypunct<_CharT, _International>(refs),
 | 
| williamr@2 |    804 |   _M_monetary(__acquire_monetaryE(name))
 | 
| williamr@2 |    805 | {
 | 
| williamr@2 |    806 |   if (!_M_monetary)
 | 
| williamr@2 |    807 |     locale::_M_throw_runtime_error();
 | 
| williamr@2 |    808 |   
 | 
| williamr@2 |    809 |   		moneypunct<_CharT,_International>::_M_group = _Locale_mon_groupingE(_M_monetary);
 | 
| williamr@2 |    810 | 		Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_psign, _Locale_positive_signE(_M_monetary));
 | 
| williamr@2 |    811 | 		Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_nsign, _Locale_negative_signE(_M_monetary));
 | 
| williamr@2 |    812 | 		Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_currSym, _Locale_int_curr_symbolE(_M_monetary));
 | 
| williamr@2 |    813 | }
 | 
| williamr@2 |    814 | 
 | 
| williamr@2 |    815 | template<class _CharT, bool _International>
 | 
| williamr@2 |    816 | moneypunct_byname<_CharT, _International>::~moneypunct_byname()
 | 
| williamr@2 |    817 | {
 | 
| williamr@2 |    818 |   __release_monetaryE(_M_monetary);
 | 
| williamr@2 |    819 | }
 | 
| williamr@2 |    820 | 
 | 
| williamr@2 |    821 | 
 | 
| williamr@2 |    822 | #endif
 | 
| williamr@2 |    823 | _STLP_END_NAMESPACE
 | 
| williamr@2 |    824 | 
 | 
| williamr@2 |    825 | # endif /* EXPOSE */
 | 
| williamr@2 |    826 | 
 | 
| williamr@2 |    827 | #endif /* _STLP_MONETARY_C */
 |