Lines 30-35
Link Here
|
30 |
|
30 |
|
31 |
#include <string> |
31 |
#include <string> |
32 |
|
32 |
|
|
|
33 |
#if (defined(__GNUC__) && (__GNUC__ >= 3) || (defined(_MSC_VER) && _MSC_VER > 1000)) |
34 |
namespace std |
35 |
{ |
36 |
template<> |
37 |
struct char_traits<unsigned char> |
38 |
{ |
39 |
typedef unsigned char char_type; |
40 |
// Unsigned as wint_t in unsigned. |
41 |
typedef unsigned long int_type; |
42 |
typedef streampos pos_type; |
43 |
typedef streamoff off_type; |
44 |
typedef mbstate_t state_type; |
45 |
|
46 |
static void |
47 |
assign(char_type& __c1, const char_type& __c2) |
48 |
{ __c1 = __c2; } |
49 |
|
50 |
static bool |
51 |
eq(const char_type& __c1, const char_type& __c2) |
52 |
{ return __c1 == __c2; } |
53 |
|
54 |
static bool |
55 |
lt(const char_type& __c1, const char_type& __c2) |
56 |
{ return __c1 < __c2; } |
57 |
|
58 |
static int |
59 |
compare(const char_type* __s1, const char_type* __s2, size_t __n) |
60 |
{ |
61 |
for (size_t __i = 0; __i < __n; ++__i) |
62 |
if (!eq(__s1[__i], __s2[__i])) |
63 |
return lt(__s1[__i], __s2[__i]) ? -1 : 1; |
64 |
return 0; |
65 |
} |
66 |
|
67 |
static size_t |
68 |
length(const char_type* __s) |
69 |
{ |
70 |
const char_type* __p = __s; |
71 |
while (__p) |
72 |
++__p; |
73 |
return (__p - __s); |
74 |
} |
75 |
|
76 |
static const char_type* |
77 |
find(const char_type* __s, size_t __n, const char_type& __a) |
78 |
{ |
79 |
for (const char_type* __p = __s; size_t(__p - __s) < __n; ++__p) |
80 |
if (*__p == __a) return __p; |
81 |
return 0; |
82 |
} |
83 |
|
84 |
static char_type* |
85 |
move(char_type* __s1, const char_type* __s2, size_t __n) |
86 |
{ return (char_type*) memmove(__s1, __s2, __n * sizeof(char_type)); } |
87 |
|
88 |
static char_type* |
89 |
copy(char_type* __s1, const char_type* __s2, size_t __n) |
90 |
{ return (char_type*) memcpy(__s1, __s2, __n * sizeof(char_type)); } |
91 |
|
92 |
static char_type* |
93 |
assign(char_type* __s, size_t __n, char_type __a) |
94 |
{ |
95 |
for (char_type* __p = __s; __p < __s + __n; ++__p) |
96 |
assign(*__p, __a); |
97 |
return __s; |
98 |
} |
99 |
|
100 |
static char_type |
101 |
to_char_type(const int_type& __c) |
102 |
{ return char_type(); } |
103 |
|
104 |
static int_type |
105 |
to_int_type(const char_type& __c) { return int_type(); } |
106 |
|
107 |
static bool |
108 |
eq_int_type(const int_type& __c1, const int_type& __c2) |
109 |
{ return __c1 == __c2; } |
110 |
|
111 |
static int_type |
112 |
eof() { return static_cast<int_type>(-1); } |
113 |
|
114 |
static int_type |
115 |
not_eof(const int_type& __c) |
116 |
{ return eq_int_type(__c, eof()) ? int_type(0) : __c; } |
117 |
}; |
118 |
} // namespace std |
119 |
#endif |
120 |
|
33 |
namespace dami |
121 |
namespace dami |
34 |
{ |
122 |
{ |
35 |
typedef std::basic_string<char> String; |
123 |
typedef std::basic_string<char> String; |