Team Fortress 2 Source Code as on 22/4/2020
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.

140 lines
3.1 KiB

  1. %include <std_common.i>
  2. #if defined(SWIG_WCHAR)
  3. %include <wchar.i>
  4. #endif
  5. namespace std
  6. {
  7. /// 21.1.2 Basis for explicit _Traits specialization
  8. /// NB: That for any given actual character type this definition is
  9. /// probably wrong.
  10. template<class _CharT>
  11. struct char_traits
  12. {
  13. };
  14. /// 21.1.4 char_traits specializations
  15. template<>
  16. struct char_traits<char> {
  17. typedef char char_type;
  18. typedef int int_type;
  19. typedef streampos pos_type;
  20. typedef streamoff off_type;
  21. typedef mbstate_t state_type;
  22. static void
  23. assign(char_type& __c1, const char_type& __c2);
  24. static bool
  25. eq(const char_type& __c1, const char_type& __c2);
  26. static bool
  27. lt(const char_type& __c1, const char_type& __c2);
  28. static int
  29. compare(const char_type* __s1, const char_type* __s2, size_t __n);
  30. static size_t
  31. length(const char_type* __s);
  32. static const char_type*
  33. find(const char_type* __s, size_t __n, const char_type& __a);
  34. static char_type*
  35. move(char_type* __s1, const char_type* __s2, size_t __n);
  36. static char_type*
  37. copy(char_type* __s1, const char_type* __s2, size_t __n);
  38. static char_type*
  39. assign(char_type* __s, size_t __n, char_type __a);
  40. static char_type
  41. to_char_type(const int_type& __c);
  42. // To keep both the byte 0xff and the eof symbol 0xffffffff
  43. // from ending up as 0xffffffff.
  44. static int_type
  45. to_int_type(const char_type& __c);
  46. static bool
  47. eq_int_type(const int_type& __c1, const int_type& __c2);
  48. static int_type
  49. eof() ;
  50. static int_type
  51. not_eof(const int_type& __c);
  52. };
  53. #if defined(SWIG_WCHAR)
  54. template<>
  55. struct char_traits<wchar_t>
  56. {
  57. typedef wchar_t char_type;
  58. typedef wint_t int_type;
  59. typedef streamoff off_type;
  60. typedef wstreampos pos_type;
  61. typedef mbstate_t state_type;
  62. static void
  63. assign(char_type& __c1, const char_type& __c2);
  64. static bool
  65. eq(const char_type& __c1, const char_type& __c2);
  66. static bool
  67. lt(const char_type& __c1, const char_type& __c2);
  68. static int
  69. compare(const char_type* __s1, const char_type* __s2, size_t __n);
  70. static size_t
  71. length(const char_type* __s);
  72. static const char_type*
  73. find(const char_type* __s, size_t __n, const char_type& __a);
  74. static char_type*
  75. move(char_type* __s1, const char_type* __s2, int_type __n);
  76. static char_type*
  77. copy(char_type* __s1, const char_type* __s2, size_t __n);
  78. static char_type*
  79. assign(char_type* __s, size_t __n, char_type __a);
  80. static char_type
  81. to_char_type(const int_type& __c) ;
  82. static int_type
  83. to_int_type(const char_type& __c) ;
  84. static bool
  85. eq_int_type(const int_type& __c1, const int_type& __c2);
  86. static int_type
  87. eof() ;
  88. static int_type
  89. not_eof(const int_type& __c);
  90. };
  91. #endif
  92. }
  93. namespace std {
  94. #ifndef SWIG_STL_WRAP_TRAITS
  95. %template() char_traits<char>;
  96. #if defined(SWIG_WCHAR)
  97. %template() char_traits<wchar_t>;
  98. #endif
  99. #else
  100. %template(char_traits_c) char_traits<char>;
  101. #if defined(SWIG_WCHAR)
  102. %template(char_traits_w) char_traits<wchar_t>;
  103. #endif
  104. #endif
  105. }