29 #ifndef _ID3LIB_STRINGS_H_
30 #define _ID3LIB_STRINGS_H_
35 #if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000))
39 struct char_traits<unsigned char>
41 typedef unsigned char char_type;
43 typedef unsigned long int_type;
44 typedef streampos pos_type;
45 typedef streamoff off_type;
46 typedef mbstate_t state_type;
49 assign(char_type& __c1,
const char_type& __c2)
53 eq(
const char_type& __c1,
const char_type& __c2)
54 {
return __c1 == __c2; }
57 lt(
const char_type& __c1,
const char_type& __c2)
58 {
return __c1 < __c2; }
61 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
63 for (
size_t __i = 0; __i < __n; ++__i)
64 if (!eq(__s1[__i], __s2[__i]))
65 return lt(__s1[__i], __s2[__i]) ? -1 : 1;
70 length(
const char_type* __s)
72 const char_type* __p = __s;
78 static const char_type*
79 find(
const char_type* __s,
size_t __n,
const char_type& __a)
81 for (
const char_type* __p = __s; size_t(__p - __s) < __n; ++__p)
82 if (*__p == __a)
return __p;
87 move(char_type* __s1,
const char_type* __s2,
size_t __n)
88 {
return (char_type*) memmove(__s1, __s2, __n *
sizeof(char_type)); }
91 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
92 {
return (char_type*) memcpy(__s1, __s2, __n *
sizeof(char_type)); }
95 assign(char_type* __s,
size_t __n, char_type __a)
97 for (char_type* __p = __s; __p < __s + __n; ++__p)
103 to_char_type(
const int_type& __c)
104 {
return char_type(); }
107 to_int_type(
const char_type& __c) {
return int_type(); }
110 eq_int_type(
const int_type& __c1,
const int_type& __c2)
111 {
return __c1 == __c2; }
114 eof() {
return static_cast<int_type
>(-1); }
117 not_eof(
const int_type& __c)
118 {
return eq_int_type(__c, eof()) ? int_type(0) : __c; }
121 #ifndef _GLIBCPP_USE_WCHAR_T
122 #if (defined(ID3_NEED_WCHAR_TEMPLATE))
124 struct char_traits<wchar_t>
126 typedef wchar_t char_type;
127 typedef wint_t int_type;
128 typedef streamoff off_type;
129 typedef streampos pos_type;
130 typedef mbstate_t state_type;
133 assign(char_type& __c1,
const char_type& __c2)
137 eq(
const char_type& __c1,
const char_type& __c2)
138 {
return __c1 == __c2; }
141 lt(
const char_type& __c1,
const char_type& __c2)
142 {
return __c1 < __c2; }
145 compare(
const char_type* __s1,
const char_type* __s2,
size_t __n)
146 {
return wmemcmp(__s1, __s2, __n); }
149 length(
const char_type* __s)
150 {
return wcslen(__s); }
152 static const char_type*
153 find(
const char_type* __s,
size_t __n,
const char_type& __a)
154 {
return wmemchr(__s, __a, __n); }
157 move(char_type* __s1,
const char_type* __s2, int_type __n)
158 {
return wmemmove(__s1, __s2, __n); }
161 copy(char_type* __s1,
const char_type* __s2,
size_t __n)
162 {
return wmemcpy(__s1, __s2, __n); }
165 assign(char_type* __s,
size_t __n, char_type __a)
166 {
return wmemset(__s, __a, __n); }
169 to_char_type(
const int_type& __c) {
return char_type(__c); }
172 to_int_type(
const char_type& __c) {
return int_type(__c); }
175 eq_int_type(
const int_type& __c1,
const int_type& __c2)
176 {
return __c1 == __c2; }
179 _S_get_state(
const pos_type& __pos) {
return __pos.state(); }
182 eof() {
return static_cast<int_type
>(WEOF); }
185 _S_eos() {
return char_type(); }
188 not_eof(
const int_type& __c)
189 {
return eq_int_type(__c, eof()) ? 0 : __c; }
199 typedef std::basic_string<unsigned char>
BString;