_numpunct.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. #ifndef _STLP_INTERNAL_NUMPUNCT_H
  22. #define _STLP_INTERNAL_NUMPUNCT_H
  23. #ifndef _STLP_IOS_BASE_H
  24. # include <stl/_ios_base.h>
  25. #endif
  26. # ifndef _STLP_C_LOCALE_H
  27. # include <stl/c_locale.h>
  28. # endif
  29. #ifndef _STLP_INTERNAL_STRING_H
  30. # include <stl/_string.h>
  31. #endif
  32. _STLP_BEGIN_NAMESPACE
  33. //----------------------------------------------------------------------
  34. // numpunct facets
  35. template <class _CharT> class numpunct {};
  36. template <class _CharT> class numpunct_byname {};
  37. template <class _Ch, class _InIt> class num_get;
  38. _STLP_TEMPLATE_NULL
  39. class _STLP_CLASS_DECLSPEC numpunct<char> : public locale::facet {
  40. public:
  41. typedef char char_type;
  42. typedef string string_type;
  43. explicit numpunct(size_t __refs = 0)
  44. : locale::facet(__refs) {}
  45. char decimal_point() const { return do_decimal_point(); }
  46. char thousands_sep() const { return do_thousands_sep(); }
  47. string grouping() const { return do_grouping(); }
  48. string truename() const { return do_truename(); }
  49. string falsename() const { return do_falsename(); }
  50. static _STLP_STATIC_DECLSPEC locale::id id;
  51. protected:
  52. ~numpunct();
  53. virtual char do_decimal_point() const;
  54. virtual char do_thousands_sep() const;
  55. virtual string do_grouping() const;
  56. virtual string do_truename() const;
  57. virtual string do_falsename() const;
  58. };
  59. # if ! defined (_STLP_NO_WCHAR_T)
  60. _STLP_TEMPLATE_NULL
  61. class _STLP_CLASS_DECLSPEC numpunct<wchar_t> : public locale::facet {
  62. public:
  63. typedef wchar_t char_type;
  64. typedef wstring string_type;
  65. explicit numpunct(size_t __refs = 0)
  66. : locale::facet(__refs) {}
  67. wchar_t decimal_point() const { return do_decimal_point(); }
  68. wchar_t thousands_sep() const { return do_thousands_sep(); }
  69. string grouping() const { return do_grouping(); }
  70. wstring truename() const { return do_truename(); }
  71. wstring falsename() const { return do_falsename(); }
  72. static _STLP_STATIC_DECLSPEC locale::id id;
  73. protected:
  74. ~numpunct();
  75. virtual wchar_t do_decimal_point() const;
  76. virtual wchar_t do_thousands_sep() const;
  77. virtual string do_grouping() const;
  78. virtual wstring do_truename() const;
  79. virtual wstring do_falsename() const;
  80. };
  81. # endif /* WCHAR_T */
  82. _STLP_TEMPLATE_NULL
  83. class _STLP_CLASS_DECLSPEC numpunct_byname<char> : public numpunct<char> {
  84. friend class _Locale_impl;
  85. public:
  86. typedef char char_type;
  87. typedef string string_type;
  88. explicit numpunct_byname(const char* __name, size_t __refs = 0);
  89. protected:
  90. ~numpunct_byname();
  91. virtual char do_decimal_point() const;
  92. virtual char do_thousands_sep() const;
  93. virtual string do_grouping() const;
  94. virtual string do_truename() const;
  95. virtual string do_falsename() const;
  96. private:
  97. numpunct_byname(_Locale_numeric *__numeric)
  98. : _M_numeric(__numeric) {}
  99. //explicitely defined as private to avoid warnings:
  100. typedef numpunct_byname<char> _Self;
  101. numpunct_byname(_Self const&);
  102. _Self& operator = (_Self const&);
  103. _Locale_numeric* _M_numeric;
  104. };
  105. # ifndef _STLP_NO_WCHAR_T
  106. _STLP_TEMPLATE_NULL
  107. class _STLP_CLASS_DECLSPEC numpunct_byname<wchar_t>: public numpunct<wchar_t> {
  108. friend class _Locale_impl;
  109. public:
  110. typedef wchar_t char_type;
  111. typedef wstring string_type;
  112. explicit numpunct_byname(const char* __name, size_t __refs = 0);
  113. protected:
  114. ~numpunct_byname();
  115. virtual wchar_t do_decimal_point() const;
  116. virtual wchar_t do_thousands_sep() const;
  117. virtual string do_grouping() const;
  118. virtual wstring do_truename() const;
  119. virtual wstring do_falsename() const;
  120. private:
  121. numpunct_byname(_Locale_numeric *__numeric)
  122. : _M_numeric(__numeric) {}
  123. //explicitely defined as private to avoid warnings:
  124. typedef numpunct_byname<wchar_t> _Self;
  125. numpunct_byname(_Self const&);
  126. _Self& operator = (_Self const&);
  127. _Locale_numeric* _M_numeric;
  128. };
  129. # endif /* WCHAR_T */
  130. _STLP_END_NAMESPACE
  131. #endif /* _STLP_NUMPUNCT_H */
  132. // Local Variables:
  133. // mode:C++
  134. // End: