home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 May / PCFMay2001.iso / Xenon / C++ / FreeCommandLineTools.exe / Include / Rw / money.cc < prev    next >
Encoding:
C/C++ Source or Header  |  2000-01-31  |  21.5 KB  |  718 lines

  1. #ifndef __MONEY_CC
  2. #define __MONEY_CC
  3. #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig
  4. /***************************************************************************
  5.  *
  6.  * money.cc - Definitions for the Standard Library money facets
  7.  *
  8.  ***************************************************************************
  9.  *
  10.  * Copyright (c) 1994-1999 Rogue Wave Software, Inc.  All Rights Reserved.
  11.  *
  12.  * This computer software is owned by Rogue Wave Software, Inc. and is
  13.  * protected by U.S. copyright laws and other laws and by international
  14.  * treaties.  This computer software is furnished by Rogue Wave Software,
  15.  * Inc. pursuant to a written license agreement and may be used, copied,
  16.  * transmitted, and stored only in accordance with the terms of such
  17.  * license and with the inclusion of the above copyright notice.  This
  18.  * computer software or any other copies thereof may not be provided or
  19.  * otherwise made available to any other person.
  20.  *
  21.  * U.S. Government Restricted Rights.  This computer software is provided
  22.  * with Restricted Rights.  Use, duplication, or disclosure by the
  23.  * Government is subject to restrictions as set forth in subparagraph (c)
  24.  * (1) (ii) of The Rights in Technical Data and Computer Software clause
  25.  * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the
  26.  * Commercial Computer Software รป Restricted Rights at 48 CFR 52.227-19,
  27.  * as applicable.  Manufacturer is Rogue Wave Software, Inc., 5500
  28.  * Flatiron Parkway, Boulder, Colorado 80301 USA.
  29.  *
  30.  **************************************************************************/
  31.  
  32. #ifndef _RWSTD_NO_NAMESPACE
  33. namespace __rwstd {
  34. #endif
  35.  
  36. // -------------------------------------------------
  37. // Template moneypunct_data<charT> member templates.
  38. // -------------------------------------------------
  39.  
  40. template <class charT>
  41. moneypunct_data<charT>::moneypunct_data
  42.     (moneypunct_init<charT> *init)
  43. {
  44.   if (!init) {
  45.     this->dp_=charT('.');
  46.     this->ts_=charT(',');
  47.     fd_=0;
  48.   } else {
  49.     this->dp_=init->dp_;
  50.     this->ts_=init->ts_;
  51.     this->gr_=init->gr_;
  52.     cs_=init->cs_;
  53.     ps_=init->ps_;
  54.     ns_=init->ns_;
  55.     fd_=init->fd_;
  56.     pf_=init->pf_;
  57.     nf_=init->nf_;
  58.  
  59.     if (init->del_)
  60.       delete[] (char*) init;
  61.   }
  62. }
  63.  
  64. template <class charT>
  65. void moneypunct_data<charT>::__initfacetbase (const locale*) { }
  66.  
  67. template <class charT>
  68. moneypunct_init<charT>*
  69. _RWSTDExportTemplate fixup_moneypunct_init
  70.     (moneypunct_init<char> *init,charT*)
  71. {
  72.   moneypunct_init<charT> *result = NULL;
  73. #if !defined (_RWSTD_NO_NAMESPACE) && !defined (_RWSTD_NO_NEW_HEADER)
  74.   using std::mbstate_t;
  75. #endif
  76.  
  77.   if (init) {
  78.     const _RW_STD::codecvt<charT,char,mbstate_t> &cvt =
  79.         #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  80.         _RW_STD::use_facet<_RW_STD::codecvt<charT,char,mbstate_t> >(_RW_STD::locale::classic());
  81.         #else
  82.         _RW_STD::use_facet(_RW_STD::locale::classic(),(_RW_STD::codecvt<charT,char,mbstate_t>*)0);
  83.         #endif
  84.  
  85.     typedef _RW_STD::basic_string<charT,_RW_STD::char_traits<charT>,_RW_STD::allocator<charT> > s_type;
  86.     s_type cs_=cvt.in(init->cs_);
  87.     s_type ps_=cvt.in(init->ps_);
  88.     s_type ns_=cvt.in(init->ns_);
  89.  
  90.     size_t extra_chars = _RW_STD::char_traits<char>::length(init->gr_);
  91.  
  92.     size_t extra_charTs = cs_.length()+ps_.length()+ns_.length()+3;
  93.  
  94.     result=(moneypunct_init<charT>*)
  95.         new char[sizeof(*result)+extra_chars+extra_charTs*sizeof(charT)];
  96.  
  97.     result->del_=true;
  98.     result->dp_=charT(init->dp_);
  99.     result->ts_=charT(init->ts_);
  100.     result->fd_=init->fd_;
  101.     result->pf_=init->pf_;
  102.     result->nf_=init->nf_;
  103.  
  104.     size_t n;
  105.     charT *p=(charT*) (result+1);
  106.     result->cs_=_RW_STD::char_traits<charT>::copy(p,cs_.c_str(),n=cs_.length());
  107.     *(p+=n)++=0;
  108.     result->ps_=_RW_STD::char_traits<charT>::copy(p,ps_.c_str(),n=ps_.length());
  109.     *(p+=n)++=0;
  110.     result->ns_=_RW_STD::char_traits<charT>::copy(p,ns_.c_str(),n=ns_.length());
  111.     *(p+=n)++=0;
  112.  
  113.     result->gr_= _RW_STD::char_traits<char>::copy((char*)(p+n),init->gr_,
  114.                      _RW_STD::char_traits<char>::length(init->gr_));
  115.   }
  116.  
  117.   if (init->del_)
  118.     delete[] (char*) init;
  119.  
  120.   return result;
  121. }
  122.  
  123. template <class charT>
  124. moneypunct_init<charT>*
  125. moneypunct_data<charT>::get_init_by_name_
  126.     (const char *name,bool intl)
  127. {
  128.   return fixup_moneypunct_init (__get_named_init(name,intl),(charT*)0);
  129. }
  130.  
  131. // ------------------------------------------------------------
  132. // Template class money_handler_base_1<charT> member templates.
  133. // ------------------------------------------------------------
  134.  
  135. template <class charT>
  136. const moneypunct_data<charT>&
  137. money_handler_base_1<charT>::get_punct_data
  138.     (const _RW_STD::locale &loc,bool intl)
  139. {
  140. #ifndef _RWSTD_NO_TEMPLATE_ON_RETURN_TYPE
  141.   if (intl)
  142.     return _RW_STD::use_facet<_RW_STD::moneypunct<charT,true> >(loc);
  143.   else
  144.     return _RW_STD::use_facet<_RW_STD::moneypunct<charT,false> >(loc);
  145. #else
  146.   if (intl) // casts required for some compilers
  147. #if defined(__TURBOC__) && (__TURBOC__ > 0x540)
  148.     return moneypunct_data<charT>( _RW_STD::use_facet(loc,(_RW_STD::moneypunct<charT,true>*)0));
  149. #else
  150.     return _RW_STD::use_facet(loc,(_RW_STD::moneypunct<charT,true>*)0);
  151. #endif
  152.   else
  153. #if defined(__TURBOC__) && (__TURBOC__ > 0x540)
  154.     return moneypunct_data<charT>(_RW_STD::use_facet(loc,(_RW_STD::moneypunct<charT,false>*)0));
  155. #else
  156.     return _RW_STD::use_facet(loc,(_RW_STD::moneypunct<charT,false>*)0);
  157. #endif
  158. #endif
  159. }
  160.  
  161. // -----------------------------------------------------------
  162. // Template class money_reader_base_1<charT> member templates.
  163. // -----------------------------------------------------------
  164.  
  165. template <class charT>
  166. money_reader_base_1<charT>::
  167. money_reader_base_1 (digit_reader_base_1<charT> &r,
  168.                      const moneypunct_data<charT> &mp) 
  169.  : money_handler_base_1<charT>(mp), reader(r)
  170. { }
  171.  
  172. template <class charT>
  173. void money_reader_base_1<charT>::get_money_string
  174.     (string_type &result,const char *eod)
  175. {
  176.   int len=eod-reader.digits;
  177.   if (reader.negative)
  178.     len++;
  179.  
  180.   result.resize(0);
  181.   result.reserve(len);
  182.  
  183.   if (reader.negative)
  184.     result+=reader.dmap.punct_chars[digit_map_base::minus];
  185.  
  186.   const char *d=reader.digits;
  187.   const char *end=eod-1;
  188.   while (d<end && *d==0) d++;
  189.   for ( ; d<=end; d++)
  190.     result+=reader.dmap.digit_chars[*d];
  191. }
  192.  
  193. // -------------------------------------------------------------------------
  194. // Template class money_reader_base_2<charT,InputIterator> member templates.
  195. // -------------------------------------------------------------------------
  196.  
  197. template <class charT,class InputIterator>
  198. money_reader_base_2<charT,InputIterator>::
  199. money_reader_base_2 (InputIterator &i,InputIterator &e,
  200.                      _RW_STD::ios_base &b,const moneypunct_data<charT> &mp)
  201.  :  digit_reader<charT,InputIterator>(i,e,b,mp),
  202.     money_reader_base_1<charT>(this_as_digit_reader(),mp)
  203. {
  204.   this->radix=10;
  205.   this->is_signed=false;
  206. }
  207.  
  208. template <class charT,class InputIterator>
  209. char* money_reader_base_2<charT,InputIterator>::
  210.     get_money_digits (void)
  211. {
  212.   charT c;
  213.   // Always parse input according to negative format.
  214.   const _RW_STD::money_base::pattern &patt=this->get_neg_format();
  215.  
  216.   // If this ends up non-NULL, it points to trailing sign char(s) that are
  217.   // required at the end of the pattern.
  218.   const charT *sign=NULL;
  219.  
  220.   bool need_curr=(this->io.flags()&_RW_STD::ios_base::showbase)? true : false;
  221.   bool got_curr=false;
  222.   int fracs=this->get_frac_digits();
  223.  
  224.   char *eod=this->digits;
  225.   const char *p=patt.field,*pend=p+sizeof patt.field-1;
  226.  
  227.   for ( ; !this->error && p<=pend; p++) {
  228.     switch (*p) {
  229.      case _RW_STD::money_base::space:
  230.      case _RW_STD::money_base::none:
  231.       while (!this->at_end() && this->ctyp.is(_RW_STD::ctype_base::space,*this->in))
  232.         this->in++;
  233.       break;
  234.  
  235.      case _RW_STD::money_base::symbol:
  236.       if (!this->at_end()) {
  237.         const charT *curr=this->get_curr_symbol().c_str();
  238.         if ((c=*this->in)==*curr) {
  239.           // We ate a character, so rest of symbol must be present.
  240.           need_curr=true;
  241.           do {
  242.             this->in++;
  243.             if (*++curr==charT('\0')) {
  244.               got_curr=true;
  245.               break;
  246.             }
  247.           } while (!this->at_end() && (c=*this->in)==*curr);
  248.         }
  249.       }
  250.       if (need_curr && !got_curr)
  251.         this->error|=this->bad_curr_symbol;
  252.       break;
  253.  
  254.      case _RW_STD::money_base::sign:
  255.       if (!this->at_end()) {
  256.         sign=this->get_negative_sign().c_str();
  257.         if ((c=*this->in)==*sign) {
  258.           this->negative=true;
  259.           sign++;
  260.           this->in++;
  261.         } else {
  262.           sign=this->get_positive_sign().c_str();
  263.           if (c==*sign) {
  264.             sign++;
  265.             this->in++;
  266.           } else
  267.             sign=NULL;
  268.         }
  269.       }
  270.       break;
  271.  
  272.      case _RW_STD::money_base::value:
  273.       eod=this->get_int_digits();
  274.       if (!this->error && fracs && !this->at_end() &&
  275.           *this->in==this->get_decimal_point())
  276.       {
  277.         this->in++;
  278.         char *frac_start=eod;
  279.         eod=this->get_digit_string(eod);
  280.         if (!this->error) {
  281.           fracs-=(eod-frac_start);
  282.           if (fracs<0) {
  283.             // Too many fractional digits in input.  We truncate.  The
  284.             // alternative would be to return an error.
  285.             eod+=fracs;
  286.             fracs=0;
  287.           }
  288.         }
  289.       }
  290.       if (eod==this->digits)
  291.         this->error|=this->no_digits;
  292.       else if (!this->error && fracs>0) {
  293.         // Add trailing zeros until the correct number of fractional digits
  294.         // is reached.
  295.         if (this->digits+sizeof this->digits-eod < fracs)
  296.           this->error|=this->too_many_digits;
  297.         else {
  298.           do *eod++=0;
  299.           while (--fracs);
  300.         }
  301.       }
  302.       break;
  303.     }
  304.   }
  305.  
  306.   if (sign && !this->error)
  307.     // We ate one charT of a sign earlier, rest of sign must be present at end.
  308.     while (*sign)
  309.       if (!this->at_end() && *this->in==*sign++)
  310.         this->in++;
  311.       else {
  312.         this->error|=this->bad_sign;
  313.         break;
  314.       }
  315.  
  316.   this->frac_beg=this->exp_beg=eod;
  317.   return eod;
  318. }
  319.  
  320. // ------------------------------------------------------------
  321. // Template money_reader<charT,InputIterator> member templates.
  322. // ------------------------------------------------------------
  323.  
  324. template <class charT,class InputIterator>
  325. money_reader<charT,InputIterator>::
  326. money_reader (InputIterator &i,InputIterator &e,
  327.     _RW_STD::ios_base &b,bool intl):
  328.     money_reader_base_2<charT,InputIterator>
  329.         (i,e,b,money_handler_base_1<charT>::
  330.          get_punct_data(b.getloc(),intl))
  331. { }
  332.  
  333. // -----------------------------------------------------
  334. // Template money_writer_base_1<charT> member templates.
  335. // -----------------------------------------------------
  336.  
  337. template <class charT>
  338. money_writer_base_1<charT>::money_writer_base_1
  339.     (digit_writer_base_1<charT> &w,
  340.      const moneypunct_data<charT> &mp)
  341.  : money_handler_base_1<charT>(mp), writer(w)
  342. { }
  343.  
  344. template <class charT>
  345. void money_writer_base_1<charT>::put_money (charT fill)
  346. {
  347.   bool negative;
  348.   if (*writer.start=='-') {
  349.     negative=true;
  350.     writer.start++;
  351.   } else {
  352.     negative=false;
  353.     if (*writer.start=='+' || *writer.start==' ')
  354.       writer.start++;
  355.   }
  356.  
  357.   charT wide_digits[sizeof writer.buffer];
  358.   writer.ctyp.widen(writer.start,writer.end,wide_digits);
  359.   put_money_sub(wide_digits,wide_digits+(writer.end-writer.start),
  360.       negative,fill);
  361. }
  362.  
  363. template <class charT>
  364. void money_writer_base_1<charT>::put_money
  365.     (const string_type& digits,charT fill)
  366. {
  367.   const charT *punct =
  368.       digit_map<charT>::get_digit_map(writer.ctyp)
  369.       .get_punct();
  370.  
  371.   const charT *start=digits.c_str();
  372.   bool negative;
  373.   if (*start==punct[digit_map_base::minus]) {
  374.     negative=true;
  375.     start++;
  376.   } else
  377.     negative=false;
  378.  
  379.   const charT *end=writer.ctyp.scan_not(_RW_STD::ctype_base::digit,start,
  380.       digits.c_str()+digits.length());
  381.  
  382.   put_money_sub(start,end,negative,fill);
  383. }
  384.  
  385. // --------------------------------------------------------------------
  386. // Template money_writer_base_2<charT,OutputIterator> member templates.
  387. // --------------------------------------------------------------------
  388.  
  389. template <class charT,class OutputIterator>
  390. money_writer_base_2<charT,OutputIterator>::money_writer_base_2
  391.     (OutputIterator &os,_RW_STD::ios_base &io,
  392.      const moneypunct_data<charT> &mp)
  393.  : digit_writer<charT,OutputIterator> (os,io,mp),
  394.    money_writer_base_1<charT> (this_as_digit_writer(),mp)
  395. { }
  396.  
  397. template <class charT, class OutputIterator>
  398. void money_writer_base_2<charT,OutputIterator>::put_money_sub
  399.     (const charT *start,const charT *end,bool negative,charT fill)
  400. {
  401.   const _RW_STD::money_base::pattern *patt;
  402.   const string_type *sign;
  403.   if (negative) {
  404.     patt=&this->get_neg_format();
  405.     sign=&this->get_negative_sign();
  406.   } else {
  407.     patt=&this->get_pos_format();
  408.     sign=&this->get_positive_sign();
  409.   }
  410.  
  411.   int frac_digits=this->get_frac_digits();
  412.   int int_digits=end-start-frac_digits;
  413.   int unGrouped,zero_pad;
  414.  
  415.   if (int_digits<0) {
  416.     zero_pad=-int_digits;
  417.     int_digits=0;
  418.   } else
  419.     zero_pad=0;
  420.  
  421.   charT sep;
  422.   if (int_digits>0) {
  423.     unGrouped=calc_groups(int_digits,this->get_grouping());
  424.     if (this->num_groups)
  425.       sep=this->get_thousands_sep();
  426.   } else
  427.     unGrouped=0;
  428.  
  429.   const char *p,*pend=patt->field+sizeof patt->field;
  430.   int leftFill=0,internalFill=0,rightFill=0;
  431.  
  432.   if (this->width) {
  433.     int n=0;
  434.     for (p=patt->field; p<pend; p++) {
  435.       switch (*p) {
  436.        case _RW_STD::money_base::space:
  437.         n++;
  438.         break;
  439.        case _RW_STD::money_base::symbol:
  440.         if (this->flags& _RW_STD::ios_base::showbase)
  441.           n+=this->get_curr_symbol().length();
  442.         break;
  443.        case _RW_STD::money_base::sign:
  444.         n+=sign->length();
  445.         break;
  446.        case _RW_STD::money_base::value:
  447.         n+=int_digits+this->num_groups;
  448.         if (frac_digits)
  449.           n+=frac_digits+1;
  450.         break;
  451.       }
  452.     }
  453.  
  454.     if ((n-=this->width)>0) {
  455.       switch (this->adjust) {
  456.        case digit_writer_base::left:
  457.         rightFill=n;
  458.         break;
  459.        case digit_writer_base::internal:
  460.         internalFill=n;
  461.         break;
  462.        default:
  463.         leftFill=n;
  464.       }
  465.     }
  466.  
  467.     this->width=0;
  468.   }
  469.  
  470.   if (leftFill)
  471.     do *this->out++=fill;
  472.     while (--leftFill);
  473.  
  474.   const charT *schar=sign->c_str();
  475.   for (p=patt->field; p<pend; p++)
  476.     switch (*p) {
  477.      case _RW_STD::money_base::symbol:
  478.       if (this->flags& _RW_STD::ios_base::showbase)
  479.         put_keyword(this->get_curr_symbol(),fill);
  480.       break;
  481.      case _RW_STD::money_base::sign:
  482.       if (*schar)
  483.         *this->out++=*schar++;
  484.       break;
  485.      case _RW_STD::money_base::value:
  486.       while (unGrouped--)
  487.         *this->out++=*start++;
  488.       while (this->num_groups--) {
  489.         *this->out++=sep;
  490.         while ((*this->group)--)
  491.           *this->out++=*start++;
  492.         this->group++;
  493.       }
  494.       if (frac_digits) {
  495.         *this->out++=this->get_decimal_point();
  496.         while (zero_pad--) {
  497.           frac_digits--;
  498.           *this->out++=this->ctyp.widen('0');
  499.         }
  500.         while (frac_digits-->0)
  501.           *this->out++=*start++;
  502.       }
  503.       break;
  504.      case _RW_STD::money_base::space:
  505.       if (!internalFill) {
  506.         *this->out++=this->ctyp.widen(' ');
  507.         break;
  508.       }
  509.       // Fall through ...
  510.      case _RW_STD::money_base::none:
  511.       if (internalFill)
  512.         do *this->out++=fill;
  513.         while (--internalFill);
  514.       break;
  515.     }
  516.  
  517.   while (*schar)
  518.     *this->out++=*schar++;
  519.  
  520.   if (rightFill+=internalFill) {
  521.     do *this->out++=fill;
  522.     while (--rightFill);
  523.   }
  524. }
  525.  
  526. // -------------------------------------------------------------
  527. // Template money_writer<charT,OutputIterator> member templates.
  528. // -------------------------------------------------------------
  529.  
  530. template <class charT,class OutputIterator>
  531. money_writer<charT,OutputIterator>::money_writer 
  532. (OutputIterator &os,_RW_STD::ios_base &io,bool intl)
  533.  : money_writer_base_2<charT,OutputIterator>
  534.         (os,io,money_handler_base_1<charT>::
  535.          get_punct_data(io.getloc(),intl))
  536. { }
  537. #ifndef _RWSTD_NO_NAMESPACE
  538. } namespace std {
  539. #endif
  540.  
  541. // ------------------------------------------------------
  542. // Facet money_get<charT,InputIterator> member templates.
  543. // ------------------------------------------------------
  544.  
  545. template <class charT, class InputIterator>
  546. locale::id money_get<charT,InputIterator>::id;
  547.  
  548. template <class charT, class InputIterator>
  549. money_get<charT,InputIterator>::~money_get() { }
  550.  
  551. // Warning -- these functions do not input actual monetary value; they just
  552. // input numbers that represent monetary value.
  553.  
  554. template <class charT, class InputIterator>
  555. InputIterator money_get<charT,InputIterator>::do_get
  556.     (InputIterator in, InputIterator end, bool intl, ios_base& io,
  557.      ios_base::iostate& err, long double& units) const
  558. {
  559.   __RWSTD::money_reader<charT,InputIterator> reader(in,end,io,intl);
  560.   long double v=reader.to_long_double(reader.get_money_digits());
  561.   err=ios_base::goodbit;
  562.  
  563.   if (reader.error)
  564.     err=ios_base::failbit;
  565.   else
  566.     units=v;
  567.  
  568.   if (reader.reached_end)
  569.     err|=ios_base::eofbit;
  570.  
  571.   return in;
  572. }
  573.  
  574. template <class charT, class InputIterator>
  575. InputIterator money_get<charT,InputIterator>::do_get
  576.     (InputIterator in, InputIterator end, bool intl, ios_base &io,
  577.      ios_base::iostate &err, string_type &digit_string) const
  578. {
  579.   __RWSTD::money_reader<charT,InputIterator> reader(in,end,io,intl);
  580.   const char *eod=reader.get_money_digits();
  581.   err=ios_base::goodbit;
  582.  
  583.   if (reader.error)
  584.     err=ios_base::failbit;
  585.   else
  586.     reader.get_money_string(digit_string,eod);
  587.  
  588.   if (reader.reached_end)
  589.     err|=ios_base::eofbit;
  590.  
  591.   return in;
  592. }
  593.  
  594. // -------------------------------------------------------
  595. // Facet money_put<charT,OutputIterator> member templates.
  596. // -------------------------------------------------------
  597.  
  598. template <class charT, class OutputIterator>
  599. locale::id money_put<charT,OutputIterator>::id;
  600.  
  601. template <class charT, class OutputIterator>
  602. money_put<charT,OutputIterator>::~money_put() { }
  603.  
  604. template <class charT, class OutputIterator>
  605. OutputIterator money_put<charT,OutputIterator>::do_put
  606.     (OutputIterator out, bool intl, ios_base& io, charT fill,
  607. #ifndef _RWSTD_NO_LONG_DOUBLE
  608.      long double quant) const
  609. #else
  610.      double quant) const
  611. #endif
  612.  
  613. {
  614.   __RWSTD::money_writer<charT,OutputIterator> writer(out,io,intl);
  615.   writer.digitize(quant);
  616.   writer.put_money(fill);
  617.   return out;
  618. }
  619.  
  620. template <class charT, class OutputIterator>
  621. OutputIterator money_put<charT,OutputIterator>::do_put
  622.     (OutputIterator out, bool intl, ios_base& io, charT fill,
  623.      const string_type& digits) const
  624. {
  625.   __RWSTD::money_writer<charT,OutputIterator> writer(out,io,intl);
  626.   writer.put_money(digits,fill);
  627.   return out;
  628. }
  629.  
  630. // ----------------------------------------------
  631. // Facet moneypunct<charT,Intl> member templates.
  632. // ----------------------------------------------
  633.  
  634. template <class charT, bool Intl>
  635. locale::id moneypunct<charT,Intl>::id;
  636.  
  637. #ifndef _RWSTD_NO_STI_SIMPLE
  638. template <class charT, bool Intl>
  639. const bool moneypunct<charT,Intl>::intl;
  640. #endif
  641.  
  642. template <class charT, bool Intl>
  643. moneypunct<charT,Intl>::~moneypunct () { }
  644.  
  645. template <class charT, bool Intl>
  646. charT moneypunct<charT,Intl>::do_decimal_point () const
  647.      { return this->dp_; }
  648.  
  649. template <class charT, bool Intl>
  650. charT moneypunct<charT,Intl>::do_thousands_sep () const
  651.      { return this->ts_; }
  652.  
  653. template <class charT, bool Intl>
  654. string moneypunct<charT,Intl>::do_grouping () const
  655.      { return this->gr_; }
  656.  
  657. template <class charT, bool Intl>
  658. _TYPENAME moneypunct<charT,Intl>::string_type
  659. moneypunct<charT,Intl>::do_curr_symbol () const
  660.      { return this->cs_; }
  661.  
  662. template <class charT, bool Intl>
  663. _TYPENAME moneypunct<charT,Intl>::string_type
  664. moneypunct<charT,Intl>::do_positive_sign () const
  665.      { return this->ps_; }
  666.  
  667. template <class charT, bool Intl>
  668. _TYPENAME moneypunct<charT,Intl>::string_type
  669. moneypunct<charT,Intl>::do_negative_sign () const
  670.      { return this->ns_; }
  671.  
  672. template <class charT, bool Intl>
  673. int moneypunct<charT,Intl>::do_frac_digits () const
  674.      { return this->fd_; }
  675.  
  676. template <class charT, bool Intl>
  677. money_base::pattern
  678. moneypunct<charT,Intl>::do_pos_format () const
  679.      { return this->pf_; }
  680.  
  681. template <class charT, bool Intl>
  682. money_base::pattern
  683. moneypunct<charT,Intl>::do_neg_format () const
  684.      { return this->nf_; }
  685.  
  686. template <class charT, bool Intl>
  687. void moneypunct<charT,Intl>::__initfacet (const locale* loc) {
  688.   this->dp_=do_decimal_point();
  689.   this->ts_=do_thousands_sep();
  690.   this->gr_=do_grouping();
  691.   this->cs_=do_curr_symbol();
  692.   this->ps_=do_positive_sign();
  693.   this->ns_=do_negative_sign();
  694.   this->fd_=do_frac_digits();
  695.   this->pf_=do_pos_format();
  696.   this->nf_=do_neg_format();
  697.   this->__initfacetbase(loc);
  698. }
  699.  
  700. // --------------------------------------------------------------------------
  701. // Money punctuation by-name member templates: moneypunct_byname<charT,Intl>
  702. // --------------------------------------------------------------------------
  703.  
  704. template <class charT, bool Intl>
  705. moneypunct_byname<charT,Intl>::moneypunct_byname (const char *n,size_t refs):
  706.     moneypunct<charT,Intl>(refs,get_init_by_name_(n,moneypunct<charT,Intl>::intl))
  707. { }
  708.  
  709. template <class charT, bool Intl>
  710. moneypunct_byname<charT,Intl>::~moneypunct_byname()
  711. { }
  712. #ifndef _RWSTD_NO_NAMESPACE
  713. }
  714. #endif
  715.  
  716. #pragma option pop
  717. #endif /* __MONEY_CC */
  718.