1 // 2000-08-31 Benjamin Kosnik <bkoz@redhat.com>
3 // Copyright (C) 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, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21 // 22.1.1.1.2 - class locale::facet [lib.locale.facet]
23 #include <cwchar> // for mbstate_t
29 #include <testsuite_hooks.h>
31 // 1 a class if a facet if it is publicly derived from another facet
32 typedef std::istreambuf_iterator
<char> input_iterator
;
33 typedef std::ostreambuf_iterator
<char> output_iterator
;
35 class gnu_collate
: public std::collate
<char> { };
36 class gnu_ctype
: public std::ctype
<char> { };
37 class gnu_codecvt
: public std::codecvt
<char, char, std::mbstate_t> { };
38 class gnu_moneypunct
: public std::moneypunct
<char> { };
39 class gnu_moneypunct_true
: public std::moneypunct
<char, true> { };
40 class gnu_money_get
: public std::money_get
<char> { };
41 class gnu_money_put
: public std::money_put
<char> { };
42 class gnu_numpunct
: public std::numpunct
<char> { };
43 class gnu_num_get
: public std::num_get
<char> { };
44 class gnu_num_put
: public std::num_put
<char> { };
45 class gnu_time_get
: public std::time_get
<char> { };
46 class gnu_time_put
: public std::time_put
<char> { };
47 class gnu_messages
: public std::messages
<char> { };
49 class gnu_collate_byname
: public std::collate_byname
<char>
53 gnu_collate_byname(const char* c
, size_t refs
= 0)
54 : std::collate_byname
<char>(c
, refs
) { }
57 class gnu_ctype_byname
: public std::ctype_byname
<char>
61 gnu_ctype_byname(const char* c
, size_t refs
= 0)
62 : std::ctype_byname
<char>(c
, refs
) { }
65 class gnu_moneypunct_byname_true
: public std::moneypunct_byname
<char, true>
69 gnu_moneypunct_byname_true(const char* c
, size_t refs
= 0)
70 : std::moneypunct_byname
<char, true>(c
, refs
) { }
73 class gnu_moneypunct_byname_false
: public std::moneypunct_byname
<char, false>
77 gnu_moneypunct_byname_false(const char* c
, size_t refs
= 0)
78 : std::moneypunct_byname
<char, false>(c
, refs
) { }
82 class gnu_money_get_in
: public std::money_get
<char, input_iterator
>
86 gnu_money_get_in(size_t refs
= 0)
87 : std::money_get
<char, input_iterator
>(refs
) { }
90 class gnu_money_put_out
: public std::money_put
<char, output_iterator
>
94 gnu_money_put_out(size_t refs
= 0)
95 : std::money_put
<char, output_iterator
>(refs
) { }
98 class gnu_numpunct_byname
: public std::numpunct_byname
<char>
102 gnu_numpunct_byname(const char* c
, size_t refs
= 0)
103 : std::numpunct_byname
<char>(c
, refs
) { }
106 class gnu_num_get_in
: public std::num_get
<char, input_iterator
>
110 gnu_num_get_in(size_t refs
= 0)
111 : std::num_get
<char, input_iterator
>(refs
) { }
114 class gnu_num_put_out
: public std::num_put
<char, output_iterator
>
118 gnu_num_put_out(size_t refs
= 0)
119 : std::num_put
<char, output_iterator
>(refs
) { }
122 class gnu_time_get_byname
: public std::time_get_byname
<char>
126 gnu_time_get_byname(const char* c
, size_t refs
= 0)
127 : std::time_get_byname
<char>(c
, refs
) { }
130 class gnu_time_get_in
: public std::time_get
<char, input_iterator
>
134 gnu_time_get_in(size_t refs
= 0)
135 : std::time_get
<char, input_iterator
>(refs
) { }
138 class gnu_time_put_byname
: public std::time_put_byname
<char>
142 gnu_time_put_byname(const char* c
, size_t refs
= 0)
143 : std::time_put_byname
<char>(c
, refs
) { }
146 class gnu_time_put_out
: public std::time_put
<char, output_iterator
>
150 gnu_time_put_out(size_t refs
= 0)
151 : std::time_put
<char, output_iterator
>(refs
) { }
154 class gnu_messages_byname
: public std::messages_byname
<char>
158 gnu_messages_byname(const char* c
, size_t refs
= 0)
159 : std::messages_byname
<char>(c
, refs
) { }
163 // 2 or if it is a class derived from locale:;facet and containing a
164 // publicly-accessible declaration as follows:
165 class gnu_facet
: public std::locale::facet
168 static std::locale::id id
;
171 std::locale::id
gnu_facet::id
;
175 bool test
__attribute__((unused
)) = true;
176 const std::string
name_no("*");
177 const std::string
name_c("C");
184 gnu_moneypunct obj04
;
185 gnu_moneypunct_true obj05
;
194 gnu_time_put_out
obj14(0);
195 gnu_time_put_byname
obj15("C", 0);
196 gnu_time_get_in
obj16(0);
197 gnu_time_get_byname
obj17("C", 0);
198 gnu_num_put_out
obj18(0);
199 gnu_num_get_in
obj19(0);
200 gnu_numpunct_byname
obj20("C", 0);
201 gnu_money_put_out
obj21(0);
202 gnu_money_get_in
obj22(0);
203 gnu_moneypunct_byname_false
obj23("C", 0);
204 gnu_moneypunct_byname_true
obj24("C", 0);
205 gnu_ctype_byname
obj25("C", 0);
206 gnu_collate_byname
obj26("C", 0);
207 gnu_messages_byname
obj27("C", 0);
209 catch (std::runtime_error
& obj
)
211 // named locale not valid
214 catch (std::exception
& obj
)
225 catch (std::runtime_error
& obj
)
227 // named locale not valid
230 catch (std::exception
& obj
)