removed boost dependencies

This commit is contained in:
jan p springer
2013-12-18 10:34:06 +00:00
parent 623cdaa552
commit 0e3cebf23a
3 changed files with 103 additions and 27 deletions

View File

@@ -26,7 +26,7 @@
/// @author Jan P Springer (regnirpsj@gmail.com)
///
/// @see core (dependence)
/// @see gtx_quaternion (dependence)
/// @see gtc_quaternion (dependence)
///
/// @defgroup gtx_io GLM_GTX_io
/// @ingroup gtx
@@ -51,11 +51,9 @@
# pragma message("GLM: GLM_GTX_io extension included")
#endif
#include <boost/io_fwd.hpp> // basic_ios_all_saver<> (fwd)
#include <boost/noncopyable.hpp> // boost::noncopyable
#include <iosfwd> // std::basic_ostream<> (fwd)
#include <locale> // std::locale, std::locale::facet, std::locale::id
#include <utility> // std::pair<>
#include <iosfwd> // std::basic_ostream<> (fwd)
#include <locale> // std::locale, std::locale::facet, std::locale::id
#include <utility> // std::pair<>
namespace glm
{
@@ -92,7 +90,37 @@ namespace glm
};
template <typename CTy, typename CTr = std::char_traits<CTy> >
class basic_format_saver : private boost::noncopyable {
class basic_state_saver {
public:
explicit basic_state_saver(std::basic_ios<CTy,CTr>&);
~basic_state_saver();
private:
typedef ::std::basic_ios<CTy,CTr> state_type;
typedef typename state_type::char_type char_type;
typedef ::std::ios_base::fmtflags flags_type;
typedef ::std::streamsize streamsize_type;
typedef ::std::locale const locale_type;
state_type& state_;
flags_type flags_;
streamsize_type precision_;
streamsize_type width_;
char_type fill_;
locale_type locale_;
basic_state_saver& operator=(basic_state_saver const&);
};
typedef basic_state_saver<char> state_saver;
typedef basic_state_saver<wchar_t> wstate_saver;
template <typename CTy, typename CTr = std::char_traits<CTy> >
class basic_format_saver {
public:
@@ -101,7 +129,9 @@ namespace glm
private:
boost::io::basic_ios_all_saver<CTy> const ias_;
basic_state_saver<CTy> const bss_;
basic_format_saver& operator=(basic_format_saver const&);
};

View File

@@ -2,15 +2,13 @@
// OpenGL Mathematics Copyright (c) 2005 - 2013 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2013-11-22
// Updated : 2013-12-17
// Updated : 2013-12-18
// Licence : This source is under MIT License
// File : glm/gtx/inl.inl
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <boost/io/ios_state.hpp> // boost::io::ios_all_saver
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right,
// std::setw
#include <ostream> // std::basic_ostream<>
#include <iomanip> // std::setfill<>, std::fixed, std::setprecision, std::right, std::setw
#include <ostream> // std::basic_ostream<>
namespace glm
{
@@ -49,11 +47,32 @@ namespace glm
template <typename CTy> std::locale::id format_punct<CTy>::id;
template <typename CTy, typename CTr>
/* explicit */ GLM_FUNC_QUALIFIER
basic_state_saver<CTy,CTr>::basic_state_saver(std::basic_ios<CTy,CTr>& a)
: state_ (a),
flags_ (a.flags()),
precision_(a.precision()),
width_ (a.width()),
fill_ (a.fill()),
locale_ (a.getloc())
{}
template <typename CTy, typename CTr>
GLM_FUNC_QUALIFIER
basic_state_saver<CTy,CTr>::~basic_state_saver()
{
state_.imbue(locale_);
state_.fill(fill_);
state_.width(width_);
state_.precision(precision_);
state_.flags(flags_);
}
template <typename CTy, typename CTr>
/* explicit */ GLM_FUNC_QUALIFIER
basic_format_saver<CTy,CTr>::basic_format_saver(std::basic_ios<CTy,CTr>& a)
: boost::noncopyable(),
ias_ (a)
: bss_(a)
{
a.imbue(std::locale(a.getloc(), new format_punct<CTy>(get_facet<format_punct<CTy>>(a))));
}
@@ -171,7 +190,7 @@ namespace glm
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy>>(os));
if (fmt.formatted) {
boost::io::basic_ios_all_saver<CTy> const ias(os);
io::basic_state_saver<CTy> const bss(os);
os << std::fixed
<< std::right
@@ -201,7 +220,7 @@ namespace glm
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy>>(os));
if (fmt.formatted) {
boost::io::basic_ios_all_saver<CTy> const ias(os);
io::basic_state_saver<CTy> const bss(os);
os << std::fixed
<< std::right
@@ -229,7 +248,7 @@ namespace glm
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy>>(os));
if (fmt.formatted) {
boost::io::basic_ios_all_saver<CTy> const ias(os);
io::basic_state_saver<CTy> const bss(os);
os << std::fixed
<< std::right
@@ -258,7 +277,7 @@ namespace glm
io::format_punct<CTy> const& fmt(io::get_facet<io::format_punct<CTy>>(os));
if (fmt.formatted) {
boost::io::basic_ios_all_saver<CTy> const ias(os);
io::basic_state_saver<CTy> const bss(os);
os << std::fixed
<< std::right