Fields::writer replaces Fields::reader (API Change):

* Fields::writer replaces Fields::reader
* The FieldsWriter concept is renamed from FieldsReader

Actions Required:

* Rename reader to writer for user defined Fields
This commit is contained in:
Vinnie Falco committed 2017-10-30 17:53:59 -07:00
1 parent 14653be0cc
commit 101023553e
14 files changed
+70 -54

No files matched your search

@@ -245,7 +245,7 @@ template<class T,
struct buffers_or_fields
{
using type = typename
T::reader::const_buffers_type;
T::writer::const_buffers_type;
};
template<class T>
@@ -51,6 +51,8 @@ struct is_parser<parser<isRequest, Body, Fields>> : std::true_type {};
struct fields_model
{
struct writer;
string_view method() const;
string_view reason() const;
string_view target() const;
+2 -2
View File
@@ -155,9 +155,9 @@ public:
/// The algorithm used to serialize the header
#if BOOST_BEAST_DOXYGEN
using reader = implementation_defined;
using writer = implementation_defined;
#else
class reader;
class writer;
#endif
private:
@@ -159,7 +159,7 @@ prepare(Trailer const& trailer, Allocator const& allocator) ->
buffers_type
{
auto sp = std::allocate_shared<typename
Trailer::reader>(allocator, trailer);
Trailer::writer>(allocator, trailer);
sp_ = sp;
return sp->get();
}
@@ -171,7 +171,7 @@ prepare(Trailer const& trailer, std::true_type) ->
buffers_type
{
auto sp = std::make_shared<
typename Trailer::reader>(trailer);
typename Trailer::writer>(trailer);
sp_ = sp;
return sp->get();
}
+11 -11
View File
@@ -34,7 +34,7 @@ namespace beast {
namespace http {
template<class Allocator>
class basic_fields<Allocator>::reader
class basic_fields<Allocator>::writer
{
public:
using iter_type = typename list_t::const_iterator;
@@ -157,13 +157,13 @@ public:
using const_buffers_type =
beast::detail::buffers_ref<view_type>;
reader(basic_fields const& f,
writer(basic_fields const& f,
unsigned version, verb v);
reader(basic_fields const& f,
writer(basic_fields const& f,
unsigned version, unsigned code);
reader(basic_fields const& f);
writer(basic_fields const& f);
const_buffers_type
get() const
@@ -173,8 +173,8 @@ public:
};
template<class Allocator>
basic_fields<Allocator>::reader::
reader(basic_fields const& f)
basic_fields<Allocator>::writer::
writer(basic_fields const& f)
: f_(f)
{
view_.emplace(
@@ -186,8 +186,8 @@ reader(basic_fields const& f)
}
template<class Allocator>
basic_fields<Allocator>::reader::
reader(basic_fields const& f,
basic_fields<Allocator>::writer::
writer(basic_fields const& f,
unsigned version, verb v)
: f_(f)
{
@@ -228,8 +228,8 @@ reader(basic_fields const& f,
}
template<class Allocator>
basic_fields<Allocator>::reader::
reader(basic_fields const& f,
basic_fields<Allocator>::writer::
writer(basic_fields const& f,
unsigned version, unsigned code)
: f_(f)
{
@@ -1230,7 +1230,7 @@ realloc_target(
{
// The target string are stored with an
// extra space at the beginning to help
// the reader class.
// the writer class.
if(dest.empty() && s.empty())
return;
auto a = typename beast::detail::allocator_traits<
+2 -2
View File
@@ -838,7 +838,7 @@ std::ostream&
operator<<(std::ostream& os,
header<true, Fields> const& h)
{
typename Fields::reader fr{
typename Fields::writer fr{
h, h.version(), h.method()};
return os << buffers(fr.get());
}
@@ -848,7 +848,7 @@ std::ostream&
operator<<(std::ostream& os,
header<false, Fields> const& h)
{
typename Fields::reader fr{
typename Fields::writer fr{
h, h.version(), h.result_int()};
return os << buffers(fr.get());
}
+5 -5
View File
@@ -114,11 +114,11 @@ private:
using reader = typename Body::reader;
using cb1_t = buffers_suffix<typename
Fields::reader::const_buffers_type>; // header
Fields::writer::const_buffers_type>; // header
using pcb1_t = buffers_prefix_view<cb1_t const&>;
using cb2_t = buffers_suffix<buffers_cat_view<
typename Fields::reader::const_buffers_type,// header
typename Fields::writer::const_buffers_type,// header
typename reader::const_buffers_type>>; // body
using pcb2_t = buffers_prefix_view<cb2_t const&>;
@@ -127,7 +127,7 @@ private:
using pcb3_t = buffers_prefix_view<cb3_t const&>;
using cb4_t = buffers_suffix<buffers_cat_view<
typename Fields::reader::const_buffers_type,// header
typename Fields::writer::const_buffers_type,// header
detail::chunk_size, // chunk-size
boost::asio::const_buffer, // chunk-ext
chunk_crlf, // crlf
@@ -155,7 +155,7 @@ private:
using pcb6_t = buffers_prefix_view<cb6_t const&>;
using cb7_t = buffers_suffix<buffers_cat_view<
typename Fields::reader::const_buffers_type,// header
typename Fields::writer::const_buffers_type,// header
detail::chunk_size, // chunk-size
boost::asio::const_buffer, // chunk-ext
chunk_crlf, // crlf
@@ -174,7 +174,7 @@ private:
value_type& m_;
reader rd_;
boost::optional<typename Fields::reader> frd_;
boost::optional<typename Fields::writer> frd_;
beast::detail::variant<
cb1_t, cb2_t, cb3_t, cb4_t,
cb5_t ,cb6_t, cb7_t, cb8_t> v_;