Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
2.6 KiB

  1. // wlocale -- class locale wide member functions
  2. #include <istream>
  3. #include <locale>
  4. _STD_BEGIN
  5. typedef char_traits<wchar_t> _Wtraits;
  6. typedef istreambuf_iterator<wchar_t, _Wtraits> _Winiter;
  7. typedef ostreambuf_iterator<wchar_t, _Wtraits> _Woutiter;
  8. // facets associated with C categories
  9. #define ADDFAC(T, cat, pi, pl) \
  10. if ((_CATMASK(T::_Getcat()) & cat) == 0) \
  11. ; \
  12. else if (pl == 0) \
  13. pi->_Addfac(new T(_Lobj), T::id); \
  14. else \
  15. pi->_Addfac((locale::facet *)&_USE(*pl, T), T::id);
  16. typedef ctype<wchar_t> _Tw1;
  17. typedef num_get<wchar_t, _Winiter> _Tw2;
  18. typedef num_put<wchar_t, _Woutiter> _Tw3;
  19. typedef numpunct<wchar_t> _Tw4;
  20. typedef collate<wchar_t> _Tw5;
  21. typedef messages<wchar_t> _Tw6;
  22. typedef money_get<wchar_t, _Winiter> _Tw7;
  23. typedef money_put<wchar_t, _Woutiter> _Tw9;
  24. typedef moneypunct<wchar_t, false> _Tw11;
  25. typedef moneypunct<wchar_t, true> _Tw12;
  26. typedef time_get<wchar_t, _Winiter> _Tw13;
  27. typedef time_put<wchar_t, _Woutiter> _Tw14;
  28. typedef codecvt<wchar_t, char, mbstate_t> _Twc1;
  29. template<> locale::id ctype<wchar_t>::id;
  30. template<> locale::id codecvt<wchar_t, char, mbstate_t>::id;
  31. template<> locale::id time_put<wchar_t, _Woutiter>::id;
  32. template<> locale::id num_get<wchar_t, _Winiter>::id;
  33. template<> locale::id num_put<wchar_t, _Woutiter>::id;
  34. template<> locale::id numpunct<wchar_t>::id;
  35. template<> locale::id collate<wchar_t>::id;
  36. template<> locale::id messages<wchar_t>::id;
  37. template<> locale::id money_get<wchar_t, _Winiter>::id;
  38. template<> locale::id money_put<wchar_t, _Woutiter>::id;
  39. template<> locale::id moneypunct<wchar_t, false>::id;
  40. template<> locale::id moneypunct<wchar_t, true>::id;
  41. template<> locale::id time_get<wchar_t, _Winiter>::id;
  42. void __cdecl locale::_Locimp::_Makewloc(const _Locinfo& _Lobj,
  43. locale::category _C, _Locimp *_Pi, const locale *_Pl)
  44. { // setup wide part of a new locale
  45. _Lockit lk;
  46. ADDFAC(_Tw1, _C, _Pi, _Pl);
  47. ADDFAC(_Tw2, _C, _Pi, _Pl);
  48. ADDFAC(_Tw3, _C, _Pi, _Pl);
  49. ADDFAC(_Tw4, _C, _Pi, _Pl);
  50. ADDFAC(_Tw5, _C, _Pi, _Pl);
  51. ADDFAC(_Tw6, _C, _Pi, _Pl);
  52. ADDFAC(_Tw7, _C, _Pi, _Pl);
  53. ADDFAC(_Tw9, _C, _Pi, _Pl);
  54. ADDFAC(_Tw11, _C, _Pi, _Pl);
  55. ADDFAC(_Tw12, _C, _Pi, _Pl);
  56. ADDFAC(_Tw13, _C, _Pi, _Pl);
  57. ADDFAC(_Tw14, _C, _Pi, _Pl);
  58. //...
  59. ADDFAC(_Twc1, _C, _Pi, _Pl);
  60. }
  61. _STD_END
  62. /*
  63. * Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
  64. * Consult your license regarding permissions and restrictions.
  65. */