3 // Copyright (C) 1999, 2000, 2002, 2003 Free Software Foundation
5 // This file is part of the GNU ISO C++ Library. This library is free
6 // software; you can redistribute it and/or modify it under the
7 // terms of the GNU General Public License as published by the
8 // Free Software Foundation; either version 2, or (at your option)
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License along
17 // with this library; see the file COPYING. If not, write to the Free
18 // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
21 // 27.6.2.5.4 basic_ostream character inserters
27 #include <testsuite_hooks.h>
29 // Global counter, needs to be reset after use.
32 class gnu_ctype
: public std::ctype
<wchar_t>
36 do_widen(char c
) const
39 return std::ctype
<wchar_t>::do_widen(c
);
43 do_widen(const char* low
, const char* high
, char_type
* dest
) const
46 return std::ctype
<wchar_t>::do_widen(low
, high
, dest
);
50 // 27.6.2.5.4 - Character inserter template functions
51 // [lib.ostream.inserters.character]
55 bool test
__attribute__((unused
)) = true;
57 const char* buffer
= "SFPL 5th floor, outside carrol, the Asian side";
60 oss
.imbue(locale(locale::classic(), new gnu_ctype
));
63 // template<class charT, class traits>
64 // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
68 VERIFY( used
); // Only required for char_type != char
69 wstring str
= oss
.str();
70 wchar_t c1
= oss
.widen(buffer
[0]);
71 VERIFY( str
[0] == c1
);
72 wchar_t c2
= oss
.widen(buffer
[1]);
73 VERIFY( str
[1] == c2
);
76 // template<class charT, class traits>
77 // basic_ostream<charT,traits>& operator<<(basic_ostream<charT,traits>& out,
82 VERIFY( used
); // Only required for char_type != char
84 wchar_t c3
= oss
.widen('b');
85 VERIFY( str
[0] == c3
);