From aed6c0e288d141e85b62db0392ed7fb1179052b7 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Mon, 10 Oct 2016 12:39:54 -0400 Subject: [PATCH] Relax ForwardIterator requirements in FieldSequence --- CHANGELOG.md | 1 + doc/design.qbk | 16 ++++++++-------- doc/master.qbk | 5 +++-- doc/types/FieldSequence.qbk | 18 +++++++++++++----- doc/websocket.qbk | 4 ++-- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73ac9eb1..5f383571 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ * Add pause option to on_headers interface * Refactor base_parser_v1 callback traits: * Refine Parser concept +* Relax ForwardIterator requirements in FieldSequence API Changes: diff --git a/doc/design.qbk b/doc/design.qbk index 55737025..5c78aa5d 100644 --- a/doc/design.qbk +++ b/doc/design.qbk @@ -32,11 +32,11 @@ libraries: * Leave important decisions to the user, such as allocating memory or managing flow control. -Beast uses the __DynamicBuffer__ concept presented in the Netwoking TS, -and relies heavily on the Boost.Asio __ConstBufferSequence__ and -__MutableBufferSequence__ concepts for passing buffers to functions. The -authors have found the dynamic buffer and buffer sequence interfaces to be -optimal for interacting with Asio, and for other tasks such as incremental +Beast uses the __DynamicBuffer__ concept presented in the Networking TS +(__N4588__), and relies heavily on the Boost.Asio __ConstBufferSequence__ +and __MutableBufferSequence__ concepts for passing buffers to functions. +The authors have found the dynamic buffer and buffer sequence interfaces to +be optimal for interacting with Asio, and for other tasks such as incremental parsing of data in buffers (for example, parsing websocket frames stored in a [link beast.ref.static_streambuf `static_streambuf`]). @@ -152,7 +152,7 @@ start. Other design goals: ]] [[ - "What about HTTP/2?"" + "What about HTTP/2?" ][ Many reviewers feel that HTTP/2 support is an essential feature of a HTTP library. The authors agree that HTTP/2 is important but also @@ -281,7 +281,7 @@ start. Other design goals: (18 functions versus 2). Note that websocketpp connections are passed by `shared_ptr`. Beast does not use `shared_ptr` anywhere in its public interface. A `beast::websocket::stream` is constructible and movable in a manner identical - `to a boost::asio::ip::tcp::socket`. Callers can put such objects in a + to a `boost::asio::ip::tcp::socket`. Callers can put such objects in a `shared_ptr` if they want to, but there is no requirement to do so. [table @@ -372,7 +372,7 @@ start. Other design goals: websocketpp requires a one-time call to set the handler for each event in its interface (for example, upon message receipt). The handler is - represented by a `std::function equivalent`. Its important to recognize + represented by a `std::function` equivalent. Its important to recognize that the websocketpp interface performs type-erasure on this handler. In comparison, Beast handlers are specified in a manner identical to diff --git a/doc/master.qbk b/doc/master.qbk index 54a44c2e..986c902d 100644 --- a/doc/master.qbk +++ b/doc/master.qbk @@ -30,11 +30,12 @@ [def __Body__ [link beast.ref.Body [*`Body`]]] [def __CompletionHandler__ [@http://www.boost.org/doc/libs/1_60_0/doc/html/boost_asio/reference/CompletionHandler.html [*CompletionHandler]]] [def __ConstBufferSequence__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/ConstBufferSequence.html [*ConstBufferSequence]]] -[def __DynamicBuffer__ [link beast.ref.DynamicBuffer [*`DynamicBuffer`]]] -[def __FieldSequence__ [link beast.ref.FieldSequence [*`FieldSequence`]]] +[def __DynamicBuffer__ [link beast.ref.DynamicBuffer [*DynamicBuffer]]] +[def __FieldSequence__ [link beast.ref.FieldSequence [*FieldSequence]]] [def __message__ [link beast.ref.http__message `message`]] [def __message_v1__ [link beast.ref.http__message_v1 `message_v1`]] [def __MutableBufferSequence__ [@http://www.boost.org/doc/libs/1_61_0/doc/html/boost_asio/reference/MutableBufferSequence.html [*MutableBufferSequence]]] +[def __N4588__ [@http://cplusplus.github.io/networking-ts/draft.pdf [*N4588]]] [def __rfc6455__ [@https://tools.ietf.org/html/rfc6455 rfc6455]] [def __rfc7230__ [@https://tools.ietf.org/html/rfc7230 rfc7230]] [def __streambuf__ [link beast.ref.streambuf `streambuf`]] diff --git a/doc/types/FieldSequence.qbk b/doc/types/FieldSequence.qbk index f400507f..b602c32d 100644 --- a/doc/types/FieldSequence.qbk +++ b/doc/types/FieldSequence.qbk @@ -15,7 +15,7 @@ In this table: * `X` denotes a type that meets the requirements of [*FieldSequence]. -* `a` is a value of type `X`. +* `c` is a value of type `X const`. [table FieldSequence requirements [[operation][type][semantics, pre/post-conditions]] @@ -23,25 +23,33 @@ In this table: [`X::value_type`] [] [ - A type that meets the requirements of @b Field. + A type that meets the requirements of [link beast.ref.Field [*Field]]. ] ] [ [`X::const_iterator`] [] [ - A type that meets the requirements of @b ForwardIterator. + An iterator type whose `reference` type meets the + requirements of [link beast.ref.Field [*Field]], and which + satisfies all the requirements of [*ForwardIterator], + except that: + + [ordered_list + [there is no requirement that `operator->` is provided, and] + [there is no requirement that `reference` be a reference type.] + ] ] ] [ - [`a.begin()`] + [`c.begin()`] [`X::const_iterator`] [ Returns an iterator to the beginning of the field sequence. ] ] [ - [`a.end()`] + [`c.end()`] [`X::const_iterator`] [ Returns an iterator to the end of the field sequence. diff --git a/doc/websocket.qbk b/doc/websocket.qbk index 123ef9fc..2f326839 100644 --- a/doc/websocket.qbk +++ b/doc/websocket.qbk @@ -308,8 +308,8 @@ feature, and the write buffer size option determines the maximum size of the fragments: ``` ... - ws.set_option(beast::websocket::auto_fragment{true}; - ws.set_option(beast::websocket::write_buffer_size{16384}; + ws.set_option(beast::websocket::auto_fragment{true}); + ws.set_option(beast::websocket::write_buffer_size{16384}); ``` The WebSocket protocol defines a procedure and control message for initiating