Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion include/boost/http_proto/fields_view_base.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@

#include <boost/http_proto/detail/config.hpp>
#include <boost/http_proto/detail/header.hpp>

#include <boost/core/detail/string_view.hpp>
#include <boost/url/grammar/recycled.hpp>
#include <boost/url/grammar/type_traits.hpp>
#include <boost/core/detail/string_view.hpp>

#include <iosfwd>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

#include <string>

namespace boost {
Expand Down Expand Up @@ -429,6 +432,42 @@ class fields_view_base
core::string_view name) const noexcept;
};

/** Format the container to the output stream

This function serializes the container to
the specified output stream.

@par Example
@code
request req;
std::stringstream ss;
ss << req;
assert( ss.str() == "GET / HTTP/1.1\r\n\r\n" );
@endcode

@par Effects
@code
return os << f.buffer();
@endcode

@par Complexity
Linear in `f.buffer().size()`

@par Exception Safety
Basic guarantee.

@return A reference to the output stream, for chaining

@param os The output stream to write to.

@param f The container to write.
*/
BOOST_HTTP_PROTO_DECL
std::ostream&
operator<<(
std::ostream& os,
const fields_view_base& f);

} // http_proto
} // boost

Expand Down
8 changes: 8 additions & 0 deletions src/fields_view_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,5 +383,13 @@ find_all(

//------------------------------------------------

std::ostream&
operator<<(
std::ostream& os,
const fields_view_base& f)
{
return os << f.buffer();
}

} // http_proto
} // boost
Loading