Source code of Windows XP (NT5)
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.

111 lines
3.8 KiB

  1. // wlocale -- class locale wide member functions
  2. #include <istream>
  3. #include <locale>
  4. #include <xdebug>
  5. _STD_BEGIN
  6. #pragma warning(disable: 4786)
  7. typedef char_traits<wchar_t> _Wtraits;
  8. typedef istreambuf_iterator<wchar_t, _Wtraits> _Winiter;
  9. typedef ostreambuf_iterator<wchar_t, _Wtraits> _Woutiter;
  10. // facets associated with C categories
  11. #define ADDFAC(Facet, cat, ptrimp, ptrloc) \
  12. if ((_CATMASK(Facet::_Getcat()) & cat) == 0) \
  13. ; \
  14. else if (ptrloc == 0) \
  15. ptrimp->_Addfac(_NEW_CRT Facet(lobj), Facet::id); \
  16. else \
  17. ptrimp->_Addfac((locale::facet *)&_USE(*ptrloc, Facet), Facet::id);
  18. // moved from locale to ease subsetting
  19. typedef ctype<wchar_t> _Tw1;
  20. typedef num_get<wchar_t, _Winiter> _Tw2;
  21. typedef num_put<wchar_t, _Woutiter> _Tw3;
  22. typedef numpunct<wchar_t> _Tw4;
  23. typedef collate<wchar_t> _Tw5;
  24. typedef messages<wchar_t> _Tw6;
  25. typedef money_get<wchar_t, _Winiter> _Tw7;
  26. typedef money_put<wchar_t, _Woutiter> _Tw9;
  27. typedef moneypunct<wchar_t, false> _Tw11;
  28. typedef moneypunct<wchar_t, true> _Tw12;
  29. typedef time_get<wchar_t, _Winiter> _Tw13;
  30. typedef time_put<wchar_t, _Woutiter> _Tw14;
  31. //....
  32. typedef codecvt<wchar_t, char, mbstate_t> _Twc1;
  33. _TEMPLATE_STAT locale::id ctype<wchar_t>::id;
  34. _TEMPLATE_STAT locale::id codecvt<wchar_t, char, mbstate_t>::id;
  35. _TEMPLATE_STAT locale::id time_put<wchar_t>::id;
  36. void __cdecl locale::_Locimp::_Makewloc(const _Locinfo& lobj,
  37. locale::category cat, _Locimp *ptrimp, const locale *ptrloc)
  38. { // setup wide part of a new locale
  39. ADDFAC(_Tw1, cat, ptrimp, ptrloc);
  40. ADDFAC(_Tw2, cat, ptrimp, ptrloc);
  41. ADDFAC(_Tw3, cat, ptrimp, ptrloc);
  42. ADDFAC(_Tw4, cat, ptrimp, ptrloc);
  43. ADDFAC(_Tw5, cat, ptrimp, ptrloc);
  44. ADDFAC(_Tw6, cat, ptrimp, ptrloc);
  45. ADDFAC(_Tw7, cat, ptrimp, ptrloc);
  46. ADDFAC(_Tw9, cat, ptrimp, ptrloc);
  47. ADDFAC(_Tw11, cat, ptrimp, ptrloc);
  48. ADDFAC(_Tw12, cat, ptrimp, ptrloc);
  49. ADDFAC(_Tw13, cat, ptrimp, ptrloc);
  50. ADDFAC(_Tw14, cat, ptrimp, ptrloc);
  51. //...
  52. ADDFAC(_Twc1, cat, ptrimp, ptrloc);
  53. }
  54. #ifdef _NATIVE_WCHAR_T_DEFINED
  55. typedef char_traits<unsigned short> _UShtraits;
  56. typedef istreambuf_iterator<unsigned short, _UShtraits> _UShiniter;
  57. typedef ostreambuf_iterator<unsigned short, _UShtraits> _UShoutiter;
  58. // moved from locale to ease subsetting
  59. typedef ctype<unsigned short> _Tush1;
  60. typedef num_get<unsigned short, _UShiniter> _Tush2;
  61. typedef num_put<unsigned short, _UShoutiter> _Tush3;
  62. typedef numpunct<unsigned short> _Tush4;
  63. typedef collate<unsigned short> _Tush5;
  64. typedef messages<unsigned short> _Tush6;
  65. typedef money_get<unsigned short, _UShiniter> _Tush7;
  66. typedef money_put<unsigned short, _UShoutiter> _Tush9;
  67. typedef moneypunct<unsigned short, false> _Tush11;
  68. typedef moneypunct<unsigned short, true> _Tush12;
  69. typedef time_get<unsigned short, _UShiniter> _Tush13;
  70. typedef time_put<unsigned short, _UShoutiter> _Tush14;
  71. //....
  72. typedef codecvt<unsigned short, char, mbstate_t> _Tushc1;
  73. _TEMPLATE_STAT locale::id ctype<unsigned short>::id;
  74. _TEMPLATE_STAT locale::id codecvt<unsigned short, char, mbstate_t>::id;
  75. _TEMPLATE_STAT locale::id time_put<unsigned short>::id;
  76. void __cdecl locale::_Locimp::_Makeushloc(const _Locinfo& lobj,
  77. locale::category cat, _Locimp *ptrimp, const locale *ptrloc)
  78. { // setup wide part of a new locale
  79. ADDFAC(_Tush1, cat, ptrimp, ptrloc);
  80. ADDFAC(_Tush2, cat, ptrimp, ptrloc);
  81. ADDFAC(_Tush3, cat, ptrimp, ptrloc);
  82. ADDFAC(_Tush4, cat, ptrimp, ptrloc);
  83. ADDFAC(_Tush5, cat, ptrimp, ptrloc);
  84. ADDFAC(_Tush6, cat, ptrimp, ptrloc);
  85. ADDFAC(_Tush7, cat, ptrimp, ptrloc);
  86. ADDFAC(_Tush9, cat, ptrimp, ptrloc);
  87. ADDFAC(_Tush11, cat, ptrimp, ptrloc);
  88. ADDFAC(_Tush12, cat, ptrimp, ptrloc);
  89. ADDFAC(_Tush13, cat, ptrimp, ptrloc);
  90. ADDFAC(_Tush14, cat, ptrimp, ptrloc);
  91. //...
  92. ADDFAC(_Tushc1, cat, ptrimp, ptrloc);
  93. }
  94. #endif
  95. _STD_END
  96. /*
  97. * Copyright (c) 1992-2001 by P.J. Plauger. ALL RIGHTS RESERVED.
  98. * Consult your license regarding permissions and restrictions.
  99. V3.10:0009 */