diff options
author | Anas Nashif <anas.nashif@intel.com> | 2013-08-26 08:15:55 -0400 |
---|---|---|
committer | Anas Nashif <anas.nashif@intel.com> | 2013-08-26 08:15:55 -0400 |
commit | bb4dd8289b351fae6b55e303f189127a394a1edd (patch) | |
tree | 77c9c35a31b1459dd7988c2448e797d142530c41 /boost/interprocess/streams | |
parent | 1a78a62555be32868418fe52f8e330c9d0f95d5a (diff) | |
download | boost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.gz boost-bb4dd8289b351fae6b55e303f189127a394a1edd.tar.bz2 boost-bb4dd8289b351fae6b55e303f189127a394a1edd.zip |
Imported Upstream version 1.51.0upstream/1.51.0
Diffstat (limited to 'boost/interprocess/streams')
-rw-r--r-- | boost/interprocess/streams/bufferstream.hpp | 38 | ||||
-rw-r--r-- | boost/interprocess/streams/vectorstream.hpp | 50 |
2 files changed, 44 insertions, 44 deletions
diff --git a/boost/interprocess/streams/bufferstream.hpp b/boost/interprocess/streams/bufferstream.hpp index 834b3d1e01..3ae9f5e2dc 100644 --- a/boost/interprocess/streams/bufferstream.hpp +++ b/boost/interprocess/streams/bufferstream.hpp @@ -42,7 +42,7 @@ #include <ios> #include <istream> #include <ostream> -#include <string> // char traits +#include <string> // char traits #include <cstddef> // ptrdiff_t #include <boost/assert.hpp> #include <boost/interprocess/interprocess_fwd.hpp> @@ -53,7 +53,7 @@ namespace boost { namespace interprocess { //!a basic_xbufferstream. The elements are transmitted from a to a fixed //!size buffer template <class CharT, class CharTraits> -class basic_bufferbuf +class basic_bufferbuf : public std::basic_streambuf<CharT, CharTraits> { public: @@ -74,7 +74,7 @@ class basic_bufferbuf //!Constructor. Assigns formatting buffer. //!Does not throw. - explicit basic_bufferbuf(CharT *buffer, std::size_t length, + explicit basic_bufferbuf(CharT *buffer, std::size_t length, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : base_t(), m_mode(mode), m_buffer(buffer), m_length(length) @@ -83,7 +83,7 @@ class basic_bufferbuf virtual ~basic_bufferbuf(){} public: - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair<CharT *, std::size_t> buffer() const { return std::pair<CharT *, std::size_t>(m_buffer, m_length); } @@ -172,13 +172,13 @@ class basic_bufferbuf } virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, - std::ios_base::openmode mode + std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { bool in = false; bool out = false; - - const std::ios_base::openmode inout = + + const std::ios_base::openmode inout = std::ios_base::in | std::ios_base::out; if((mode & inout) == inout) { @@ -205,7 +205,7 @@ class basic_bufferbuf newoff = static_cast<std::streamoff>(m_length); break; case std::ios_base::cur: - newoff = in ? static_cast<std::streamoff>(this->gptr() - this->eback()) + newoff = in ? static_cast<std::streamoff>(this->gptr() - this->eback()) : static_cast<std::streamoff>(this->pptr() - this->pbase()); break; default: @@ -237,7 +237,7 @@ class basic_bufferbuf return pos_type(off); } - virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode + virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); } @@ -277,7 +277,7 @@ class basic_ibufferstream //!Does not throw. basic_ibufferstream(const CharT *buffer, std::size_t length, std::ios_base::openmode mode = std::ios_base::in) - : basic_ios_t(), base_t(0), + : basic_ios_t(), base_t(0), m_buf(const_cast<CharT*>(buffer), length, mode | std::ios_base::in) { basic_ios_t::init(&m_buf); } @@ -289,12 +289,12 @@ class basic_ibufferstream basic_bufferbuf<CharT, CharTraits>* rdbuf() const { return const_cast<basic_bufferbuf<CharT, CharTraits>*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair<const CharT *, std::size_t> buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. void buffer(const CharT *buffer, std::size_t length) { m_buf.buffer(const_cast<CharT*>(buffer), length); } @@ -335,7 +335,7 @@ class basic_obufferstream //!Does not throw. basic_obufferstream(CharT *buffer, std::size_t length, std::ios_base::openmode mode = std::ios_base::out) - : basic_ios_t(), base_t(0), + : basic_ios_t(), base_t(0), m_buf(buffer, length, mode | std::ios_base::out) { basic_ios_t::init(&m_buf); } @@ -347,12 +347,12 @@ class basic_obufferstream basic_bufferbuf<CharT, CharTraits>* rdbuf() const { return const_cast<basic_bufferbuf<CharT, CharTraits>*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair<CharT *, std::size_t> buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. void buffer(CharT *buffer, std::size_t length) { m_buf.buffer(buffer, length); } @@ -367,7 +367,7 @@ class basic_obufferstream //!A basic_iostream class that uses a fixed size character buffer //!as its formatting buffer. template <class CharT, class CharTraits> -class basic_bufferstream +class basic_bufferstream : public std::basic_iostream<CharT, CharTraits> { @@ -388,7 +388,7 @@ class basic_bufferstream public: //!Constructor. //!Does not throw. - basic_bufferstream(std::ios_base::openmode mode + basic_bufferstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : basic_ios_t(), base_t(0), m_buf(mode) { basic_ios_t::init(&m_buf); } @@ -409,12 +409,12 @@ class basic_bufferstream basic_bufferbuf<CharT, CharTraits>* rdbuf() const { return const_cast<basic_bufferbuf<CharT, CharTraits>*>(&m_buf); } - //!Returns the pointer and size of the internal buffer. + //!Returns the pointer and size of the internal buffer. //!Does not throw. std::pair<CharT *, std::size_t> buffer() const { return m_buf.buffer(); } - //!Sets the underlying buffer to a new value. Resets + //!Sets the underlying buffer to a new value. Resets //!stream position. Does not throw. void buffer(CharT *buffer, std::size_t length) { m_buf.buffer(buffer, length); } diff --git a/boost/interprocess/streams/vectorstream.hpp b/boost/interprocess/streams/vectorstream.hpp index 83041f2b2e..3cee7200ab 100644 --- a/boost/interprocess/streams/vectorstream.hpp +++ b/boost/interprocess/streams/vectorstream.hpp @@ -30,7 +30,7 @@ //!This file defines basic_vectorbuf, basic_ivectorstream, //!basic_ovectorstream, and basic_vectorstreamclasses. These classes //!represent streamsbufs and streams whose sources or destinations are -//!STL-like vectors that can be swapped with external vectors to avoid +//!STL-like vectors that can be swapped with external vectors to avoid //!unnecessary allocations/copies. #ifndef BOOST_INTERPROCESS_VECTORSTREAM_HPP @@ -43,7 +43,7 @@ #include <ios> #include <istream> #include <ostream> -#include <string> // char traits +#include <string> // char traits #include <cstddef> // ptrdiff_t #include <boost/interprocess/interprocess_fwd.hpp> #include <boost/assert.hpp> @@ -51,9 +51,9 @@ namespace boost { namespace interprocess { //!A streambuf class that controls the transmission of elements to and from -//!a basic_ivectorstream, basic_ovectorstream or basic_vectorstream. +//!a basic_ivectorstream, basic_ovectorstream or basic_vectorstream. //!It holds a character vector specified by CharVector template parameter -//!as its formatting buffer. The vector must have contiguous storage, like +//!as its formatting buffer. The vector must have contiguous storage, like //!std::vector, boost::interprocess::vector or boost::interprocess::basic_string template <class CharVector, class CharTraits> class basic_vectorbuf @@ -96,11 +96,11 @@ class basic_vectorbuf public: - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read/write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) - { + { if (this->m_mode & std::ios_base::out){ //Update high water if necessary //And resize vector to remove extra size @@ -118,8 +118,8 @@ class basic_vectorbuf //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const - { + const vector_type &vector() const + { if (this->m_mode & std::ios_base::out){ if (mp_high_water < base_t::pptr()){ //Restore the vector's size if necessary @@ -137,13 +137,13 @@ class basic_vectorbuf const_cast<basic_vectorbuf*>(this)->base_t::pbump(old_pos); } } - return m_vect; + return m_vect; } //!Preallocates memory from the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's memory allocation throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { if (this->m_mode & std::ios_base::out && size > m_vect.size()){ typename vector_type::difference_type write_pos = base_t::pptr() - base_t::pbase(); @@ -282,7 +282,7 @@ class basic_vectorbuf } virtual pos_type seekoff(off_type off, std::ios_base::seekdir dir, - std::ios_base::openmode mode + std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { //Get seek mode @@ -325,7 +325,7 @@ class basic_vectorbuf newoff = limit; break; case std::ios_base::cur: - newoff = in ? static_cast<std::streamoff>(this->gptr() - this->eback()) + newoff = in ? static_cast<std::streamoff>(this->gptr() - this->eback()) : static_cast<std::streamoff>(this->pptr() - this->pbase()); break; default: @@ -350,7 +350,7 @@ class basic_vectorbuf return pos_type(newoff); } - virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode + virtual pos_type seekpos(pos_type pos, std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) { return seekoff(pos - pos_type(off_type(0)), std::ios_base::beg, mode); } @@ -413,7 +413,7 @@ class basic_ivectorstream basic_vectorbuf<CharVector, CharTraits>* rdbuf() const { return const_cast<basic_vectorbuf<CharVector, CharTraits>*>(&m_buf()); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -421,18 +421,18 @@ class basic_ivectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf().reserve(size); } //!Calls clear() method of the internal vector. //!Resets the stream to the first position. - void clear() + void clear() { m_buf().clear(); } }; @@ -488,7 +488,7 @@ class basic_ovectorstream basic_vectorbuf<CharVector, CharTraits>* rdbuf() const { return const_cast<basic_vectorbuf<CharVector, CharTraits>*>(&m_buf()); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -496,13 +496,13 @@ class basic_ovectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf().vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf().reserve(size); } }; @@ -534,7 +534,7 @@ class basic_vectorstream public: //!Constructor. Throws if vector_type default //!constructor throws. - basic_vectorstream(std::ios_base::openmode mode + basic_vectorstream(std::ios_base::openmode mode = std::ios_base::in | std::ios_base::out) : basic_ios_t(), base_t(0), m_buf(mode) { basic_ios_t::init(&m_buf); } @@ -554,7 +554,7 @@ class basic_vectorstream basic_vectorbuf<CharVector, CharTraits>* rdbuf() const { return const_cast<basic_vectorbuf<CharVector, CharTraits>*>(&m_buf); } - //!Swaps the underlying vector with the passed vector. + //!Swaps the underlying vector with the passed vector. //!This function resets the read/write position in the stream. //!Does not throw. void swap_vector(vector_type &vect) @@ -562,18 +562,18 @@ class basic_vectorstream //!Returns a const reference to the internal vector. //!Does not throw. - const vector_type &vector() const + const vector_type &vector() const { return m_buf.vector(); } //!Calls reserve() method of the internal vector. //!Resets the stream to the first position. //!Throws if the internals vector's reserve throws. - void reserve(typename vector_type::size_type size) + void reserve(typename vector_type::size_type size) { m_buf.reserve(size); } //!Calls clear() method of the internal vector. //!Resets the stream to the first position. - void clear() + void clear() { m_buf.clear(); } /// @cond |