gcc/libstdc++-v3/testsuite/22_locale/num_get.cc

53 lines
1.5 KiB
C++
Raw Normal View History

Numeric facets cleanup. 2001-11-27 Benjamin Kosnik <bkoz@redhat.com> Numeric facets cleanup. * include/bits/locale_facets.h (__num_base::_S_atoms): Add, remove + and - signs. (__num_base::_M_zero): Add (__num_base::_M_e): Add. (__num_base::_M_E): Add. * include/bits/locale_facets.tcc (num_get::_M_extract): Remove. (num_get::_M_extract_float): New. (num_get::_M_extract_int): New. * src/locale.cc (num_get::_M_extract): Remove. * include/bits/locale_facets.tcc (num_put::_M_insert_float): Simplify, use _M_insert. (num_put::do_put(bool)): Simplify, remove __pad. (__pad): Remove. (__pad_output): Change to __pad. * include/bits/ostream.tcc: And here. * src/locale-inst: Remove instantiations. * include/bits/locale_facets.h: Move helper functions in to class num_put. (num_put::_M_insert_float): Same, for __output_integer. (num_put::_M_insert_int): Same, for __output_float. (num_put::_M_insert): New. (__num_base): Add. (__num_base::_S_format_float): Move __build_float_format into class __num_base. (__num_base::_S_format_int): Move __build_int_format into class __num_base. * include/bits/locale_facets.tcc (__group_digits): Change to (__add_grouping): This. * src/locale-inst.cc: And here. Tweak instantiations. * src/misc-inst.cc: Remove instantiations. * include/bits/ostream.tcc (__pad_char): Rename, adjust inserters for new calling conventions, move to... * include/bits/locale_facets.tcc (__pad_output): Here. Adjust signature to make it useful for both ostream and num_put. (__pad_numeric): Remove. * src/misc-inst.cc: Remove instantiations. * src/locale-inst.cc: Same. * include/bits/locale_facets.h (_Numeric_get): Remove. (_Numeric_put): Remove. (num_get::get(short)): Remove. (num_get::get(int)): Remove. (num_get::do_get(short)): Remove. (num_get::do_get(int)): Remove. * include/bits/istream.tcc (istream::operator>>(short)): Fix as per DR 118. (istream::operator>>(int)): Same. * include/bits/locale_facets.h (_Format_cache): Remove. * include/bits/locale_facets.tcc: Same. * src/locale.cc: Same. * src/locale-inst.cc: Same. * include/bits/ostream.tcc: Same. * src/ios.cc (ios_base::imbue): Remove here as well. * testsuite/22_locale/num_get.cc: New file. * testsuite/22_locale/num_get_members_char.cc: New file. * testsuite/22_locale/num_get_members_wchar_t.cc: New. * testsuite/22_locale/numpunct_members_wchar_t.cc: New file. * testsuite/22_locale/num_put.cc: New file. * testsuite/22_locale/num_put_members_char.cc: New file. * testsuite/22_locale/num_put_members_wchar_t.cc: New file. * testsuite/27_io/ostream_inserter_arith.cc: Fix. * testsuite/27_io/istream_extractor_arith.cc: Fix. From-SVN: r47397
2001-11-28 05:07:11 +01:00
// 2001-11-21 Benjamin Kosnik <bkoz@redhat.com>
// Copyright (C) 2001 Free Software Foundation
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 2, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING. If not, write to the Free
// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307,
// USA.
// 22.2.2.1 Template class num_get
#include <locale>
void test01()
{
// Check for required base class.
typedef std::num_get<char> test_type;
typedef std::locale::facet base_type;
const test_type& obj = std::use_facet<test_type>(std::locale());
const base_type* base = &obj;
// Check for required typedefs
typedef test_type::char_type char_type;
typedef test_type::iter_type iter_type;
}
// Should be able to instantiate this for other types besides char, wchar_t
class gnu_num_get: public std::num_get<unsigned char>
{ };
void test02()
{
gnu_num_get facet01;
}
int main()
{
test01();
test02();
return 0;
}