]>
git.ipfire.org Git - thirdparty/gcc.git/blob - libstdc++-v3/testsuite/27_io/basic_filebuf/imbue/12206.cc
1 // Copyright (C) 2003 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 2, 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 COPYING. If not, write to the Free
16 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
19 // 27.8.1.4 Overridden virtual functions
23 typedef unsigned char Char
;
28 class codecvt
<Char
, char, mbstate_t> :
29 public locale::facet
, public codecvt_base
32 typedef Char intern_type
;
33 typedef char extern_type
;
34 typedef mbstate_t state_type
;
36 explicit codecvt(size_t refs
= 0)
37 : locale::facet(refs
) { }
38 result
out(mbstate_t& state
, const Char
* from
,
39 const Char
* from_end
, const Char
*& from_next
,
40 char* to
, char* to_limit
, char*& to_next
) const
42 return do_out(state
, from
, from_end
, from_next
,
43 to
, to_limit
, to_next
);
45 result
in(mbstate_t& state
, const char* from
,
46 const char* from_end
, const char*& from_next
,
47 Char
* to
, Char
* to_limit
, Char
*& to_next
) const
49 return do_in(state
, from
, from_end
, from_next
,
50 to
, to_limit
, to_next
);
52 result
unshift(mbstate_t& state
, char* to
, char* to_end
,
54 { return do_unshift(state
, to
, to_end
, to_next
); }
55 int length(mbstate_t& state
, const char* from
,
56 const char* from_end
, size_t max
) const
57 { return do_length(state
, from
, from_end
, max
); }
58 int encoding() const throw()
59 { return do_encoding(); }
60 bool always_noconv() const throw()
61 { return do_always_noconv(); }
62 int max_length() const throw()
63 { return do_max_length(); }
68 virtual result
do_out(mbstate_t&, const Char
* from
,
70 const Char
*& from_next
, char* to
,
71 char* to_limit
, char*& to_next
) const
73 virtual result
do_in(mbstate_t&, const char* from
,
75 const char*& from_next
, Char
* to
,
76 Char
* to_limit
, Char
*& to_next
) const
78 virtual result
do_unshift(mbstate_t&, char* to
, char*,
81 virtual int do_length(mbstate_t&, const char* from
,
82 const char* from_end
, size_t max
) const
84 virtual int do_encoding() const throw()
86 virtual bool do_always_noconv() const throw()
88 virtual int do_max_length() const throw()
92 locale::id codecvt
<Char
, char, mbstate_t>::id
;
99 bool test
__attribute__((unused
)) = true;
101 locale
loc(locale::classic(),
102 new codecvt
<Char
, char, std::mbstate_t>);
105 basic_filebuf
<Char
, char_traits
<Char
> > fb
;
107 loc
= locale::classic();
111 fb
.open("tmp_12206", ios_base::out
);
114 fb
.pubseekoff(0, ios_base::cur
);
116 catch (std::exception
&)