annotate lib/swig/swigwin-2.0.11/Lib/std/std_char_traits.i @ 1899:b3009adc0e2f

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