shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
#include <stdexcept> // logic_error, out_of_range.
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/config.hpp> // BOOST_MSVC, template friends,
|
||||
#include <boost/detail/workaround.hpp> // BOOST_NESTED_TEMPLATE
|
||||
#include <boost/detail/workaround.hpp> // BOOST_NESTED_TEMPLATE
|
||||
#include <boost/iostreams/constants.hpp>
|
||||
#include <boost/iostreams/detail/access_control.hpp>
|
||||
#include <boost/iostreams/detail/char_traits.hpp>
|
||||
@@ -34,7 +34,7 @@
|
||||
#include <boost/iostreams/traits.hpp> // is_filter.
|
||||
#include <boost/iostreams/stream_buffer.hpp>
|
||||
#include <boost/next_prior.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
@@ -141,7 +141,7 @@ protected:
|
||||
chain_base(const chain_base& rhs): pimpl_(rhs.pimpl_) { }
|
||||
public:
|
||||
|
||||
// dual_use is a pseudo-mode to facilitate filter writing,
|
||||
// dual_use is a pseudo-mode to facilitate filter writing,
|
||||
// not a genuine mode.
|
||||
BOOST_STATIC_ASSERT((!is_convertible<mode, dual_use>::value));
|
||||
|
||||
@@ -150,19 +150,19 @@ public:
|
||||
// Sets the size of the buffer created for the devices to be added to this
|
||||
// chain. Does not affect the size of the buffer for devices already
|
||||
// added.
|
||||
void set_device_buffer_size(std::streamsize n)
|
||||
void set_device_buffer_size(std::streamsize n)
|
||||
{ pimpl_->device_buffer_size_ = n; }
|
||||
|
||||
// Sets the size of the buffer created for the filters to be added
|
||||
// to this chain. Does not affect the size of the buffer for filters already
|
||||
// added.
|
||||
void set_filter_buffer_size(std::streamsize n)
|
||||
void set_filter_buffer_size(std::streamsize n)
|
||||
{ pimpl_->filter_buffer_size_ = n; }
|
||||
|
||||
// Sets the size of the putback buffer for filters and devices to be added
|
||||
// to this chain. Does not affect the size of the buffer for filters or
|
||||
// devices already added.
|
||||
void set_pback_size(std::streamsize n)
|
||||
void set_pback_size(std::streamsize n)
|
||||
{ pimpl_->pback_size_ = n; }
|
||||
|
||||
//----------Device interface----------------------------------------------//
|
||||
@@ -189,7 +189,7 @@ public:
|
||||
T* component(int n) const { return component(n, boost::type<T>()); }
|
||||
|
||||
// Deprecated.
|
||||
template<int N, typename T>
|
||||
template<int N, typename T>
|
||||
T* component() const { return component<T>(N); }
|
||||
#endif
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
bool strict_sync();
|
||||
private:
|
||||
template<typename T>
|
||||
void push_impl(const T& t, std::streamsize buffer_size = -1,
|
||||
void push_impl(const T& t, std::streamsize buffer_size = -1,
|
||||
std::streamsize pback_size = -1)
|
||||
{
|
||||
typedef typename iostreams::category_of<T>::type category;
|
||||
@@ -331,20 +331,20 @@ private:
|
||||
links_.front()->BOOST_IOSTREAMS_PUBSYNC();
|
||||
try {
|
||||
boost::iostreams::detail::execute_foreach(
|
||||
links_.rbegin(), links_.rend(),
|
||||
links_.rbegin(), links_.rend(),
|
||||
closer(BOOST_IOS::in)
|
||||
);
|
||||
} catch (...) {
|
||||
try {
|
||||
boost::iostreams::detail::execute_foreach(
|
||||
links_.begin(), links_.end(),
|
||||
links_.begin(), links_.end(),
|
||||
closer(BOOST_IOS::out)
|
||||
);
|
||||
} catch (...) { }
|
||||
throw;
|
||||
}
|
||||
boost::iostreams::detail::execute_foreach(
|
||||
links_.begin(), links_.end(),
|
||||
links_.begin(), links_.end(),
|
||||
closer(BOOST_IOS::out)
|
||||
);
|
||||
}
|
||||
@@ -382,7 +382,7 @@ private:
|
||||
//----------Member data---------------------------------------------------//
|
||||
|
||||
private:
|
||||
shared_ptr<chain_impl> pimpl_;
|
||||
std::shared_ptr<chain_impl> pimpl_;
|
||||
};
|
||||
|
||||
} // End namespace detail.
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
#include <algorithm> // max.
|
||||
#include <cstring> // memcpy.
|
||||
#include <exception>
|
||||
#include <boost/config.hpp> // DEDUCED_TYPENAME,
|
||||
#include <boost/config.hpp> // DEDUCED_TYPENAME,
|
||||
#include <boost/iostreams/char_traits.hpp>
|
||||
#include <boost/iostreams/constants.hpp> // default_filter_buffer_size.
|
||||
#include <boost/iostreams/detail/adapter/concept_adapter.hpp>
|
||||
@@ -42,7 +42,7 @@
|
||||
#include <boost/iostreams/detail/select.hpp>
|
||||
#include <boost/iostreams/traits.hpp>
|
||||
#include <boost/iostreams/operations.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
@@ -54,7 +54,7 @@
|
||||
namespace boost { namespace iostreams {
|
||||
|
||||
struct code_conversion_error : BOOST_IOSTREAMS_FAILURE {
|
||||
code_conversion_error()
|
||||
code_conversion_error()
|
||||
: BOOST_IOSTREAMS_FAILURE("code conversion error")
|
||||
{ }
|
||||
};
|
||||
@@ -91,28 +91,28 @@ Tgt* strncpy_if_same(Tgt* tgt, const Src* src, std::streamsize n)
|
||||
|
||||
// Buffer and conversion state for reading.
|
||||
template<typename Codecvt, typename Alloc>
|
||||
class conversion_buffer
|
||||
class conversion_buffer
|
||||
: public buffer<
|
||||
BOOST_DEDUCED_TYPENAME detail::codecvt_extern<Codecvt>::type,
|
||||
Alloc
|
||||
>
|
||||
>
|
||||
{
|
||||
public:
|
||||
typedef typename Codecvt::state_type state_type;
|
||||
conversion_buffer()
|
||||
conversion_buffer()
|
||||
: buffer<
|
||||
BOOST_DEDUCED_TYPENAME detail::codecvt_extern<Codecvt>::type,
|
||||
Alloc
|
||||
>(0)
|
||||
{
|
||||
reset();
|
||||
>(0)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
state_type& state() { return state_; }
|
||||
void reset()
|
||||
{
|
||||
if (this->size())
|
||||
void reset()
|
||||
{
|
||||
if (this->size())
|
||||
this->set(0, 0);
|
||||
state_ = state_type();
|
||||
state_ = state_type();
|
||||
}
|
||||
private:
|
||||
state_type state_;
|
||||
@@ -128,12 +128,12 @@ struct code_converter_impl {
|
||||
typedef is_convertible<device_category, input> can_read;
|
||||
typedef is_convertible<device_category, output> can_write;
|
||||
typedef is_convertible<device_category, bidirectional> is_bidir;
|
||||
typedef typename
|
||||
typedef typename
|
||||
iostreams::select< // Disambiguation for Tru64.
|
||||
is_bidir, bidirectional,
|
||||
can_read, input,
|
||||
can_write, output
|
||||
>::type mode;
|
||||
>::type mode;
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_direct<Device>,
|
||||
@@ -147,10 +147,10 @@ struct code_converter_impl {
|
||||
code_converter_impl() : cvt_(), flags_(0) { }
|
||||
|
||||
~code_converter_impl()
|
||||
{
|
||||
try {
|
||||
if (flags_ & f_open) close();
|
||||
} catch (...) { /* */ }
|
||||
{
|
||||
try {
|
||||
if (flags_ & f_open) close();
|
||||
} catch (...) { /* */ }
|
||||
}
|
||||
|
||||
template <class T>
|
||||
@@ -213,7 +213,7 @@ struct code_converter_impl {
|
||||
codecvt_holder<Codecvt> cvt_;
|
||||
storage_type dev_;
|
||||
double_object<
|
||||
buffer_type,
|
||||
buffer_type,
|
||||
is_double
|
||||
> buf_;
|
||||
int flags_;
|
||||
@@ -232,13 +232,13 @@ struct code_converter_base {
|
||||
Device, Codecvt, Alloc
|
||||
> impl_type;
|
||||
code_converter_base() : pimpl_(new impl_type) { }
|
||||
shared_ptr<impl_type> pimpl_;
|
||||
std::shared_ptr<impl_type> pimpl_;
|
||||
};
|
||||
|
||||
template< typename Device,
|
||||
typename Codecvt = detail::default_codecvt,
|
||||
template< typename Device,
|
||||
typename Codecvt = detail::default_codecvt,
|
||||
typename Alloc = std::allocator<char> >
|
||||
class code_converter
|
||||
class code_converter
|
||||
: protected code_converter_base<Device, Codecvt, Alloc>
|
||||
{
|
||||
private:
|
||||
@@ -252,28 +252,28 @@ private:
|
||||
typedef typename detail::codecvt_extern<Codecvt>::type extern_type;
|
||||
typedef typename detail::codecvt_state<Codecvt>::type state_type;
|
||||
public:
|
||||
typedef intern_type char_type;
|
||||
struct category
|
||||
typedef intern_type char_type;
|
||||
struct category
|
||||
: impl_type::mode, device_tag, closable_tag, localizable_tag
|
||||
{ };
|
||||
BOOST_STATIC_ASSERT((
|
||||
is_same<
|
||||
extern_type,
|
||||
extern_type,
|
||||
BOOST_DEDUCED_TYPENAME char_type_of<Device>::type
|
||||
>::value
|
||||
));
|
||||
public:
|
||||
code_converter() { }
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3)
|
||||
code_converter(code_converter& rhs)
|
||||
code_converter(code_converter& rhs)
|
||||
: code_converter_base<Device, Codecvt, Alloc>(rhs)
|
||||
{ }
|
||||
code_converter(const code_converter& rhs)
|
||||
code_converter(const code_converter& rhs)
|
||||
: code_converter_base<Device, Codecvt, Alloc>(rhs)
|
||||
{ }
|
||||
#endif
|
||||
BOOST_IOSTREAMS_FORWARD( code_converter, open_impl, Device,
|
||||
BOOST_IOSTREAMS_CONVERTER_PARAMS,
|
||||
BOOST_IOSTREAMS_CONVERTER_PARAMS,
|
||||
BOOST_IOSTREAMS_CONVERTER_ARGS )
|
||||
|
||||
// fstream-like interface.
|
||||
@@ -294,9 +294,9 @@ public:
|
||||
Device* operator->() { return &detail::unwrap_direct(dev()); }
|
||||
private:
|
||||
template<typename T> // Used for forwarding.
|
||||
void open_impl(const T& t BOOST_IOSTREAMS_CONVERTER_PARAMS())
|
||||
{
|
||||
impl().open(t BOOST_IOSTREAMS_CONVERTER_ARGS());
|
||||
void open_impl(const T& t BOOST_IOSTREAMS_CONVERTER_PARAMS())
|
||||
{
|
||||
impl().open(t BOOST_IOSTREAMS_CONVERTER_ARGS());
|
||||
}
|
||||
|
||||
const codecvt_type& cvt() { return impl().cvt_.get(); }
|
||||
@@ -347,7 +347,7 @@ std::streamsize code_converter<Device, Codevt, Alloc>::read
|
||||
break;
|
||||
case std::codecvt_base::noconv:
|
||||
{
|
||||
std::streamsize amt =
|
||||
std::streamsize amt =
|
||||
std::min<std::streamsize>(next - buf.ptr(), n - total);
|
||||
detail::strncpy_if_same(s + total, buf.ptr(), amt);
|
||||
total += amt;
|
||||
@@ -382,7 +382,7 @@ std::streamsize code_converter<Device, Codevt, Alloc>::write
|
||||
break;
|
||||
partial = false;
|
||||
}
|
||||
|
||||
|
||||
// Convert.
|
||||
std::codecvt_base::result result =
|
||||
cvt().out( buf.state(),
|
||||
@@ -399,8 +399,8 @@ std::streamsize code_converter<Device, Codevt, Alloc>::write
|
||||
break;
|
||||
case std::codecvt_base::noconv:
|
||||
{
|
||||
std::streamsize amt =
|
||||
std::min<std::streamsize>( nint - total - s,
|
||||
std::streamsize amt =
|
||||
std::min<std::streamsize>( nint - total - s,
|
||||
buf.end() - buf.eptr() );
|
||||
detail::strncpy_if_same(buf.eptr(), s + total, amt);
|
||||
total += amt;
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <boost/iostreams/detail/ios.hpp> // openmode, seekdir, int types.
|
||||
#include <boost/iostreams/detail/fstream.hpp>
|
||||
#include <boost/iostreams/operations.hpp> // seek.
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
|
||||
// Must come last.
|
||||
#include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC.
|
||||
@@ -46,8 +46,8 @@ public:
|
||||
std::streamsize read(char_type* s, std::streamsize n);
|
||||
bool putback(char_type c);
|
||||
std::streamsize write(const char_type* s, std::streamsize n);
|
||||
std::streampos seek( stream_offset off, BOOST_IOS::seekdir way,
|
||||
BOOST_IOS::openmode which =
|
||||
std::streampos seek( stream_offset off, BOOST_IOS::seekdir way,
|
||||
BOOST_IOS::openmode which =
|
||||
BOOST_IOS::in | BOOST_IOS::out );
|
||||
void open( const std::string& path,
|
||||
BOOST_IOS::openmode mode =
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
~impl() { if (file_.is_open()) file_.close(); }
|
||||
BOOST_IOSTREAMS_BASIC_FILEBUF(Ch) file_;
|
||||
};
|
||||
shared_ptr<impl> pimpl_;
|
||||
std::shared_ptr<impl> pimpl_;
|
||||
};
|
||||
|
||||
typedef basic_file<char> file;
|
||||
@@ -87,7 +87,7 @@ struct basic_file_source : private basic_file<Ch> {
|
||||
using basic_file<Ch>::is_open;
|
||||
using basic_file<Ch>::close;
|
||||
basic_file_source( const std::string& path,
|
||||
BOOST_IOS::openmode mode =
|
||||
BOOST_IOS::openmode mode =
|
||||
BOOST_IOS::in )
|
||||
: basic_file<Ch>(path, mode & ~BOOST_IOS::out, BOOST_IOS::in)
|
||||
{ }
|
||||
@@ -128,29 +128,29 @@ struct basic_file_sink : private basic_file<Ch> {
|
||||
|
||||
typedef basic_file_sink<char> file_sink;
|
||||
typedef basic_file_sink<wchar_t> wfile_sink;
|
||||
|
||||
|
||||
//------------------Implementation of basic_file------------------------------//
|
||||
|
||||
template<typename Ch>
|
||||
basic_file<Ch>::basic_file
|
||||
( const std::string& path, BOOST_IOS::openmode mode,
|
||||
( const std::string& path, BOOST_IOS::openmode mode,
|
||||
BOOST_IOS::openmode base_mode )
|
||||
{
|
||||
{
|
||||
open(path, mode, base_mode);
|
||||
}
|
||||
|
||||
template<typename Ch>
|
||||
inline std::streamsize basic_file<Ch>::read
|
||||
(char_type* s, std::streamsize n)
|
||||
{
|
||||
std::streamsize result = pimpl_->file_.sgetn(s, n);
|
||||
{
|
||||
std::streamsize result = pimpl_->file_.sgetn(s, n);
|
||||
return result != 0 ? result : -1;
|
||||
}
|
||||
|
||||
template<typename Ch>
|
||||
inline bool basic_file<Ch>::putback(char_type c)
|
||||
{
|
||||
return !!pimpl_->file_.sputbackc(c);
|
||||
{
|
||||
return !!pimpl_->file_.sputbackc(c);
|
||||
}
|
||||
|
||||
template<typename Ch>
|
||||
@@ -160,15 +160,15 @@ inline std::streamsize basic_file<Ch>::write
|
||||
|
||||
template<typename Ch>
|
||||
std::streampos basic_file<Ch>::seek
|
||||
( stream_offset off, BOOST_IOS::seekdir way,
|
||||
( stream_offset off, BOOST_IOS::seekdir way,
|
||||
BOOST_IOS::openmode )
|
||||
{ return iostreams::seek(pimpl_->file_, off, way); }
|
||||
|
||||
template<typename Ch>
|
||||
void basic_file<Ch>::open
|
||||
( const std::string& path, BOOST_IOS::openmode mode,
|
||||
( const std::string& path, BOOST_IOS::openmode mode,
|
||||
BOOST_IOS::openmode base_mode )
|
||||
{
|
||||
{
|
||||
pimpl_.reset(new impl(path, mode | base_mode));
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <boost/iostreams/detail/ios.hpp> // openmode, seekdir, int types.
|
||||
#include <boost/iostreams/detail/path.hpp>
|
||||
#include <boost/iostreams/positioning.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
|
||||
// Must come last.
|
||||
#include <boost/config/abi_prefix.hpp>
|
||||
@@ -86,9 +86,9 @@ public:
|
||||
explicit file_descriptor( const Path& path,
|
||||
BOOST_IOS::openmode mode =
|
||||
BOOST_IOS::in | BOOST_IOS::out )
|
||||
{
|
||||
{
|
||||
init();
|
||||
open(detail::path(path), mode);
|
||||
open(detail::path(path), mode);
|
||||
}
|
||||
|
||||
// Copy constructor
|
||||
@@ -135,12 +135,12 @@ private:
|
||||
void init();
|
||||
|
||||
// open overload taking a detail::path
|
||||
void open( const detail::path& path,
|
||||
BOOST_IOS::openmode,
|
||||
void open( const detail::path& path,
|
||||
BOOST_IOS::openmode,
|
||||
BOOST_IOS::openmode = BOOST_IOS::openmode(0) );
|
||||
|
||||
typedef detail::file_descriptor_impl impl_type;
|
||||
shared_ptr<impl_type> pimpl_;
|
||||
std::shared_ptr<impl_type> pimpl_;
|
||||
};
|
||||
|
||||
class BOOST_IOSTREAMS_DECL file_descriptor_source : private file_descriptor {
|
||||
@@ -293,16 +293,16 @@ public:
|
||||
#endif
|
||||
|
||||
// open overload taking a std::string
|
||||
void open( const std::string& path,
|
||||
void open( const std::string& path,
|
||||
BOOST_IOS::openmode mode = BOOST_IOS::out );
|
||||
|
||||
// open overload taking C-style string
|
||||
void open( const char* path,
|
||||
void open( const char* path,
|
||||
BOOST_IOS::openmode mode = BOOST_IOS::out );
|
||||
|
||||
// open overload taking a Boost.Filesystem path
|
||||
template<typename Path>
|
||||
void open( const Path& path,
|
||||
void open( const Path& path,
|
||||
BOOST_IOS::openmode mode = BOOST_IOS::out )
|
||||
{ open(detail::path(path), mode); }
|
||||
private:
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <boost/iostreams/detail/path.hpp>
|
||||
#include <boost/iostreams/operations_fwd.hpp>
|
||||
#include <boost/iostreams/positioning.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
@@ -54,25 +54,25 @@ public:
|
||||
};
|
||||
|
||||
// Bitmask operations for mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
operator|(mapped_file_base::mapmode a, mapped_file_base::mapmode b);
|
||||
|
||||
mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
operator&(mapped_file_base::mapmode a, mapped_file_base::mapmode b);
|
||||
|
||||
mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
operator^(mapped_file_base::mapmode a, mapped_file_base::mapmode b);
|
||||
|
||||
mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
operator~(mapped_file_base::mapmode a);
|
||||
|
||||
mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
operator|=(mapped_file_base::mapmode& a, mapped_file_base::mapmode b);
|
||||
|
||||
mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
operator&=(mapped_file_base::mapmode& a, mapped_file_base::mapmode b);
|
||||
|
||||
mapped_file_base::mapmode
|
||||
mapped_file_base::mapmode
|
||||
operator^=(mapped_file_base::mapmode& a, mapped_file_base::mapmode b);
|
||||
|
||||
//------------------Definition of mapped_file_params--------------------------//
|
||||
@@ -81,8 +81,8 @@ namespace detail {
|
||||
|
||||
struct mapped_file_params_base {
|
||||
mapped_file_params_base()
|
||||
: flags(static_cast<mapped_file_base::mapmode>(0)),
|
||||
mode(), offset(0), length(static_cast<std::size_t>(-1)),
|
||||
: flags(static_cast<mapped_file_base::mapmode>(0)),
|
||||
mode(), offset(0), length(static_cast<std::size_t>(-1)),
|
||||
new_file_size(0), hint(0)
|
||||
{ }
|
||||
private:
|
||||
@@ -102,16 +102,16 @@ public:
|
||||
// This template allows Boost.Filesystem paths to be specified when creating or
|
||||
// reopening a memory mapped file, without creating a dependence on
|
||||
// Boost.Filesystem. Possible values of Path include std::string,
|
||||
// boost::filesystem::path, boost::filesystem::wpath,
|
||||
// boost::filesystem::path, boost::filesystem::wpath,
|
||||
// and boost::iostreams::detail::path (used to store either a std::string or a
|
||||
// std::wstring).
|
||||
template<typename Path>
|
||||
struct basic_mapped_file_params
|
||||
: detail::mapped_file_params_base
|
||||
struct basic_mapped_file_params
|
||||
: detail::mapped_file_params_base
|
||||
{
|
||||
typedef detail::mapped_file_params_base base_type;
|
||||
|
||||
// For wide paths, instantiate basic_mapped_file_params
|
||||
// For wide paths, instantiate basic_mapped_file_params
|
||||
// with boost::filesystem::wpath
|
||||
#ifndef BOOST_IOSTREAMS_NO_WIDE_STREAMS
|
||||
BOOST_STATIC_ASSERT((!is_same<Path, std::wstring>::value));
|
||||
@@ -215,7 +215,7 @@ private:
|
||||
void init();
|
||||
void open_impl(const param_type& p);
|
||||
|
||||
boost::shared_ptr<impl_type> pimpl_;
|
||||
boost::std::shared_ptr<impl_type> pimpl_;
|
||||
};
|
||||
|
||||
//------------------Definition of mapped_file---------------------------------//
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
size_type length = max_length,
|
||||
stream_offset offset = 0 );
|
||||
|
||||
// Constructor taking a list of parameters, including a
|
||||
// Constructor taking a list of parameters, including a
|
||||
// std::ios_base::openmode (deprecated)
|
||||
template<typename Path>
|
||||
explicit mapped_file( const Path& path,
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
size_type length = max_length,
|
||||
stream_offset offset = 0 );
|
||||
|
||||
// open overload taking a list of parameters, including a
|
||||
// open overload taking a list of parameters, including a
|
||||
// std::ios_base::openmode (deprecated)
|
||||
template<typename Path>
|
||||
void open( const Path& path,
|
||||
@@ -387,7 +387,7 @@ mapped_file_source::mapped_file_source(const basic_mapped_file_params<Path>& p)
|
||||
{ init(); open(p); }
|
||||
|
||||
template<typename Path>
|
||||
mapped_file_source::mapped_file_source(
|
||||
mapped_file_source::mapped_file_source(
|
||||
const Path& path, size_type length, boost::intmax_t offset)
|
||||
{ init(); open(path, length, offset); }
|
||||
|
||||
@@ -423,14 +423,14 @@ mapped_file::mapped_file(const basic_mapped_file_params<Path>& p)
|
||||
{ open(p); }
|
||||
|
||||
template<typename Path>
|
||||
mapped_file::mapped_file(
|
||||
const Path& path, mapmode flags,
|
||||
mapped_file::mapped_file(
|
||||
const Path& path, mapmode flags,
|
||||
size_type length, stream_offset offset )
|
||||
{ open(path, flags, length, offset); }
|
||||
|
||||
template<typename Path>
|
||||
mapped_file::mapped_file(
|
||||
const Path& path, BOOST_IOS::openmode mode,
|
||||
mapped_file::mapped_file(
|
||||
const Path& path, BOOST_IOS::openmode mode,
|
||||
size_type length, stream_offset offset )
|
||||
{ open(path, mode, length, offset); }
|
||||
|
||||
@@ -439,8 +439,8 @@ void mapped_file::open(const basic_mapped_file_params<Path>& p)
|
||||
{ delegate_.open_impl(p); }
|
||||
|
||||
template<typename Path>
|
||||
void mapped_file::open(
|
||||
const Path& path, mapmode flags,
|
||||
void mapped_file::open(
|
||||
const Path& path, mapmode flags,
|
||||
size_type length, stream_offset offset )
|
||||
{
|
||||
param_type p(path);
|
||||
@@ -451,8 +451,8 @@ void mapped_file::open(
|
||||
}
|
||||
|
||||
template<typename Path>
|
||||
void mapped_file::open(
|
||||
const Path& path, BOOST_IOS::openmode mode,
|
||||
void mapped_file::open(
|
||||
const Path& path, BOOST_IOS::openmode mode,
|
||||
size_type length, stream_offset offset )
|
||||
{
|
||||
param_type p(path);
|
||||
@@ -462,7 +462,7 @@ void mapped_file::open(
|
||||
open(p);
|
||||
}
|
||||
|
||||
inline char* mapped_file::data() const
|
||||
inline char* mapped_file::data() const
|
||||
{ return (flags() != readonly) ? const_cast<char*>(delegate_.data()) : 0; }
|
||||
|
||||
//------------------Implementation of mapped_file_sink------------------------//
|
||||
@@ -524,13 +524,13 @@ struct operations<mapped_file>
|
||||
{
|
||||
static std::pair<char*, char*>
|
||||
input_sequence(mapped_file& file)
|
||||
{
|
||||
return std::make_pair(file.begin(), file.end());
|
||||
{
|
||||
return std::make_pair(file.begin(), file.end());
|
||||
}
|
||||
static std::pair<char*, char*>
|
||||
output_sequence(mapped_file& file)
|
||||
{
|
||||
return std::make_pair(file.begin(), file.end());
|
||||
{
|
||||
return std::make_pair(file.begin(), file.end());
|
||||
}
|
||||
};
|
||||
|
||||
@@ -540,28 +540,28 @@ struct operations<mapped_file_sink>
|
||||
{
|
||||
static std::pair<char*, char*>
|
||||
output_sequence(mapped_file_sink& sink)
|
||||
{
|
||||
return std::make_pair(sink.begin(), sink.end());
|
||||
{
|
||||
return std::make_pair(sink.begin(), sink.end());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//------------------Definition of mapmode operators---------------------------//
|
||||
|
||||
inline mapped_file::mapmode
|
||||
inline mapped_file::mapmode
|
||||
operator|(mapped_file::mapmode a, mapped_file::mapmode b)
|
||||
{
|
||||
return static_cast<mapped_file::mapmode>
|
||||
(static_cast<int>(a) | static_cast<int>(b));
|
||||
}
|
||||
|
||||
inline mapped_file::mapmode
|
||||
inline mapped_file::mapmode
|
||||
operator&(mapped_file::mapmode a, mapped_file::mapmode b)
|
||||
{
|
||||
return static_cast<mapped_file::mapmode>
|
||||
(static_cast<int>(a) & static_cast<int>(b));
|
||||
}
|
||||
|
||||
inline mapped_file::mapmode
|
||||
inline mapped_file::mapmode
|
||||
operator^(mapped_file::mapmode a, mapped_file::mapmode b)
|
||||
{
|
||||
return static_cast<mapped_file::mapmode>
|
||||
@@ -574,19 +574,19 @@ operator~(mapped_file::mapmode a)
|
||||
return static_cast<mapped_file::mapmode>(~static_cast<int>(a));
|
||||
}
|
||||
|
||||
inline mapped_file::mapmode
|
||||
inline mapped_file::mapmode
|
||||
operator|=(mapped_file::mapmode& a, mapped_file::mapmode b)
|
||||
{
|
||||
return a = a | b;
|
||||
}
|
||||
|
||||
inline mapped_file::mapmode
|
||||
inline mapped_file::mapmode
|
||||
operator&=(mapped_file::mapmode& a, mapped_file::mapmode b)
|
||||
{
|
||||
return a = a & b;
|
||||
}
|
||||
|
||||
inline mapped_file::mapmode
|
||||
inline mapped_file::mapmode
|
||||
operator^=(mapped_file::mapmode& a, mapped_file::mapmode b)
|
||||
{
|
||||
return a = a ^ b;
|
||||
|
||||
@@ -20,12 +20,12 @@
|
||||
// // Consume as many characters as possible from the interval
|
||||
// // [begin_in, end_in), without exhausting the output range
|
||||
// // [begin_out, end_out). If flush is true, write as mush output
|
||||
// // as possible.
|
||||
// // A return value of true indicates that filter should be called
|
||||
// // again. More precisely, if flush is false, a return value of
|
||||
// // as possible.
|
||||
// // A return value of true indicates that filter should be called
|
||||
// // again. More precisely, if flush is false, a return value of
|
||||
// // false indicates that the natural end of stream has been reached
|
||||
// // and that all filtered data has been forwarded; if flush is
|
||||
// // true, a return value of false indicates that all filtered data
|
||||
// // true, a return value of false indicates that all filtered data
|
||||
// // has been forwarded.
|
||||
// }
|
||||
// void close() { /* Reset filter's state. */ }
|
||||
@@ -57,7 +57,7 @@
|
||||
#include <boost/preprocessor/punctuation/comma_if.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_binary_params.hpp>
|
||||
#include <boost/preprocessor/repetition/enum_params.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
|
||||
// Must come last.
|
||||
#include <boost/iostreams/detail/config/disable_warnings.hpp> // MSVC.
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
string_type unconsumed_input() const;
|
||||
|
||||
// Give impl access to buffer_type on Tru64
|
||||
#if !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
|
||||
#if !BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042))
|
||||
private:
|
||||
#endif
|
||||
typedef detail::buffer<char_type, Alloc> buffer_type;
|
||||
@@ -266,7 +266,7 @@ private:
|
||||
int state_;
|
||||
};
|
||||
|
||||
shared_ptr<impl> pimpl_;
|
||||
std::shared_ptr<impl> pimpl_;
|
||||
};
|
||||
BOOST_IOSTREAMS_PIPABLE(symmetric_filter, 2)
|
||||
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <algorithm> // copy, min.
|
||||
#include <algorithm> // copy, min.
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp> // BOOST_DEDUCED_TYPENAME.
|
||||
#include <boost/config.hpp> // BOOST_DEDUCED_TYPENAME.
|
||||
#include <boost/detail/workaround.hpp> // default_filter_buffer_size.
|
||||
#include <boost/iostreams/char_traits.hpp>
|
||||
#include <boost/iostreams/compose.hpp>
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <boost/iostreams/detail/functional.hpp> // clear_flags, call_reset
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/std::shared_ptr.hpp>
|
||||
#include <boost/type_traits/is_convertible.hpp>
|
||||
|
||||
// Must come last.
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
typedef typename char_type_of<Filter>::type char_type;
|
||||
typedef typename int_type_of<Filter>::type int_type;
|
||||
typedef char_traits<char_type> traits_type;
|
||||
typedef typename
|
||||
typedef typename
|
||||
mpl::if_<
|
||||
is_convertible<
|
||||
base_category,
|
||||
@@ -60,15 +60,15 @@ public:
|
||||
output,
|
||||
input
|
||||
>::type mode;
|
||||
struct category
|
||||
: mode,
|
||||
filter_tag,
|
||||
multichar_tag,
|
||||
closable_tag
|
||||
struct category
|
||||
: mode,
|
||||
filter_tag,
|
||||
multichar_tag,
|
||||
closable_tag
|
||||
{ };
|
||||
explicit inverse( const Filter& filter,
|
||||
std::streamsize buffer_size =
|
||||
default_filter_buffer_size)
|
||||
explicit inverse( const Filter& filter,
|
||||
std::streamsize buffer_size =
|
||||
default_filter_buffer_size)
|
||||
: pimpl_(new impl(filter, buffer_size))
|
||||
{ }
|
||||
|
||||
@@ -93,10 +93,10 @@ public:
|
||||
buf().flush(snk);
|
||||
}
|
||||
return snk.second().count() == 0 &&
|
||||
status == traits_type::eof()
|
||||
?
|
||||
status == traits_type::eof()
|
||||
?
|
||||
-1
|
||||
:
|
||||
:
|
||||
snk.second().count();
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ public:
|
||||
flags() = f_write;
|
||||
buf().set(0, 0);
|
||||
}
|
||||
|
||||
|
||||
filtered_array_source src(filter(), array_source(s, n));
|
||||
for (bool good = true; src.second().count() < n && good; ) {
|
||||
buf().fill(src);
|
||||
@@ -133,20 +133,20 @@ private:
|
||||
filter_ref filter() { return boost::ref(pimpl_->filter_); }
|
||||
detail::buffer<char_type>& buf() { return pimpl_->buf_; }
|
||||
int& flags() { return pimpl_->flags_; }
|
||||
|
||||
|
||||
enum flags_ {
|
||||
f_read = 1, f_write = 2
|
||||
};
|
||||
|
||||
struct impl {
|
||||
impl(const Filter& filter, std::streamsize n)
|
||||
impl(const Filter& filter, std::streamsize n)
|
||||
: filter_(filter), buf_(n), flags_(0)
|
||||
{ buf_.set(0, 0); }
|
||||
Filter filter_;
|
||||
detail::buffer<char_type> buf_;
|
||||
int flags_;
|
||||
};
|
||||
shared_ptr<impl> pimpl_;
|
||||
std::shared_ptr<impl> pimpl_;
|
||||
};
|
||||
|
||||
//
|
||||
@@ -157,7 +157,7 @@ private:
|
||||
//
|
||||
template<typename Filter>
|
||||
inverse<Filter> invert(const Filter& f) { return inverse<Filter>(f); }
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------//
|
||||
|
||||
} } // End namespaces iostreams, boost.
|
||||
|
||||
Reference in New Issue
Block a user