diff options
Diffstat (limited to 'boost/interprocess/streams/vectorstream.hpp')
-rw-r--r-- | boost/interprocess/streams/vectorstream.hpp | 50 |
1 files changed, 25 insertions, 25 deletions
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 |