1 // Copyright (C) 2003, 2009 Free Software Foundation, Inc.
3 // This file is part of the GNU ISO C++ Library. This library is free
4 // software; you can redistribute it and/or modify it under the
5 // terms of the GNU General Public License as published by the
6 // Free Software Foundation; either version 3, or (at your option)
9 // This library is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License along
15 // with this library; see the file COPYING3. If not see
16 // <http://www.gnu.org/licenses/>.
18 // 27.8.1.4 Overridden virtual functions
22 typedef unsigned char Char;
27 class codecvt<Char, char, mbstate_t> :
28 public locale::facet, public codecvt_base
31 typedef Char intern_type;
32 typedef char extern_type;
33 typedef mbstate_t state_type;
35 explicit codecvt(size_t refs = 0)
36 : locale::facet(refs) { }
37 result out(mbstate_t& state, const Char* from,
38 const Char* from_end, const Char*& from_next,
39 char* to, char* to_limit, char*& to_next) const
41 return do_out(state, from, from_end, from_next,
42 to, to_limit, to_next);
44 result in(mbstate_t& state, const char* from,
45 const char* from_end, const char*& from_next,
46 Char* to, Char* to_limit, Char*& to_next) const
48 return do_in(state, from, from_end, from_next,
49 to, to_limit, to_next);
51 result unshift(mbstate_t& state, char* to, char* to_end,
53 { return do_unshift(state, to, to_end, to_next); }
54 int length(mbstate_t& state, const char* from,
55 const char* from_end, size_t max) const
56 { return do_length(state, from, from_end, max); }
57 int encoding() const throw()
58 { return do_encoding(); }
59 bool always_noconv() const throw()
60 { return do_always_noconv(); }
61 int max_length() const throw()
62 { return do_max_length(); }
67 virtual result do_out(mbstate_t&, const Char*,
72 virtual result do_in(mbstate_t&, const char*,
77 virtual result do_unshift(mbstate_t&, char*, char*,
80 virtual int do_length(mbstate_t&, const char*,
81 const char*, size_t) const
83 virtual int do_encoding() const throw()
85 virtual bool do_always_noconv() const throw()
87 virtual int do_max_length() const throw()
91 locale::id codecvt<Char, char, mbstate_t>::id;
98 bool test __attribute__((unused)) = true;
100 locale loc(locale::classic(),
101 new codecvt<Char, char, std::mbstate_t>);
104 basic_filebuf<Char, char_traits<Char> > fb;
106 loc = locale::classic();
110 fb.open("tmp_12206", ios_base::out);
113 fb.pubseekoff(0, ios_base::cur);
115 catch (std::exception&)