epoc32/include/stdapis/stlport/stl/_monetary.c
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_monetary.c	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,827 +0,0 @@
     1.4 -/*
     1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 - *
     1.7 - * Copyright (c) 1999
     1.8 - * Silicon Graphics Computer Systems, Inc.
     1.9 - *
    1.10 - * Copyright (c) 1999 
    1.11 - * Boris Fomitchev
    1.12 - *
    1.13 - * This material is provided "as is", with absolutely no warranty expressed
    1.14 - * or implied. Any use is at your own risk.
    1.15 - *
    1.16 - * Permission to use or copy this software for any purpose is hereby granted 
    1.17 - * without fee, provided the above notices are retained on all copies.
    1.18 - * Permission to modify the code and to distribute modified code is granted,
    1.19 - * provided the above notices are retained, and a notice that the code was
    1.20 - * modified is included with the above copyright notice.
    1.21 - *
    1.22 - */ 
    1.23 -#ifndef _STLP_MONETARY_C
    1.24 -#define _STLP_MONETARY_C
    1.25 -
    1.26 -# ifndef _STLP_INTERNAL_MONETARY_H
    1.27 -#  include <stl/_monetary.h>
    1.28 -# endif
    1.29 -
    1.30 -# if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION)
    1.31 -
    1.32 -#ifndef _STLP_INTERNAL_IOS_H
    1.33 -# include <stl/_ios.h>
    1.34 -#endif
    1.35 -
    1.36 -#ifndef _STLP_INTERNAL_NUM_PUT_H
    1.37 -# include <stl/_num_put.h>
    1.38 -#endif
    1.39 -
    1.40 -#ifndef _STLP_INTERNAL_NUM_GET_H
    1.41 -# include <stl/_num_get.h>
    1.42 -#endif
    1.43 -
    1.44 -_STLP_BEGIN_NAMESPACE
    1.45 -
    1.46 -# if ( _STLP_STATIC_TEMPLATE_DATA > 0 )
    1.47 -# if !defined(__LIBSTD_CPP_SYMBIAN32_WSD__) && !defined(_STLP_LIBSTD_CPP_NO_STATIC_VAR_)
    1.48 -template <class _CharT, class _InputIterator>
    1.49 -locale::id money_get<_CharT, _InputIterator>::id;
    1.50 -
    1.51 -template <class _CharT, class _OutputIterator>
    1.52 -locale::id money_put<_CharT, _OutputIterator>::id;
    1.53 -#endif
    1.54 -# else /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
    1.55 -
    1.56 -typedef money_get<char, const char*> money_get_char;
    1.57 -typedef money_put<char, char*> money_put_char;
    1.58 -typedef money_get<char, istreambuf_iterator<char, char_traits<char> > > money_get_char_2;
    1.59 -typedef money_put<char, ostreambuf_iterator<char, char_traits<char> > > money_put_char_2;
    1.60 -
    1.61 -#ifndef __SYMBIAN32__
    1.62 -__DECLARE_INSTANCE(locale::id, money_get_char::id, );
    1.63 -__DECLARE_INSTANCE(locale::id, money_put_char::id, );
    1.64 -__DECLARE_INSTANCE(locale::id, money_get_char_2::id, );
    1.65 -__DECLARE_INSTANCE(locale::id, money_put_char_2::id, );
    1.66 -#endif
    1.67 -
    1.68 -# ifndef _STLP_NO_WCHAR_T
    1.69 -
    1.70 -typedef money_get<wchar_t, const wchar_t*> money_get_wchar_t;
    1.71 -typedef money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_get_wchar_t_2;
    1.72 -typedef money_put<wchar_t, wchar_t*> money_put_wchar_t;
    1.73 -typedef money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > > money_put_wchar_t_2;
    1.74 -
    1.75 -#ifndef __SYMBIAN32__
    1.76 -__DECLARE_INSTANCE(locale::id, money_get_wchar_t::id, );
    1.77 -__DECLARE_INSTANCE(locale::id, money_put_wchar_t::id, );
    1.78 -__DECLARE_INSTANCE(locale::id, money_get_wchar_t_2::id, );
    1.79 -__DECLARE_INSTANCE(locale::id, money_put_wchar_t_2::id, );
    1.80 -#endif
    1.81 -
    1.82 -# endif
    1.83 -# endif /* ( _STLP_STATIC_TEMPLATE_DATA > 0 ) */
    1.84 -
    1.85 -// money_get facets
    1.86 -
    1.87 -
    1.88 -// helper functions for do_get
    1.89 -template <class _InIt1, class _InIt2>
    1.90 -pair<_InIt1, bool> __get_string(_InIt1 __first,     _InIt1 __last,
    1.91 -                               _InIt2 __str_first, _InIt2 __str_last) {
    1.92 -  pair<_InIt1, _InIt2> __pr = mismatch(__first, __last, __str_first);
    1.93 -  return make_pair(__pr.first, __pr.second == __str_last);
    1.94 -}
    1.95 -
    1.96 -template <class _InIt, class _OuIt, class _CharT>
    1.97 -bool
    1.98 -__get_monetary_value(_InIt& __first, _InIt __last, _OuIt __stl_out,
    1.99 -                     const ctype<_CharT>& _c_type,
   1.100 -                     _CharT   __point,
   1.101 -                     int      __frac_digits,
   1.102 -                     _CharT __sep,
   1.103 -                     const string& __grouping,
   1.104 -                     bool&         __syntax_ok)
   1.105 -{
   1.106 -
   1.107 -	size_t __digits = 0;
   1.108 -
   1.109 -  if (__first == __last || !_c_type.is(ctype_base::digit, *__first))
   1.110 -    return false;
   1.111 -
   1.112 -  char __group_sizes[128];
   1.113 -  char* __group_sizes_end = __grouping.size() == 0 ? 0 : __group_sizes;
   1.114 -  char   __current_group_size = 0;
   1.115 -
   1.116 -  while (__first != __last) {
   1.117 -    if (_c_type.is(ctype_base::digit, *__first)) {
   1.118 -      ++__current_group_size;
   1.119 -      *__stl_out++ = *__first++;
   1.120 -	  __digits++;
   1.121 -    }
   1.122 -#ifdef __SYMBIAN32__
   1.123 -else if ( (__current_group_size)&&(__group_sizes_end) ){
   1.124 -#else
   1.125 -    else if (__group_sizes_end) {
   1.126 -#endif		
   1.127 -      if (*__first == __sep) {
   1.128 -	*__group_sizes_end++ = __current_group_size; 
   1.129 -	__current_group_size = 0;
   1.130 -	++__first;
   1.131 -      }
   1.132 -      else break;
   1.133 -    }
   1.134 -    else
   1.135 -      break;
   1.136 -  }
   1.137 -
   1.138 -  if (__grouping.size() == 0)
   1.139 -    __syntax_ok = true;
   1.140 -  else {
   1.141 -    if (__group_sizes_end != __group_sizes)
   1.142 -     *__group_sizes_end++ = __current_group_size; 
   1.143 -    
   1.144 -    __syntax_ok = __valid_grouping(__group_sizes, __group_sizes_end,
   1.145 -                                   __grouping.data(), __grouping.data()+ __grouping.size());  
   1.146 -    
   1.147 -    if (__first == __last || *__first != __point) {
   1.148 -      for (int __digits = 0; __digits != __frac_digits; ++__digits)
   1.149 -        *__stl_out++ = _CharT('0');
   1.150 -      return true; // OK not to have decimal point
   1.151 -    }
   1.152 -  }
   1.153 -//bug fix testcase_22427 - commented
   1.154 -//  ++__first; 
   1.155 -
   1.156 -
   1.157 -  //bug fix testcase_22427 - added if
   1.158 -
   1.159 -  if (__first != __last && *__first == __point && __frac_digits)
   1.160 -  {  	
   1.161 -	//bug fix testcase_22427 - commented
   1.162 -	++__first; 
   1.163 -	  while (__first != __last && _c_type.is(ctype_base::digit, *__first)) {
   1.164 -	      *__stl_out++ = *__first++;
   1.165 -	     ++__digits;
   1.166 -	  }
   1.167 -  }
   1.168 -
   1.169 -  //bug fix testcase_22427 - condition changed
   1.170 -//  __syntax_ok = __syntax_ok && (__digits == __frac_digits);
   1.171 -  
   1.172 - if(__digits == 0)
   1.173 -  	__syntax_ok = false;
   1.174 -
   1.175 -  return true;
   1.176 -}
   1.177 -
   1.178 -# ifndef _STLP_NO_LONG_DOUBLE
   1.179 -
   1.180 -//===== methods ======
   1.181 -template <class _CharT, class _InputIter>
   1.182 -_InputIter 
   1.183 -money_get<_CharT, _InputIter>::do_get(_InputIter __s, _InputIter  __end, bool  __intl,
   1.184 -				      ios_base&  __str, ios_base::iostate& __err,
   1.185 -				      long double& __units) const {
   1.186 -  string_type __buf;
   1.187 -  __s = do_get(__s, __end, __intl, __str, __err, __buf);
   1.188 -
   1.189 -  if (__err == ios_base::goodbit || __err == ios_base::eofbit) {
   1.190 -    __buf.push_back(0);
   1.191 -    typename string_type::iterator __b = __buf.begin(), __e = __buf.end();
   1.192 -    // Can't use atold, since it might be wchar_t. Don't get confused by name below :
   1.193 -    // it's perfectly capable of reading long double.
   1.194 -    __get_decimal_integer(__b, __e, __units);
   1.195 -  }
   1.196 -  if (__s == __end)
   1.197 -    __err |= ios_base::eofbit;
   1.198 -  return __s;
   1.199 -}
   1.200 -# endif
   1.201 -
   1.202 -template <class _CharT, class _InputIter>
   1.203 -_InputIter 
   1.204 -money_get<_CharT, _InputIter>::do_get(iter_type __s, 
   1.205 -				      iter_type  __end, bool  __intl,
   1.206 -				      ios_base&  __str, ios_base::iostate&  __err,
   1.207 -				      string_type& __digits) const {
   1.208 -	__err = 0;
   1.209 -  if (__s == __end) {
   1.210 -    __err |= ios_base::eofbit;
   1.211 -    return __s;
   1.212 -  }
   1.213 -
   1.214 -  typedef moneypunct<_CharT, false> _Punct;
   1.215 -  typedef moneypunct<_CharT, true>  _Punct_intl;
   1.216 -  typedef ctype<_CharT>             _Ctype;
   1.217 -#ifdef __SYMBIAN32__			
   1.218 -	bool		__isSignSympresent = false;
   1.219 -#endif			
   1.220 -
   1.221 - bool	__testvalid = true;
   1.222 -  locale __loc = __str.getloc();
   1.223 -  const _Punct&      __punct      = use_facet<_Punct>(__loc) ;
   1.224 -  const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
   1.225 -  const _Ctype&      __c_type      = use_facet<_Ctype>(__loc) ;
   1.226 -                   
   1.227 -  money_base::pattern __format = __intl ? __punct_intl.neg_format()
   1.228 -                                        : __punct.neg_format();
   1.229 -  string_type __ns = __intl ? __punct_intl.negative_sign()
   1.230 -                            : __punct.negative_sign();
   1.231 -  string_type __ps = __intl ? __punct_intl.positive_sign()
   1.232 -                            : __punct.positive_sign();
   1.233 -  string_type __sign  = __ps;
   1.234 -  int __i;
   1.235 -  bool __is_positive = true;
   1.236 -  bool __symbol_required = (__str.flags() & ios_base::showbase) !=0;
   1.237 -  string_type __buf;
   1.238 -  back_insert_iterator<string_type> __stl_out(__buf);
   1.239 -//  pair<iter_type, bool> __result;
   1.240 -
   1.241 -  for (__i = 0; __i < 4; ++__i) {
   1.242 -    switch (__format.field[__i]) {
   1.243 -    case (char) money_base::none:
   1.244 -#ifndef	__SYMBIAN32__
   1.245 -	  case (char) money_base::space:
   1.246 -#endif	  	
   1.247 -
   1.248 -      if (__i == 3) {
   1.249 -        //if (__c_type.is(ctype_base::space, *__s)) { //gnu buf fix, 22/12/06
   1.250 -        if((__s != __end) && (!__c_type.is(ctype_base::space, *__s)) && (__ps.size()<=1) && (__ns.size()<=1) ){
   1.251 -          __err = ios_base::failbit;
   1.252 -          return __s;
   1.253 -        }
   1.254 -       // break; //gnu bug fix 2/1/07
   1.255 -      }
   1.256 -      while (__s != __end && __c_type.is(ctype_base::space, *__s))
   1.257 -        ++__s;
   1.258 -      break;
   1.259 -#ifdef	__SYMBIAN32__	  
   1.260 -    case (char) money_base::space:
   1.261 -      if (!__c_type.is(ctype_base::space, *__s)) {
   1.262 -#ifdef __SYMBIAN32__      
   1.263 -      	if(!__isSignSympresent) //if no sign symbol present, space is not mandatory.
   1.264 -      		break;
   1.265 -#endif      	
   1.266 -        __err = ios_base::failbit;
   1.267 -        return __s;
   1.268 -      }
   1.269 -      ++__s;
   1.270 -      while (__s != __end && __c_type.is(ctype_base::space, *__s))
   1.271 -        ++__s;
   1.272 -      break;
   1.273 -#endif	  
   1.274 -    case money_base::symbol: {
   1.275 -      string_type __curs = __intl ? __punct_intl.curr_symbol()
   1.276 -                                : __punct.curr_symbol();
   1.277 -      pair<iter_type, bool>
   1.278 -      __result  = __get_string(__s, __end, __curs.begin(), __curs.end());
   1.279 -      if (!__result.second && __symbol_required)
   1.280 -        __err = ios_base::failbit;
   1.281 -      __s = __result.first;
   1.282 -      break;
   1.283 -    }
   1.284 -    case money_base::sign: {
   1.285 -      if (__s == __end) {
   1.286 -        if (__ps.size() == 0)
   1.287 -          break;
   1.288 -        if (__ns.size() == 0) {
   1.289 -          __is_positive = false;
   1.290 -	__sign  = __ns;
   1.291 -          break;
   1.292 -        }
   1.293 -        __err = ios_base::failbit;
   1.294 -        return __s;
   1.295 -      }
   1.296 -      else {
   1.297 -        if (__ps.size() == 0) {
   1.298 -          if (__ns.size() == 0)
   1.299 -            break;
   1.300 -          if (*__s == __ns[0]) {
   1.301 -            ++__s;
   1.302 -            __is_positive = false;
   1.303 -			__sign  = __ns;
   1.304 -#ifdef __SYMBIAN32__			
   1.305 -			__isSignSympresent = true;
   1.306 -#endif			
   1.307 -
   1.308 -            break;
   1.309 -          }
   1.310 -        //  __err = ios_base::failbit; //if ps !=0 and ns!=0, and no negative sign mean it is positive, not fail.
   1.311 -	  //          return __s;
   1.312 -	  break;
   1.313 -        } 
   1.314 -        else {
   1.315 -          if (*__s == __ps[0]) {
   1.316 -            ++__s;
   1.317 -#ifdef __SYMBIAN32__			
   1.318 -			__isSignSympresent = true;
   1.319 -#endif			
   1.320 -
   1.321 -            break;
   1.322 -          }
   1.323 -#ifdef	__SYMBIAN32__
   1.324 -	    if (__ns.size() == 0) //here positive have symbol,negative have no symbol
   1.325 -	    {
   1.326 -	    	__is_positive = false; // in this case if symbol not present means it is negative
   1.327 -	    	__sign = __ns;
   1.328 -	    	break;
   1.329 -	    }
   1.330 -            
   1.331 -#else          
   1.332 -          if (__ns.size() == 0)
   1.333 -            break;
   1.334 -#endif          
   1.335 -          if (*__s == __ns[0]) {
   1.336 -            ++__s;
   1.337 -            __is_positive = false;
   1.338 -			__sign  = __ns;
   1.339 -#ifdef __SYMBIAN32__			
   1.340 -			__isSignSympresent = true;
   1.341 -#endif			
   1.342 -            break;
   1.343 -          }
   1.344 -          __err = ios_base::failbit;
   1.345 -	  //          return __s;
   1.346 -        }
   1.347 -      }
   1.348 -      return __s;
   1.349 -      //      break;
   1.350 -    }
   1.351 -    case money_base::value: {
   1.352 -      _CharT __point = __intl ? __punct_intl.decimal_point()
   1.353 -                              : __punct.decimal_point();
   1.354 -      int __frac_digits = __intl ? __punct_intl.frac_digits()
   1.355 -                                 : __punct.frac_digits();
   1.356 -      string __grouping = __intl ? __punct_intl.grouping()
   1.357 -                                 : __punct.grouping();
   1.358 -      bool __syntax_ok = true;
   1.359 -
   1.360 -      bool __result;
   1.361 -
   1.362 -      _CharT __sep = __grouping.size() == 0 ? _CharT() : 
   1.363 -	__intl ? __punct_intl.thousands_sep() : __punct.thousands_sep();
   1.364 -
   1.365 -      __result = __get_monetary_value(__s, __end, __stl_out, __c_type,
   1.366 -                                      __point, __frac_digits,
   1.367 -                                      __sep,
   1.368 -                                      __grouping, __syntax_ok);      
   1.369 -
   1.370 -      if (!__syntax_ok)
   1.371 -        __err |= ios_base::failbit;
   1.372 -      if (!__result) {
   1.373 -        __err = ios_base::failbit;
   1.374 -        return __s;
   1.375 -      }
   1.376 -      break;
   1.377 -      
   1.378 -    }                           // Close money_base::value case
   1.379 -
   1.380 -
   1.381 -    }                           // Close switch statement
   1.382 -  }                             // Close for loop
   1.383 -
   1.384 -#ifndef __SYMBIAN32__ //find the given number pos or neg, required for cases where sign is present at string starting and ending
   1.385 -	do{
   1.386 -	bool type = true;
   1.387 -
   1.388 -	int si = __ps.size();
   1.389 -	for (int i = 1;i<__ps.size();i++)
   1.390 -		{
   1.391 -			if(__s[i-1]!=__ps[i])
   1.392 -			{
   1.393 -				type = false;
   1.394 -				break;
   1.395 -			}
   1.396 -		}
   1.397 -	
   1.398 -	if ((si!=0) && (type ==true))
   1.399 -	{
   1.400 -		__sign = __ps;
   1.401 -            break;
   1.402 -	}  
   1.403 -          if (__ns.size() == 0)
   1.404 -            break;
   1.405 -	type = true;
   1.406 -	for (int i =1;i<__ns.size();i++)
   1.407 -		{
   1.408 -			if(__s[i-1]!=__ns[i])
   1.409 -			{
   1.410 -				type = false;
   1.411 -				break;
   1.412 -			}
   1.413 -		}
   1.414 -          if (type ==true) {
   1.415 -            __is_positive = false;
   1.416 -		__sign = __ns;
   1.417 -            break;
   1.418 -          }
   1.419 -	}while(0);
   1.420 -
   1.421 -#endif
   1.422 -
   1.423 -
   1.424 -#ifdef __SYMBIAN32__
   1.425 -// Need to get the rest of the sign characters, if they exist.
   1.426 -      if (__sign.size() > 1)
   1.427 -        {
   1.428 -          int __len = __sign.size();
   1.429 -          int __i = 1;
   1.430 -	  char_type __c = *__s;
   1.431 -	  char_type __eol = '\0';
   1.432 -          for (; __c != __eol && __i < __len; __i++)
   1.433 -          	{
   1.434 -            	if (__s != __end)
   1.435 -              	__c = *(++__s);
   1.436 -            	
   1.437 -          }
   1.438 -		  //checking sign completely extracted successfully
   1.439 -		 
   1.440 -          if (__i != __len)
   1.441 -            __testvalid = false;
   1.442 -        }
   1.443 -
   1.444 -#endif
   1.445 -
   1.446 -  if (__is_positive) {
   1.447 -    if (__ps.size() > 1) {
   1.448 -#ifndef __SYMBIAN32__		
   1.449 -      pair<_InputIter, bool>
   1.450 -        __result = __get_string(__s, __end, __ps.begin() + 1, __ps.end());
   1.451 -      __s = __result.first;
   1.452 -      if (!__result.second)
   1.453 -	__err |= ios::failbit;
   1.454 -#endif
   1.455 -	if(!__testvalid)
   1.456 -		__err |= ios::failbit;
   1.457 -    }
   1.458 -    if (!(__err & ios_base::failbit))
   1.459 -      __digits = __buf;
   1.460 -  }
   1.461 -  else {
   1.462 -    if (__ns.size() > 1) {
   1.463 -#ifndef __SYMBIAN32__		
   1.464 -      pair<_InputIter, bool>
   1.465 -        __result = __get_string(__s, __end, __ns.begin() + 1, __ns.end());
   1.466 -      __s = __result.first;
   1.467 -      if (!__result.second)
   1.468 -	__err |= ios::failbit;
   1.469 -#endif
   1.470 -	if(!__testvalid)
   1.471 -		__err |= ios::failbit;
   1.472 -    }
   1.473 -    if (!(__err & ios::failbit) && (__ns == __sign)) {
   1.474 -      __buf.insert(__buf.begin(),__c_type.widen('-'));      
   1.475 -    }
   1.476 -#ifdef __SYMBIAN32__	
   1.477 -  if (!(__err & ios_base::failbit))
   1.478 -      __digits = __buf;	
   1.479 -#else  
   1.480 -   __digits = __buf;	
   1.481 -#endif
   1.482 -  }
   1.483 -  if (__s == __end)
   1.484 -    __err |= ios::eofbit;
   1.485 -
   1.486 -  return __s;
   1.487 -}
   1.488 -
   1.489 -// money_put facets
   1.490 -
   1.491 -template <class _CharT, class _OutputIter>
   1.492 -_OutputIter
   1.493 -money_put<_CharT, _OutputIter>
   1.494 - ::do_put(_OutputIter __s, bool __intl, ios_base& __str,
   1.495 -          char_type __fill,
   1.496 -          const string_type& __digits) const { 
   1.497 -  typedef ctype<_CharT>             _Ctype;
   1.498 -  typedef moneypunct<_CharT, false> _Punct;
   1.499 -  typedef moneypunct<_CharT, true>  _Punct_intl;
   1.500 -
   1.501 -  locale __loc = __str.getloc();
   1.502 -  const _Ctype&      __c_type      = use_facet<_Ctype>(__loc) ;
   1.503 -  const _Punct&      __punct      = use_facet<_Punct>(__loc) ;
   1.504 -  const _Punct_intl& __punct_intl = use_facet<_Punct_intl>(__loc) ;
   1.505 -
   1.506 -  // some special characters
   1.507 -
   1.508 -  char_type __minus = __c_type.widen('-');
   1.509 -  char_type __plus  = __c_type.widen('+');
   1.510 -  char_type __space = __c_type.widen(' ');
   1.511 -  char_type __zero  = __c_type.widen('0');
   1.512 -  char_type __point = __intl ? __c_type.widen(__punct_intl.decimal_point())
   1.513 -			     : __c_type.widen(__punct.decimal_point());
   1.514 -
   1.515 -  char_type __sep = __intl ? __punct_intl.thousands_sep()
   1.516 -			   : __punct     .thousands_sep();
   1.517 -
   1.518 -  string __grouping = __intl ? __punct_intl.grouping()
   1.519 -		             : __punct     .grouping();
   1.520 -				
   1.521 -  int __frac_digits      = __intl ? __punct_intl.frac_digits() 
   1.522 -                                  : __punct.frac_digits();
   1.523 -
   1.524 -  string_type __curr_sym = __intl ? __punct_intl.curr_symbol() 
   1.525 -                                  : __punct.curr_symbol();
   1.526 -
   1.527 -    // if there are no digits we are going to return __s.  If there
   1.528 -    // are digits, but not enough to fill the frac_digits, we are
   1.529 -    // going to add zeros.  I don't know whether this is right or
   1.530 -    // not.
   1.531 -
   1.532 -  if (__digits.size() == 0) 
   1.533 -    return __s;
   1.534 -
   1.535 -  typename string_type::const_iterator __digits_first = __digits.begin();
   1.536 -  typename string_type::const_iterator __digits_last  = __digits.end();
   1.537 -
   1.538 -  bool __is_negative = *__digits_first == __minus;
   1.539 -  if (__is_negative)
   1.540 -    ++__digits_first;
   1.541 -
   1.542 -  string_type __sign = __intl ?
   1.543 -			 __is_negative ? __punct_intl.negative_sign()
   1.544 -				       : __punct_intl.positive_sign()
   1.545 -			      :
   1.546 -			 __is_negative ? __punct.negative_sign()
   1.547 -				       : __punct.positive_sign();
   1.548 -  typename string_type::const_iterator __cp = __digits_first;
   1.549 -  while (__cp != __digits_last && __c_type.is(ctype_base::digit, *__cp))
   1.550 -    ++__cp;
   1.551 -  if (__cp == __digits_first)
   1.552 -    return __s;
   1.553 -  __digits_last = __cp;
   1.554 -
   1.555 -  // If grouping is required, we make a copy of __digits and
   1.556 -  // insert the grouping.
   1.557 -
   1.558 -  // To handle the fractional digits, we augment the first group
   1.559 -  // by frac_digits.  If there is only one group, we need first
   1.560 -  // to duplicate it.
   1.561 -
   1.562 -  string_type __new_digits(__digits_first, __digits_last);
   1.563 -#ifdef	__SYMBIAN32__
   1.564 -	int __numberofseperators = 0;
   1.565 -	if (__grouping.size()>0)
   1.566 -	__numberofseperators = (__new_digits.size()/__grouping[0])+1;
   1.567 -	else
   1.568 -		__numberofseperators = 0;
   1.569 -  __new_digits.resize(__new_digits.size()+__numberofseperators);
   1.570 -#endif  
   1.571 -  if (__grouping.size() != 0) {
   1.572 -    if (__grouping.size() == 1)
   1.573 -      __grouping.push_back(__grouping[0]);
   1.574 -    __grouping[0] += __frac_digits;
   1.575 -    _CharT* __data_ptr = __CONST_CAST(_CharT*,__new_digits.data());
   1.576 -    _CharT* __data_end = __data_ptr + __new_digits.size();
   1.577 -    
   1.578 -    
   1.579 -    ptrdiff_t __value_length = __insert_grouping(__data_ptr,
   1.580 -#ifdef	__SYMBIAN32__	    
   1.581 -	  				         __data_end-__numberofseperators,
   1.582 -#else
   1.583 -							__data_end,
   1.584 -#endif	  				         
   1.585 -					         __grouping,
   1.586 -					         __sep,
   1.587 -					         __plus, __minus, 0);
   1.588 -    __digits_first = __new_digits.begin();
   1.589 -    __digits_last  = __digits_first + __value_length;
   1.590 -  }
   1.591 -
   1.592 -  // Determine the amount of padding required, if any.  
   1.593 -#ifdef	__SYMBIAN32__
   1.594 -	  int __width        = __str.width(); //width returns signed value.
   1.595 -#else    
   1.596 -  size_t __width        = __str.width();
   1.597 -#endif
   1.598 -
   1.599 -#if defined(_STLP_DEBUG) && (defined(__HP_aCC) || (__HP_aCC <= 1))
   1.600 -  size_t __value_length = operator -(__digits_last, __digits_first);
   1.601 -#else
   1.602 -  size_t __value_length = __digits_last - __digits_first;
   1.603 -#endif
   1.604 -
   1.605 -  size_t __length       = __value_length;
   1.606 -      
   1.607 -  __length += __sign.size();
   1.608 -  if (__frac_digits != 0)
   1.609 -    ++__length;
   1.610 -
   1.611 -  bool __generate_curr = (__str.flags() & ios_base::showbase) !=0;
   1.612 -  if (__generate_curr)
   1.613 -    __length += __curr_sym.size();
   1.614 -  money_base::pattern __format =
   1.615 -    __intl ? (__is_negative ? __punct_intl.neg_format() 
   1.616 -                            : __punct_intl.pos_format())
   1.617 -           : (__is_negative ? __punct.neg_format() 
   1.618 -                            : __punct.pos_format());
   1.619 -  {
   1.620 -    for (int __i = 0; __i < 4; ++__i)
   1.621 -      if (__format.field[__i] == (char) money_base::space)
   1.622 -        ++__length;
   1.623 -  }
   1.624 -
   1.625 -  size_t __fill_amt = (int)__length < __width ? __width - __length : 0;
   1.626 -
   1.627 -  ios_base::fmtflags __fill_pos = __str.flags() & ios_base::adjustfield;
   1.628 -
   1.629 -  if (__fill_amt != 0 &&
   1.630 -      !(__fill_pos & (ios_base::left | ios_base::internal)))
   1.631 -    __s = fill_n(__s, __fill_amt, __fill);
   1.632 -    
   1.633 -  for (int __i = 0; __i < 4; ++__i) {
   1.634 -    char __ffield = __format.field[__i];
   1.635 -    if (__ffield == money_base::none) {
   1.636 -      if (__fill_amt != 0 && __fill_pos == ios_base::internal)
   1.637 -        __s = fill_n(__s, __fill_amt, __fill);
   1.638 -    }
   1.639 -    else if (__ffield == money_base::space) {
   1.640 -#ifdef __SYMBIAN32__
   1.641 -	if(__fill != __space)
   1.642 -		*__s++ = __fill;
   1.643 -	else
   1.644 -#endif		
   1.645 -      *__s++ = __space;
   1.646 -      if (__fill_amt != 0 && __fill_pos == ios_base::internal)
   1.647 -        __s = fill_n(__s, __fill_amt, __fill);
   1.648 -    }
   1.649 -    else if (__ffield == money_base::symbol) {
   1.650 -      if (__generate_curr)
   1.651 -        __s = copy(__curr_sym.begin(), __curr_sym.end(), __s);
   1.652 -    }
   1.653 -    else if (__ffield == money_base::sign) {
   1.654 -      if (__sign.size() != 0)
   1.655 -        *__s++ = __sign[0];
   1.656 -    }
   1.657 -    else if (__ffield == money_base::value) {
   1.658 -      if (__frac_digits == 0)
   1.659 -        __s = copy(__digits_first, __digits_last, __s);
   1.660 -      else {
   1.661 -        if ((int)__value_length <= __frac_digits) {
   1.662 -          *__s++ = __point;
   1.663 -          __s = copy(__digits_first, __digits_last, __s);
   1.664 -          __s =  fill_n(__s, __frac_digits - __value_length, __zero);
   1.665 -        }
   1.666 -        else {
   1.667 -#ifdef	__SYMBIAN32__
   1.668 -	  if (__frac_digits>0)
   1.669 -	  	{
   1.670 -#endif	  	
   1.671 -          __s = copy(__digits_first, __digits_last - __frac_digits, __s);
   1.672 -          if (__frac_digits != 0) {
   1.673 -            *__s++ = __point;
   1.674 -            __s = copy(__digits_last - __frac_digits, __digits_last, __s);
   1.675 -#ifdef	__SYMBIAN32__
   1.676 -	          }
   1.677 -#endif			  
   1.678 -          }
   1.679 -        }
   1.680 -      }
   1.681 -    }
   1.682 -  } // Close for loop
   1.683 -
   1.684 -  // Ouput rest of sign if necessary.
   1.685 -
   1.686 -  if (__sign.size() > 1)
   1.687 -    __s = copy(__sign.begin() + 1, __sign.end(), __s);
   1.688 -  if (!(__fill_pos & (ios_base::right | ios_base::internal)))
   1.689 -    __s = fill_n(__s, __fill_amt, __fill);
   1.690 -  
   1.691 -#ifdef __SYMBIAN32__
   1.692 -	__str.width(0);
   1.693 -#endif
   1.694 -  return __s;
   1.695 -}
   1.696 -
   1.697 -#ifdef	__SYMBIAN32__
   1.698 -/*
   1.699 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.700 -moneypunct<_CharT, _International>::moneypunct(size_t __refs = 0):_BaseFacet(__refs)
   1.701 -{ 
   1.702 -	
   1.703 -	
   1.704 -}*/
   1.705 -
   1.706 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.707 -_CharT        moneypunct<_CharT,_International>::do_decimal_point() const
   1.708 -{
   1.709 -	return _CharT('.');
   1.710 -}
   1.711 -
   1.712 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.713 -_CharT        moneypunct<_CharT,_International>::do_thousands_sep() const
   1.714 -{
   1.715 -	return _CharT(',');
   1.716 -}
   1.717 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.718 -basic_string<_CharT>      moneypunct<_CharT,_International>::do_curr_symbol()   const
   1.719 -{
   1.720 -	return _M_currSym;
   1.721 -}
   1.722 -
   1.723 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.724 -basic_string<_CharT>      moneypunct<_CharT,_International>::do_positive_sign()   const
   1.725 -{
   1.726 -	return _M_psign;
   1.727 -}
   1.728 -
   1.729 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.730 -basic_string<_CharT>      moneypunct<_CharT,_International>::do_negative_sign()   const
   1.731 -{
   1.732 -	return _M_nsign;
   1.733 -}
   1.734 -
   1.735 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.736 -string      moneypunct<_CharT,_International>::do_grouping()   const
   1.737 -{
   1.738 -	return _M_group;
   1.739 -}
   1.740 -
   1.741 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.742 -money_base::pattern        moneypunct<_CharT,_International>::do_pos_format()   const
   1.743 -{
   1.744 -	return _M_pos_format;
   1.745 -}
   1.746 -
   1.747 -template<class _CharT, bool _International>//__DFL_NON_TYPE_PARAM(bool, _International, false)>
   1.748 -money_base::pattern        moneypunct<_CharT,_International>::do_neg_format()   const
   1.749 -{
   1.750 -	return _M_neg_format;
   1.751 -}
   1.752 -
   1.753 -template<class _CharT, bool _International>
   1.754 -int       moneypunct<_CharT,_International>::do_frac_digits()   const
   1.755 -{
   1.756 -	return 0;
   1.757 -}
   1.758 -
   1.759 -
   1.760 -//monetary_byname<any>
   1.761 -
   1.762 -template<class _CharT, bool _International>
   1.763 -_CharT moneypunct_byname<_CharT, _International>::do_decimal_point() const 
   1.764 -  {return _Locale_mon_decimal_pointE(_M_monetary);}
   1.765 -
   1.766 -template<class _CharT, bool _International>
   1.767 -_CharT moneypunct_byname<_CharT, _International>::do_thousands_sep() const
   1.768 -  {return _Locale_mon_thousands_sepE(_M_monetary);}
   1.769 -
   1.770 -template<class _CharT, bool _International>
   1.771 -string  moneypunct_byname<_CharT, _International>::do_grouping() const
   1.772 -  {return moneypunct<_CharT,_International>::_M_group;}
   1.773 -
   1.774 -template<class _CharT, bool _International>
   1.775 -basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_curr_symbol() const
   1.776 -  {return moneypunct<_CharT,_International>::_M_currSym;}
   1.777 -
   1.778 -template<class _CharT, bool _International>
   1.779 -basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_positive_sign() const
   1.780 -  {return moneypunct<_CharT,_International>::_M_psign;}
   1.781 -
   1.782 -template<class _CharT, bool _International>
   1.783 -basic_string<_CharT> moneypunct_byname<_CharT, _International>::do_negative_sign() const
   1.784 -  {return moneypunct<_CharT,_International>::_M_nsign;}
   1.785 -
   1.786 -template<class _CharT, bool _International>
   1.787 -int moneypunct_byname<_CharT, _International>::do_frac_digits() const 
   1.788 -  {return _Locale_int_frac_digitsE(_M_monetary);}
   1.789 -
   1.790 -template<class _CharT, bool _International>
   1.791 -void moneypunct_byname<_CharT, _International>::Convert_string2_string_chart(basic_string<_CharT> &dst, string src)
   1.792 -	{
   1.793 -		int length = src.length();
   1.794 -		const char* str = src.c_str();
   1.795 -		for(int i = 0; i<length;i++)
   1.796 -		{
   1.797 -			dst.append(1, (_CharT)*str++);
   1.798 -			
   1.799 -		}
   1.800 -			
   1.801 -	}
   1.802 -
   1.803 -template<class _CharT, bool _International>
   1.804 -moneypunct_byname<_CharT, _International>::moneypunct_byname(const char * name,
   1.805 -						  size_t refs):
   1.806 -  moneypunct<_CharT, _International>(refs),
   1.807 -  _M_monetary(__acquire_monetaryE(name))
   1.808 -{
   1.809 -  if (!_M_monetary)
   1.810 -    locale::_M_throw_runtime_error();
   1.811 -  
   1.812 -  		moneypunct<_CharT,_International>::_M_group = _Locale_mon_groupingE(_M_monetary);
   1.813 -		Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_psign, _Locale_positive_signE(_M_monetary));
   1.814 -		Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_nsign, _Locale_negative_signE(_M_monetary));
   1.815 -		Convert_string2_string_chart(moneypunct<_CharT,_International>::_M_currSym, _Locale_int_curr_symbolE(_M_monetary));
   1.816 -}
   1.817 -
   1.818 -template<class _CharT, bool _International>
   1.819 -moneypunct_byname<_CharT, _International>::~moneypunct_byname()
   1.820 -{
   1.821 -  __release_monetaryE(_M_monetary);
   1.822 -}
   1.823 -
   1.824 -
   1.825 -#endif
   1.826 -_STLP_END_NAMESPACE
   1.827 -
   1.828 -# endif /* EXPOSE */
   1.829 -
   1.830 -#endif /* _STLP_MONETARY_C */