summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '3rdParty/Boost/src/boost/asio/basic_streambuf.hpp')
-rw-r--r--3rdParty/Boost/src/boost/asio/basic_streambuf.hpp36
1 files changed, 27 insertions, 9 deletions
diff --git a/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp b/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp
index e5f8a8d..546a4ac 100644
--- a/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp
+++ b/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp
@@ -15,28 +15,23 @@
# pragma once
#endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
-#include <boost/asio/detail/push_options.hpp>
-
-#include <boost/asio/detail/push_options.hpp>
-#include <boost/config.hpp>
-#include <boost/asio/detail/pop_options.hpp>
+#include <boost/asio/detail/config.hpp>
#if !defined(BOOST_NO_IOSTREAM)
-#include <boost/asio/detail/push_options.hpp>
#include <algorithm>
#include <cstring>
-#include <memory>
#include <stdexcept>
#include <streambuf>
#include <vector>
#include <boost/limits.hpp>
#include <boost/throw_exception.hpp>
-#include <boost/asio/detail/pop_options.hpp>
-
+#include <boost/asio/basic_streambuf_fwd.hpp>
#include <boost/asio/buffer.hpp>
#include <boost/asio/detail/noncopyable.hpp>
+#include <boost/asio/detail/push_options.hpp>
+
namespace boost {
namespace asio {
@@ -108,7 +103,11 @@ namespace asio {
* is >> s;
* @endcode
*/
+#if defined(GENERATING_DOCUMENTATION)
template <typename Allocator = std::allocator<char> >
+#else
+template <typename Allocator>
+#endif
class basic_streambuf
: public std::streambuf,
private noncopyable
@@ -338,8 +337,27 @@ protected:
private:
std::size_t max_size_;
std::vector<char_type, Allocator> buffer_;
+
+ // Helper function to get the preferred size for reading data.
+ friend std::size_t read_size_helper(
+ basic_streambuf& sb, std::size_t max_size)
+ {
+ return std::min<std::size_t>(
+ std::max<std::size_t>(512, sb.buffer_.capacity() - sb.size()),
+ std::min<std::size_t>(max_size, sb.max_size() - sb.size()));
+ }
};
+// Helper function to get the preferred size for reading data. Used for any
+// user-provided specialisations of basic_streambuf.
+template <typename Allocator>
+inline std::size_t read_size_helper(
+ basic_streambuf<Allocator>& sb, std::size_t max_size)
+{
+ return std::min<std::size_t>(512,
+ std::min<std::size_t>(max_size, sb.max_size() - sb.size()));
+}
+
} // namespace asio
} // namespace boost