3 // Utility subroutines for the C++ library testsuite.
5 // Copyright (C) 2002, 2003, 2004, 2005, 2009 Free Software Foundation, Inc.
7 // This file is part of the GNU ISO C++ Library. This library is free
8 // software; you can redistribute it and/or modify it under the
9 // terms of the GNU General Public License as published by the
10 // Free Software Foundation; either version 3, or (at your option)
13 // This library is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License along
19 // with this library; see the file COPYING3. If not see
20 // <http://www.gnu.org/licenses/>.
23 #include <testsuite_character.h>
28 codecvt<__gnu_test::pod_uchar, char, __gnu_test::pod_state>::id;
31 ctype<__gnu_test::pod_uchar>::id;
34 numpunct<__gnu_test::pod_uint>::id;
37 moneypunct<__gnu_test::pod_uint>::id;
39 // Member specializations for the existing facet classes.
40 // NB: This isn't especially portable. Perhaps a better way would be
41 // to just specialize all of numpunct and ctype.
42 using __gnu_test::pod_ushort;
43 typedef pod_ushort::value_type value_type;
48 do_is(mask, char_type) const { return true; }
53 do_is(const char_type* __lo, const char_type*, mask*) const
59 do_scan_is(mask, const char_type* __lo, const char_type*) const
65 do_scan_not(mask, const char_type* __lo, const char_type*) const
71 do_toupper(char_type __c) const
77 do_toupper(char_type*, const char_type* __hi) const
83 do_tolower(char_type __c) const
89 do_tolower(char_type*, const char_type* __hi) const
95 do_widen(char __c) const
97 char_type ret = { value_type(__c) };
104 do_widen(const char* __lo, const char* __hi, char_type* __dest) const
108 *__dest = this->do_widen(*__lo);
118 do_narrow(char_type __wc, char) const
119 { return static_cast<char>(__wc.value); }
124 do_narrow(const pod_ushort* __lo, const pod_ushort* __hi,
125 char, char* __dest) const
129 *__dest = this->do_narrow(*__lo, char());
137 ctype<pod_ushort>::~ctype() { }
141 numpunct<pod_ushort>::_M_initialize_numpunct(__c_locale)
144 _M_data = new __numpunct_cache<pod_ushort>;
146 _M_data->_M_grouping = "";
147 _M_data->_M_use_grouping = false;
149 _M_data->_M_decimal_point.value = value_type('.');
150 _M_data->_M_thousands_sep.value = value_type(',');
152 for (size_t i = 0; i < __num_base::_S_oend; ++i)
154 value_type v = __num_base::_S_atoms_out[i];
155 _M_data->_M_atoms_out[i].value = v;
157 _M_data->_M_atoms_out[__num_base::_S_oend] = pod_ushort();
159 for (size_t j = 0; j < __num_base::_S_iend; ++j)
160 _M_data->_M_atoms_in[j].value = value_type(__num_base::_S_atoms_in[j]);
161 _M_data->_M_atoms_in[__num_base::_S_iend] = pod_ushort();
164 pod_ushort* __truename = new pod_ushort[4 + 1];
165 __truename[0].value = value_type('t');
166 __truename[1].value = value_type('r');
167 __truename[2].value = value_type('u');
168 __truename[3].value = value_type('e');
169 __truename[4] = pod_ushort();
170 _M_data->_M_truename = __truename;
173 pod_ushort* __falsename = new pod_ushort[5 + 1];
174 __falsename[0].value = value_type('f');
175 __falsename[1].value = value_type('a');
176 __falsename[2].value = value_type('l');
177 __falsename[3].value = value_type('s');
178 __falsename[4].value = value_type('e');
179 __falsename[5] = pod_ushort();
180 _M_data->_M_falsename = __falsename;
184 numpunct<pod_ushort>::~numpunct()