ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

_monetary.h
Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 1999
00003  * Silicon Graphics Computer Systems, Inc.
00004  *
00005  * Copyright (c) 1999
00006  * Boris Fomitchev
00007  *
00008  * This material is provided "as is", with absolutely no warranty expressed
00009  * or implied. Any use is at your own risk.
00010  *
00011  * Permission to use or copy this software for any purpose is hereby granted
00012  * without fee, provided the above notices are retained on all copies.
00013  * Permission to modify the code and to distribute modified code is granted,
00014  * provided the above notices are retained, and a notice that the code was
00015  * modified is included with the above copyright notice.
00016  *
00017  */
00018 // WARNING: This is an internal header file, included by other C++
00019 // standard library headers.  You should not attempt to use this header
00020 // file directly.
00021 
00022 
00023 #ifndef _STLP_INTERNAL_MONETARY_H
00024 #define _STLP_INTERNAL_MONETARY_H
00025 
00026 #ifndef _STLP_INTERNAL_OSTREAMBUF_ITERATOR_H
00027 #  include <stl/_ostreambuf_iterator.h>
00028 #endif
00029 
00030 #ifndef _STLP_INTERNAL_ISTREAMBUF_ITERATOR_H
00031 #  include <stl/_istreambuf_iterator.h>
00032 #endif
00033 
00034 #ifndef _STLP_FACETS_FWD_H
00035 #  include <stl/_facets_fwd.h>
00036 #endif
00037 
00038 _STLP_BEGIN_NAMESPACE
00039 
00040 class money_base {
00041 public:
00042   enum part {none, space, symbol, sign, value};
00043   struct pattern {
00044     char field[4];
00045   };
00046 };
00047 
00048 // moneypunct facets: forward declaration
00049 template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool, _International, false) > class moneypunct {};
00050 
00051 // money_get facets
00052 
00053 template <class _CharT, class _InputIter>
00054 class money_get : public locale::facet {
00055 public:
00056   typedef _CharT               char_type;
00057   typedef _InputIter           iter_type;
00058   typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
00059 
00060   explicit money_get(size_t __refs = 0) : locale::facet(__refs) {}
00061   iter_type get(iter_type __s, iter_type  __end, bool __intl,
00062                 ios_base&  __str, ios_base::iostate&  __err,
00063                 _STLP_LONGEST_FLOAT_TYPE& __units) const
00064   { return do_get(__s,  __end, __intl,  __str,  __err, __units); }
00065   iter_type get(iter_type __s, iter_type  __end, bool __intl,
00066                 ios_base&  __str, ios_base::iostate& __err,
00067                 string_type& __digits) const
00068   { return do_get(__s,  __end, __intl,  __str,  __err, __digits); }
00069 
00070   static locale::id id;
00071 
00072 protected:
00073   ~money_get() {}
00074   virtual iter_type do_get(iter_type __s, iter_type  __end, bool  __intl,
00075                            ios_base&  __str, ios_base::iostate& __err,
00076                            _STLP_LONGEST_FLOAT_TYPE& __units) const;
00077   virtual iter_type do_get(iter_type __s, iter_type __end, bool __intl,
00078                            ios_base&  __str, ios_base::iostate& __err,
00079                            string_type& __digits) const;
00080 };
00081 
00082 
00083 // moneypunct facets: definition of specializations
00084 
00085 _STLP_TEMPLATE_NULL
00086 class _STLP_CLASS_DECLSPEC moneypunct<char, true> : public locale::facet, public money_base {
00087 public:
00088   typedef char                 char_type;
00089   typedef string               string_type;
00090   explicit moneypunct _STLP_PSPEC2(char, true) (size_t __refs = 0);
00091 
00092   char        decimal_point() const { return do_decimal_point(); }
00093   char        thousands_sep() const { return do_thousands_sep(); }
00094   string      grouping()      const { return do_grouping(); }
00095   string_type curr_symbol()   const { return do_curr_symbol(); }
00096   string_type positive_sign() const { return do_positive_sign(); }
00097   string_type negative_sign() const { return do_negative_sign(); }
00098   int         frac_digits()   const { return do_frac_digits(); }
00099   pattern     pos_format()    const { return do_pos_format(); }
00100   pattern     neg_format()    const { return do_neg_format(); }
00101 
00102   static _STLP_STATIC_DECLSPEC locale::id id;
00103   _STLP_STATIC_CONSTANT(bool, intl = true);
00104 
00105 protected:
00106   pattern _M_pos_format;
00107   pattern _M_neg_format;
00108 
00109   ~moneypunct _STLP_PSPEC2(char, true) ();
00110 
00111   virtual char        do_decimal_point() const;
00112   virtual char        do_thousands_sep() const;
00113   virtual string      do_grouping()      const;
00114 
00115   virtual string      do_curr_symbol()   const;
00116 
00117   virtual string      do_positive_sign() const;
00118   virtual string      do_negative_sign() const;
00119   virtual int         do_frac_digits()   const;
00120   virtual pattern     do_pos_format()    const;
00121   virtual pattern     do_neg_format()    const;
00122 };
00123 
00124 _STLP_TEMPLATE_NULL
00125 class _STLP_CLASS_DECLSPEC moneypunct<char, false> : public locale::facet, public money_base {
00126 public:
00127   typedef char                 char_type;
00128   typedef string               string_type;
00129 
00130   explicit moneypunct _STLP_PSPEC2(char, false) (size_t __refs = 0);
00131 
00132   char        decimal_point() const { return do_decimal_point(); }
00133   char        thousands_sep() const { return do_thousands_sep(); }
00134   string      grouping()      const { return do_grouping(); }
00135   string_type curr_symbol()   const { return do_curr_symbol(); }
00136   string_type positive_sign() const { return do_positive_sign(); }
00137   string_type negative_sign() const { return do_negative_sign(); }
00138   int         frac_digits()   const { return do_frac_digits(); }
00139   pattern     pos_format()    const { return do_pos_format(); }
00140   pattern     neg_format()    const { return do_neg_format(); }
00141 
00142   static _STLP_STATIC_DECLSPEC locale::id id;
00143   _STLP_STATIC_CONSTANT(bool, intl = false);
00144 
00145 protected:
00146   pattern _M_pos_format;
00147   pattern _M_neg_format;
00148 
00149   ~moneypunct _STLP_PSPEC2(char, false) ();
00150 
00151   virtual char        do_decimal_point() const;
00152   virtual char        do_thousands_sep() const;
00153   virtual string      do_grouping()      const;
00154 
00155   virtual string      do_curr_symbol()   const;
00156 
00157   virtual string      do_positive_sign() const;
00158   virtual string      do_negative_sign() const;
00159   virtual int         do_frac_digits()   const;
00160   virtual pattern     do_pos_format()    const;
00161   virtual pattern     do_neg_format()    const;
00162 };
00163 
00164 
00165 #ifndef _STLP_NO_WCHAR_T
00166 
00167 _STLP_TEMPLATE_NULL
00168 class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, true> : public locale::facet, public money_base {
00169 public:
00170   typedef wchar_t                 char_type;
00171   typedef wstring                 string_type;
00172   explicit moneypunct _STLP_PSPEC2(wchar_t, true) (size_t __refs = 0);
00173   wchar_t     decimal_point() const { return do_decimal_point(); }
00174   wchar_t     thousands_sep() const { return do_thousands_sep(); }
00175   string      grouping()      const { return do_grouping(); }
00176   string_type curr_symbol()   const { return do_curr_symbol(); }
00177   string_type positive_sign() const { return do_positive_sign(); }
00178   string_type negative_sign() const { return do_negative_sign(); }
00179   int         frac_digits()   const { return do_frac_digits(); }
00180   pattern     pos_format()    const { return do_pos_format(); }
00181   pattern     neg_format()    const { return do_neg_format(); }
00182 
00183   static _STLP_STATIC_DECLSPEC locale::id id;
00184   _STLP_STATIC_CONSTANT(bool, intl = true);
00185 
00186 protected:
00187   pattern _M_pos_format;
00188   pattern _M_neg_format;
00189 
00190   ~moneypunct _STLP_PSPEC2(wchar_t, true) ();
00191 
00192   virtual wchar_t     do_decimal_point() const;
00193   virtual wchar_t     do_thousands_sep() const;
00194   virtual string      do_grouping()      const;
00195 
00196   virtual string_type do_curr_symbol()   const;
00197 
00198   virtual string_type do_positive_sign() const;
00199   virtual string_type do_negative_sign() const;
00200   virtual int         do_frac_digits()   const;
00201   virtual pattern     do_pos_format()    const;
00202   virtual pattern     do_neg_format()    const;
00203 };
00204 
00205 
00206 _STLP_TEMPLATE_NULL
00207 class _STLP_CLASS_DECLSPEC moneypunct<wchar_t, false> : public locale::facet, public money_base {
00208 public:
00209   typedef wchar_t                 char_type;
00210   typedef wstring                 string_type;
00211   explicit moneypunct _STLP_PSPEC2(wchar_t, false) (size_t __refs = 0);
00212   wchar_t     decimal_point() const { return do_decimal_point(); }
00213   wchar_t     thousands_sep() const { return do_thousands_sep(); }
00214   string      grouping()      const { return do_grouping(); }
00215   string_type curr_symbol()   const { return do_curr_symbol(); }
00216   string_type positive_sign() const { return do_positive_sign(); }
00217   string_type negative_sign() const { return do_negative_sign(); }
00218   int         frac_digits()   const { return do_frac_digits(); }
00219   pattern     pos_format()    const { return do_pos_format(); }
00220   pattern     neg_format()    const { return do_neg_format(); }
00221 
00222   static _STLP_STATIC_DECLSPEC locale::id id;
00223   _STLP_STATIC_CONSTANT(bool, intl = false);
00224 
00225 protected:
00226   pattern _M_pos_format;
00227   pattern _M_neg_format;
00228 
00229   ~moneypunct _STLP_PSPEC2(wchar_t, false) ();
00230 
00231   virtual wchar_t     do_decimal_point() const;
00232   virtual wchar_t     do_thousands_sep() const;
00233   virtual string      do_grouping()      const;
00234 
00235   virtual string_type do_curr_symbol()   const;
00236 
00237   virtual string_type do_positive_sign() const;
00238   virtual string_type do_negative_sign() const;
00239   virtual int         do_frac_digits()   const;
00240   virtual pattern     do_pos_format()    const;
00241   virtual pattern     do_neg_format()    const;
00242 };
00243 
00244 # endif
00245 
00246 template <class _charT, _STLP_DFL_NON_TYPE_PARAM(bool , _International , false) > class moneypunct_byname {};
00247 
00248 _STLP_TEMPLATE_NULL
00249 class _STLP_CLASS_DECLSPEC moneypunct_byname<char, true> : public moneypunct<char, true> {
00250   friend class _Locale_impl;
00251 public:
00252   typedef money_base::pattern   pattern;
00253   typedef char                  char_type;
00254   typedef string                string_type;
00255 
00256   explicit moneypunct_byname _STLP_PSPEC2(char, true) (const char * __name, size_t __refs = 0);
00257 
00258 protected:
00259   ~moneypunct_byname _STLP_PSPEC2(char, true) ();
00260   virtual char        do_decimal_point() const;
00261   virtual char        do_thousands_sep() const;
00262   virtual string      do_grouping()      const;
00263 
00264   virtual string_type do_curr_symbol()   const;
00265 
00266   virtual string_type do_positive_sign() const;
00267   virtual string_type do_negative_sign() const;
00268   virtual int         do_frac_digits()   const;
00269 
00270 private:
00271   moneypunct_byname _STLP_PSPEC2(char, true) (_Locale_monetary *__monetary);
00272 
00273   typedef moneypunct_byname<char, true> _Self;
00274   //explicitely defined as private to avoid warnings:
00275   moneypunct_byname(_Self const&);
00276   _Self& operator = (_Self const&);
00277 
00278   _Locale_monetary* _M_monetary;
00279 };
00280 
00281 _STLP_TEMPLATE_NULL
00282 class _STLP_CLASS_DECLSPEC moneypunct_byname<char, false> : public moneypunct<char, false> {
00283   friend class _Locale_impl;
00284 public:
00285   typedef money_base::pattern   pattern;
00286   typedef char                  char_type;
00287   typedef string                string_type;
00288 
00289   explicit moneypunct_byname _STLP_PSPEC2(char, false) (const char * __name, size_t __refs = 0);
00290 
00291 protected:
00292   ~moneypunct_byname _STLP_PSPEC2(char, false) ();
00293   virtual char        do_decimal_point() const;
00294   virtual char        do_thousands_sep() const;
00295   virtual string      do_grouping()      const;
00296 
00297   virtual string_type do_curr_symbol()   const;
00298 
00299   virtual string_type do_positive_sign() const;
00300   virtual string_type do_negative_sign() const;
00301   virtual int         do_frac_digits()   const;
00302 
00303 private:
00304   moneypunct_byname _STLP_PSPEC2(char, false) (_Locale_monetary *__monetary);
00305 
00306   typedef moneypunct_byname<char, false> _Self;
00307   //explicitely defined as private to avoid warnings:
00308   moneypunct_byname(_Self const&);
00309   _Self& operator = (_Self const&);
00310 
00311   _Locale_monetary* _M_monetary;
00312 };
00313 
00314 #if !defined (_STLP_NO_WCHAR_T)
00315 _STLP_TEMPLATE_NULL
00316 class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, true> : public moneypunct<wchar_t, true> {
00317   friend class _Locale_impl;
00318 public:
00319   typedef money_base::pattern   pattern;
00320   typedef wchar_t               char_type;
00321   typedef wstring               string_type;
00322 
00323   explicit moneypunct_byname _STLP_PSPEC2(wchar_t, true) (const char * __name, size_t __refs = 0);
00324 
00325 protected:
00326   ~moneypunct_byname _STLP_PSPEC2(wchar_t, true) ();
00327   virtual wchar_t     do_decimal_point() const;
00328   virtual wchar_t     do_thousands_sep() const;
00329   virtual string      do_grouping()      const;
00330 
00331   virtual string_type do_curr_symbol()   const;
00332 
00333   virtual string_type do_positive_sign() const;
00334   virtual string_type do_negative_sign() const;
00335   virtual int         do_frac_digits()   const;
00336 
00337 private:
00338   moneypunct_byname _STLP_PSPEC2(wchar_t, true) (_Locale_monetary *__monetary);
00339 
00340   typedef moneypunct_byname<wchar_t, true> _Self;
00341   //explicitely defined as private to avoid warnings:
00342   moneypunct_byname(_Self const&);
00343   _Self& operator = (_Self const&);
00344 
00345   _Locale_monetary* _M_monetary;
00346 };
00347 
00348 _STLP_TEMPLATE_NULL
00349 class _STLP_CLASS_DECLSPEC moneypunct_byname<wchar_t, false> : public moneypunct<wchar_t, false> {
00350   friend class _Locale_impl;
00351 public:
00352   typedef money_base::pattern   pattern;
00353   typedef wchar_t               char_type;
00354   typedef wstring               string_type;
00355 
00356   explicit moneypunct_byname _STLP_PSPEC2(wchar_t, false) (const char * __name, size_t __refs = 0);
00357 
00358 protected:
00359   ~moneypunct_byname _STLP_PSPEC2(wchar_t, false) ();
00360   virtual wchar_t     do_decimal_point() const;
00361   virtual wchar_t     do_thousands_sep() const;
00362   virtual string      do_grouping()      const;
00363 
00364   virtual string_type do_curr_symbol()   const;
00365 
00366   virtual string_type do_positive_sign() const;
00367   virtual string_type do_negative_sign() const;
00368   virtual int         do_frac_digits()   const;
00369 
00370 private:
00371   moneypunct_byname _STLP_PSPEC2(wchar_t, false) (_Locale_monetary *__monetary);
00372 
00373   typedef moneypunct_byname<wchar_t, false> _Self;
00374   //explicitely defined as private to avoid warnings:
00375   moneypunct_byname(_Self const&);
00376   _Self& operator = (_Self const&);
00377 
00378   _Locale_monetary* _M_monetary;
00379 };
00380 #endif
00381 
00382 //===== methods ======
00383 
00384 
00385 // money_put facets
00386 
00387 template <class _CharT, class _OutputIter>
00388 class money_put : public locale::facet {
00389 public:
00390   typedef _CharT               char_type;
00391   typedef _OutputIter          iter_type;
00392   typedef basic_string<_CharT, char_traits<_CharT>, allocator<_CharT> > string_type;
00393 
00394   explicit money_put(size_t __refs = 0) : locale::facet(__refs) {}
00395   iter_type put(iter_type __s, bool __intl, ios_base& __str,
00396                 char_type  __fill, _STLP_LONGEST_FLOAT_TYPE __units) const
00397     { return do_put(__s, __intl, __str, __fill, __units); }
00398   iter_type put(iter_type __s, bool __intl, ios_base& __str,
00399                 char_type  __fill,
00400                 const string_type& __digits) const
00401     { return do_put(__s, __intl, __str, __fill, __digits); }
00402 
00403   static locale::id id;
00404 
00405 protected:
00406   ~money_put() {}
00407   virtual iter_type do_put(iter_type __s, bool  __intl, ios_base&  __str,
00408                            char_type __fill, _STLP_LONGEST_FLOAT_TYPE __units) const;
00409   virtual iter_type do_put(iter_type __s, bool  __intl, ios_base&  __str,
00410                            char_type __fill,
00411                            const string_type& __digits) const;
00412 };
00413 
00414 #if defined (_STLP_USE_TEMPLATE_EXPORT)
00415 _STLP_EXPORT_TEMPLATE_CLASS money_get<char, istreambuf_iterator<char, char_traits<char> > >;
00416 _STLP_EXPORT_TEMPLATE_CLASS money_put<char, ostreambuf_iterator<char, char_traits<char> > >;
00417 #  if ! defined (_STLP_NO_WCHAR_T)
00418 _STLP_EXPORT_TEMPLATE_CLASS money_get<wchar_t, istreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
00419 _STLP_EXPORT_TEMPLATE_CLASS money_put<wchar_t, ostreambuf_iterator<wchar_t, char_traits<wchar_t> > >;
00420 #  endif
00421 #endif
00422 
00423 _STLP_END_NAMESPACE
00424 
00425 #if defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
00426 #  include <stl/_monetary.c>
00427 #endif
00428 
00429 #endif /* _STLP_INTERNAL_MONETARY_H */
00430 
00431 // Local Variables:
00432 // mode:C++
00433 // End:
00434 
00435 

Generated on Sat May 26 2012 04:27:53 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.