home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / stlpt453.zip / STLport-4.5.3 / stlport / stl / _numpunct.h < prev    next >
C/C++ Source or Header  |  2001-01-26  |  5KB  |  171 lines

  1. /*
  2.  * Copyright (c) 1999
  3.  * Silicon Graphics Computer Systems, Inc.
  4.  *
  5.  * Copyright (c) 1999 
  6.  * Boris Fomitchev
  7.  *
  8.  * This material is provided "as is", with absolutely no warranty expressed
  9.  * or implied. Any use is at your own risk.
  10.  *
  11.  * Permission to use or copy this software for any purpose is hereby granted 
  12.  * without fee, provided the above notices are retained on all copies.
  13.  * Permission to modify the code and to distribute modified code is granted,
  14.  * provided the above notices are retained, and a notice that the code was
  15.  * modified is included with the above copyright notice.
  16.  *
  17.  */ 
  18. // WARNING: This is an internal header file, included by other C++
  19. // standard library headers.  You should not attempt to use this header
  20. // file directly.
  21.  
  22.  
  23. #ifndef _STLP_INTERNAL_NUMPUNCT_H
  24. #define _STLP_INTERNAL_NUMPUNCT_H
  25.  
  26. #ifndef _STLP_IOS_BASE_H
  27. # include <stl/_ios_base.h>
  28. #endif
  29.  
  30. # ifndef _STLP_C_LOCALE_H
  31. #  include <stl/c_locale.h>
  32. # endif
  33.  
  34. #ifndef _STLP_STRING_H
  35. # include <stl/_string.h>
  36. #endif
  37.  
  38. _STLP_BEGIN_NAMESPACE
  39.  
  40. //----------------------------------------------------------------------
  41. // numpunct facets
  42.  
  43. template <class _CharT> class numpunct {};
  44. template <class _CharT> class numpunct_byname {};
  45. template <class _Ch, class _InIt> class num_get;
  46.  
  47. _STLP_TEMPLATE_NULL
  48. class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet
  49. {
  50.   friend class _Locale;
  51. # ifndef _STLP_NO_FRIEND_TEMPLATES
  52.   template <class _Ch, class _InIt> friend class num_get;
  53. # endif
  54. public:
  55.   typedef char               char_type;
  56.   typedef string             string_type;
  57.  
  58.   explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
  59.  
  60.   char decimal_point() const { return do_decimal_point(); }
  61.   char thousands_sep() const { return do_thousands_sep(); }
  62.   string grouping() const { return do_grouping(); }
  63.   string truename() const { return do_truename(); }
  64.   string falsename() const { return do_falsename(); }
  65.  
  66.   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
  67.  
  68. # ifndef _STLP_NO_FRIEND_TEMPLATES
  69. protected:
  70. # endif
  71.   ~numpunct();
  72.  
  73.   _STLP_STATIC_MEMBER_DECLSPEC static string  _M_truename;
  74.   _STLP_STATIC_MEMBER_DECLSPEC static string  _M_falsename;
  75.   _STLP_STATIC_MEMBER_DECLSPEC static string  _M_grouping;
  76.  
  77.   virtual char do_decimal_point() const;
  78.   virtual char do_thousands_sep() const;
  79.   virtual string do_grouping() const;
  80.   virtual string do_truename() const;
  81.   virtual string do_falsename()  const;
  82. };
  83.  
  84. # if ! defined (_STLP_NO_WCHAR_T)
  85.  
  86. _STLP_TEMPLATE_NULL
  87. class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet
  88. {
  89.   friend class _Locale;
  90. public:
  91.   typedef wchar_t               char_type;
  92.   typedef wstring               string_type;
  93.  
  94.   explicit numpunct(size_t __refs = 0) : _BaseFacet(__refs) {}
  95.  
  96.   wchar_t decimal_point() const { return do_decimal_point(); }
  97.   wchar_t thousands_sep() const { return do_thousands_sep(); }
  98.   string grouping() const { return do_grouping(); }
  99.   wstring truename() const { return do_truename(); }
  100.   wstring falsename() const { return do_falsename(); }
  101.  
  102.   _STLP_STATIC_MEMBER_DECLSPEC static locale::id id;
  103.  
  104. protected:
  105.   _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_truename;
  106.   _STLP_STATIC_MEMBER_DECLSPEC static wstring _M_falsename;
  107.   _STLP_STATIC_MEMBER_DECLSPEC static string _M_grouping;
  108.  
  109.   ~numpunct();
  110.  
  111.   virtual wchar_t do_decimal_point() const;
  112.   virtual wchar_t do_thousands_sep() const;
  113.   virtual string do_grouping() const;
  114.   virtual wstring do_truename() const;
  115.   virtual wstring do_falsename()  const;
  116. };
  117.  
  118. # endif /* WCHAR_T */
  119.  
  120. _STLP_TEMPLATE_NULL
  121. class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
  122. public:
  123.   typedef char                char_type;
  124.   typedef string              string_type;
  125.  
  126.   explicit numpunct_byname(const char* __name, size_t __refs = 0);
  127.  
  128. protected:
  129.  
  130.   ~numpunct_byname();
  131.  
  132.   virtual char   do_decimal_point() const;
  133.   virtual char   do_thousands_sep() const;
  134.   virtual string do_grouping()      const;
  135.  
  136. private:
  137.   _Locale_numeric* _M_numeric;
  138. };
  139.  
  140. # ifndef _STLP_NO_WCHAR_T
  141. _STLP_TEMPLATE_NULL
  142. class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
  143. public:
  144.   typedef wchar_t               char_type;
  145.   typedef wstring               string_type;
  146.  
  147.   explicit numpunct_byname(const char* __name, size_t __refs = 0);
  148.  
  149. protected:
  150.  
  151.   ~numpunct_byname();
  152.  
  153.   virtual wchar_t   do_decimal_point() const;
  154.   virtual wchar_t   do_thousands_sep() const;
  155.   virtual string do_grouping() const;
  156.  
  157. private:
  158.   _Locale_numeric* _M_numeric;
  159. };
  160.  
  161. # endif /* WCHAR_T */
  162.  
  163. _STLP_END_NAMESPACE
  164.  
  165. #endif /* _STLP_NUMPUNCT_H */
  166.  
  167. // Local Variables:
  168. // mode:C++
  169. // End:
  170.  
  171.