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