mirror of
https://github.com/boostorg/io.git
synced 2025-07-31 12:47:16 +02:00
Replacing the use of <iomanip> with <boost/detail/iomanip.hpp> across Boost.
On Linux, GNU's libstdc++, which is the default stdlib for icc and clang, cannot parse the <iomanip> header in version 4.5+ (which thankfully neither compiler advises the use of yet), as it's original C++98-friendly implementation has been replaced with a gnu++0x implementation. <boost/detail/iomanip.hpp> is a portable implementation of <iomanip>, providing boost::detail::setfill, boost::detail::setbase, boost::detail::setw, boost::detail::setprecision, boost::detail::setiosflags and boost::detail::resetiosflags. [SVN r68140]
This commit is contained in:
@ -16,7 +16,7 @@
|
|||||||
#include <boost/io/ios_state.hpp> // for boost::io::ios_flags_saver, etc.
|
#include <boost/io/ios_state.hpp> // for boost::io::ios_flags_saver, etc.
|
||||||
|
|
||||||
#include <cstddef> // for std::size_t
|
#include <cstddef> // for std::size_t
|
||||||
#include <iomanip> // for std::setw
|
#include <boost/detail/iomanip.hpp> // for boost::detail::setw
|
||||||
#include <ios> // for std::ios_base, std::streamsize, etc.
|
#include <ios> // for std::ios_base, std::streamsize, etc.
|
||||||
#include <iostream> // for std::cout, etc.
|
#include <iostream> // for std::cout, etc.
|
||||||
#include <istream> // for std::istream
|
#include <istream> // for std::istream
|
||||||
@ -143,7 +143,7 @@ saver_tests_1
|
|||||||
{
|
{
|
||||||
using std::locale;
|
using std::locale;
|
||||||
using std::ios_base;
|
using std::ios_base;
|
||||||
using std::setw;
|
using boost::detail::setw;
|
||||||
|
|
||||||
boost::io::ios_flags_saver const ifls( output );
|
boost::io::ios_flags_saver const ifls( output );
|
||||||
boost::io::ios_precision_saver const iprs( output );
|
boost::io::ios_precision_saver const iprs( output );
|
||||||
@ -168,8 +168,8 @@ saver_tests_1
|
|||||||
output.fill( '@' );
|
output.fill( '@' );
|
||||||
output.precision( 9 );
|
output.precision( 9 );
|
||||||
output << '\t' << test_string << '\n';
|
output << '\t' << test_string << '\n';
|
||||||
output << '\t' << setw( 10 ) << test_num1 << '\n';
|
output << '\t' << boost::detail::setw( 10 ) << test_num1 << '\n';
|
||||||
output << '\t' << setw( 15 ) << test_num2 << '\n';
|
output << '\t' << boost::detail::setw( 15 ) << test_num2 << '\n';
|
||||||
output.imbue( loc );
|
output.imbue( loc );
|
||||||
output << '\t' << test_bool << '\n';
|
output << '\t' << test_bool << '\n';
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
#include <boost/test/unit_test.hpp> // for main, BOOST_CHECK, etc.
|
#include <boost/test/unit_test.hpp> // for main, BOOST_CHECK, etc.
|
||||||
|
|
||||||
#include <cstddef> // for NULL
|
#include <cstddef> // for NULL
|
||||||
#include <iomanip> // for std::setiosflags, etc.
|
#include <boost/detail/iomanip.hpp> // for boost::detail::setiosflags, etc.
|
||||||
#include <ios> // for std::ios_base
|
#include <ios> // for std::ios_base
|
||||||
#include <iostream> // for std::cout, std::cerr, etc.
|
#include <iostream> // for std::cout, std::cerr, etc.
|
||||||
#include <istream> // for std::iostream
|
#include <istream> // for std::iostream
|
||||||
@ -77,7 +77,7 @@ ios_flags_saver_unit_test
|
|||||||
BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal),
|
BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal),
|
||||||
ss.flags() );
|
ss.flags() );
|
||||||
|
|
||||||
ss << setiosflags( ios_base::unitbuf );
|
ss << boost::detail::setiosflags( ios_base::unitbuf );
|
||||||
BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal
|
BOOST_CHECK_EQUAL( (ios_base::showbase | ios_base::internal
|
||||||
| ios_base::unitbuf), ss.flags() );
|
| ios_base::unitbuf), ss.flags() );
|
||||||
}
|
}
|
||||||
@ -102,7 +102,7 @@ ios_precision_saver_unit_test
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL( 6, ss.precision() );
|
BOOST_CHECK_EQUAL( 6, ss.precision() );
|
||||||
|
|
||||||
ss << setprecision( 4 );
|
ss << boost::detail::setprecision( 4 );
|
||||||
BOOST_CHECK_EQUAL( 4, ss.precision() );
|
BOOST_CHECK_EQUAL( 4, ss.precision() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ ios_precision_saver_unit_test
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL( 8, ss.precision() );
|
BOOST_CHECK_EQUAL( 8, ss.precision() );
|
||||||
|
|
||||||
ss << setprecision( 10 );
|
ss << boost::detail::setprecision( 10 );
|
||||||
BOOST_CHECK_EQUAL( 10, ss.precision() );
|
BOOST_CHECK_EQUAL( 10, ss.precision() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ ios_width_saver_unit_test
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL( 0, ss.width() );
|
BOOST_CHECK_EQUAL( 0, ss.width() );
|
||||||
|
|
||||||
ss << setw( 4 );
|
ss << boost::detail::setw( 4 );
|
||||||
BOOST_CHECK_EQUAL( 4, ss.width() );
|
BOOST_CHECK_EQUAL( 4, ss.width() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ ios_width_saver_unit_test
|
|||||||
|
|
||||||
BOOST_CHECK_EQUAL( 8, ss.width() );
|
BOOST_CHECK_EQUAL( 8, ss.width() );
|
||||||
|
|
||||||
ss << setw( 10 );
|
ss << boost::detail::setw( 10 );
|
||||||
BOOST_CHECK_EQUAL( 10, ss.width() );
|
BOOST_CHECK_EQUAL( 10, ss.width() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -507,7 +507,7 @@ ios_base_all_saver_unit_test
|
|||||||
BOOST_CHECK_EQUAL( 6, ss.precision() );
|
BOOST_CHECK_EQUAL( 6, ss.precision() );
|
||||||
BOOST_CHECK_EQUAL( 0, ss.width() );
|
BOOST_CHECK_EQUAL( 0, ss.width() );
|
||||||
|
|
||||||
ss << hex << unitbuf << setprecision( 5 ) << setw( 7 );
|
ss << hex << unitbuf << boost::detail::setprecision( 5 ) << boost::detail::setw( 7 );
|
||||||
BOOST_CHECK_EQUAL( (ios_base::unitbuf | ios_base::hex
|
BOOST_CHECK_EQUAL( (ios_base::unitbuf | ios_base::hex
|
||||||
| ios_base::skipws), ss.flags() );
|
| ios_base::skipws), ss.flags() );
|
||||||
BOOST_CHECK_EQUAL( 5, ss.precision() );
|
BOOST_CHECK_EQUAL( 5, ss.precision() );
|
||||||
@ -560,10 +560,10 @@ ios_all_saver_unit_test
|
|||||||
ss << oct << showpos << noskipws;
|
ss << oct << showpos << noskipws;
|
||||||
BOOST_CHECK_EQUAL( (ios_base::showpos | ios_base::oct), ss.flags() );
|
BOOST_CHECK_EQUAL( (ios_base::showpos | ios_base::oct), ss.flags() );
|
||||||
|
|
||||||
ss << setprecision( 3 );
|
ss << boost::detail::setprecision( 3 );
|
||||||
BOOST_CHECK_EQUAL( 3, ss.precision() );
|
BOOST_CHECK_EQUAL( 3, ss.precision() );
|
||||||
|
|
||||||
ss << setw( 9 );
|
ss << boost::detail::setw( 9 );
|
||||||
BOOST_CHECK_EQUAL( 9, ss.width() );
|
BOOST_CHECK_EQUAL( 9, ss.width() );
|
||||||
|
|
||||||
ss.setstate( ios_base::eofbit );
|
ss.setstate( ios_base::eofbit );
|
||||||
@ -586,7 +586,7 @@ ios_all_saver_unit_test
|
|||||||
ss.rdbuf( cerr.rdbuf() );
|
ss.rdbuf( cerr.rdbuf() );
|
||||||
BOOST_CHECK_EQUAL( cerr.rdbuf(), ss.rdbuf() );
|
BOOST_CHECK_EQUAL( cerr.rdbuf(), ss.rdbuf() );
|
||||||
|
|
||||||
ss << setfill( 'x' );
|
ss << boost::detail::setfill( 'x' );
|
||||||
BOOST_CHECK_EQUAL( 'x', ss.fill() );
|
BOOST_CHECK_EQUAL( 'x', ss.fill() );
|
||||||
|
|
||||||
ss.imbue( locale(locale::classic(), new backward_bool_names) );
|
ss.imbue( locale(locale::classic(), new backward_bool_names) );
|
||||||
|
Reference in New Issue
Block a user