diff --git a/include/boost/detail/iomanip.hpp b/include/boost/detail/iomanip.hpp deleted file mode 100644 index 7e84b6d..0000000 --- a/include/boost/detail/iomanip.hpp +++ /dev/null @@ -1,246 +0,0 @@ -/*============================================================================== - Copyright (c) 2010-2011 Bryce Lelbach - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ - -#ifndef BOOST_DETAIL_IOMANIP_HPP -#define BOOST_DETAIL_IOMANIP_HPP - -#include - -#if (defined(BOOST_CLANG) || defined(BOOST_INTEL_LINUX)) && \ - defined(BOOST_GNU_STDLIB) - #include - #include - #include - - namespace boost { - namespace detail { - - //[resetiosflags - class resetiosflags_manip { - private: - std::ios_base::fmtflags mask; - - public: - explicit resetiosflags_manip (std::ios_base::fmtflags m): - mask(m) { } - - template - friend std::basic_istream& - operator>> (std::basic_istream& is, - resetiosflags_manip const& x) - { - is.unsetf(x.mask); - return is; - } - - template - friend std::basic_ostream& - operator<< (std::basic_ostream& os, - resetiosflags_manip const& x) - { - os.unsetf(x.mask); - return os; - } - }; - - inline resetiosflags_manip resetiosflags (std::ios_base::fmtflags mask) { - return resetiosflags_manip(mask); - } - //] - - //[setiosflags - class setiosflags_manip { - private: - std::ios_base::fmtflags mask; - - public: - explicit setiosflags_manip (std::ios_base::fmtflags m): - mask(m) { } - - template - friend std::basic_istream& - operator>> (std::basic_istream& is, - setiosflags_manip const& x) { - is.setf(x.mask); - return is; - } - - template - friend std::basic_ostream& - operator<< (std::basic_ostream& os, - setiosflags_manip const& x) { - os.setf(x.mask); - return os; - } - }; - - inline setiosflags_manip setiosflags (std::ios_base::fmtflags mask) { - return setiosflags_manip(mask); - } - //] - - //[setbase - class setbase_manip { - private: - int base; - - public: - explicit setbase_manip (int b): - base(b) { } - - template - friend std::basic_istream& - operator>> (std::basic_istream& is, setbase_manip const& x) { - using namespace std; - switch (x.base) { - case 8: - is << std::oct; - return is; - case 10: - is << std::dec; - return is; - case 16: - is << std::hex; - return is; - default: - is.setf(ios_base::fmtflags(0), ios_base::basefield); - return is; - } - } - - template - friend std::basic_ostream& - operator<< (std::basic_ostream& os, setbase_manip const& x) { - using namespace std; - switch (x.base) { - case 8: - os << std::oct; - return os; - case 10: - os << std::dec; - return os; - case 16: - os << std::hex; - return os; - default: - os.setf(ios_base::fmtflags(0), ios_base::basefield); - return os; - } - } - }; - - inline setbase_manip setbase (int base) { - return setbase_manip(base); - } - //] - - //[setfill - template - class setfill_manip { - private: - CharT fill; - - public: - explicit setfill_manip (CharT c): - fill(c) { } - - template - friend std::basic_ostream& - operator<< (std::basic_ostream& os, setfill_manip const& x) { - os.fill(x.fill); - return os; - } - }; - - template - inline setfill_manip setfill (CharT c) { - return setfill_manip(c); - } - //] - - //[setprecision - class setprecision_manip { - private: - int n; - - public: - explicit setprecision_manip (int n_): - n(n_) { } - - template - friend std::basic_istream& - operator>> (std::basic_istream& is, - setprecision_manip const& x) { - is.precision(x.n); - return is; - } - - template - friend std::basic_ostream& - operator<< (std::basic_ostream& os, - setprecision_manip const& x) { - os.precision(x.n); - return os; - } - }; - - inline setprecision_manip setprecision (int n_) { - return setprecision_manip(n_); - } - //] - - //[setw - class setw_manip { - private: - int n; - - public: - explicit setw_manip (int n_): - n(n_) { } - - template - friend std::basic_istream& - operator>> (std::basic_istream& is, setw_manip const& x) { - is.width(x.n); - return is; - } - - template - friend std::basic_ostream& - operator<< (std::basic_ostream& os, setw_manip const& x) { - os.width(x.n); - return os; - } - }; - - inline setw_manip setw (int n_) { - return setw_manip(n_); - } - //] - - } // detail - } // boost - -#else - #include - - namespace boost { - namespace detail { - - using ::std::resetiosflags; - using ::std::setiosflags; - using ::std::setbase; - using ::std::setfill; - using ::std::setprecision; - using ::std::setw; - - } // detail - } // boost - -#endif - -#endif // BOOST_DETAIL_IOMANIP_HPP diff --git a/test/iomanip_test.cpp b/test/iomanip_test.cpp deleted file mode 100644 index 60d91c3..0000000 --- a/test/iomanip_test.cpp +++ /dev/null @@ -1,59 +0,0 @@ -/*============================================================================== - Copyright (c) 2010-2011 Bryce Lelbach - - Distributed under the Boost Software License, Version 1.0. (See accompanying - file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -==============================================================================*/ - -#include -#include - -#include -#include -#include - -int main (void) { - using namespace boost::detail; - - std::ostringstream oss(std::ostringstream::out); - - //[setbase_test - oss << setbase(8) << 8; - BOOST_TEST_EQ(oss.str(), "10"); - - oss.str(""); - oss << setbase(10) << 10; - BOOST_TEST_EQ(oss.str(), "10"); - - oss.str(""); - oss << setbase(16) << 16; - BOOST_TEST_EQ(oss.str(), "10"); - //] - - //[setiosflags_test - oss.str(""); - oss << setiosflags(std::ios_base::showbase | std::ios_base::hex) << 16; - BOOST_TEST_EQ(oss.str(), "0x10"); - //] - - //[resetiosflags_test - oss.str(""); - oss << resetiosflags(std::ios_base::showbase | std::ios_base::hex) << 16; - BOOST_TEST_EQ(oss.str(), "16"); - //] - - //[setprecision_test - oss.str(""); - oss << setprecision(4) << 3.14159; - BOOST_TEST_EQ(oss.str(), "3.142"); - //] - - //[setfill_and_setw_test - oss.str(""); - oss << setfill('*') << setw(5) << 9; - BOOST_TEST_EQ(oss.str(), "****9"); - //] - - return boost::report_errors(); -} -