diff --git a/.gitignore b/.gitignore index 1740b535d7..37e6aaf894 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ bin64/ # Because of CMake and VS2017 Win32/ x64/ - diff --git a/doc/qbk/04_http/08_chunked_encoding.qbk b/doc/qbk/04_http/08_chunked_encoding.qbk index e0d01a055e..0201e9d845 100644 --- a/doc/qbk/04_http/08_chunked_encoding.qbk +++ b/doc/qbk/04_http/08_chunked_encoding.qbk @@ -178,9 +178,9 @@ interface provided by __parser__: ``` void callback( - std::uint64_t size, // Size of the chunk, zero for the last chunk - string_view extensions, // The chunk-extensions in raw form - error_code& ec); // May be set by the callback to indicate an error + std::uint64_t size, // Size of the chunk, zero for the last chunk + core::string_view extensions, // The chunk-extensions in raw form + error_code& ec); // May be set by the callback to indicate an error ``` ] ][ @@ -204,9 +204,9 @@ interface provided by __parser__: ``` std::size_t callback( - std::uint64_t remain, // Octets remaining in this chunk, includes `body` - string_view body, // A buffer holding some or all of the remainder of the chunk body - error_code& ec); // May be set by the callback to indicate an error + std::uint64_t remain, // Octets remaining in this chunk, includes `body` + core::string_view body, // A buffer holding some or all of the remainder of the chunk body + error_code& ec); // May be set by the callback to indicate an error ``` ] ]] diff --git a/doc/qbk/07_concepts/Fields.qbk b/doc/qbk/07_concepts/Fields.qbk index 381463f389..cb3c8d5f7e 100644 --- a/doc/qbk/07_concepts/Fields.qbk +++ b/doc/qbk/07_concepts/Fields.qbk @@ -30,7 +30,7 @@ In this table: * `c` denotes a (possibly const) value of type `F`. * `b` is a value of type `bool` * `n` is a value of type `boost::optional`. -* `s` is a value of type [link beast.ref.boost__beast__string_view `string_view`]. +* `s` is a value of type [link beast.ref.boost__beast__string_view `core::string_view`]. * `v` is a value of type `unsigned int` representing the HTTP-version. [table Valid expressions @@ -43,7 +43,7 @@ In this table: ] ][ [`c.get_method_impl()`] - [`string_view`] + [`core::string_view`] [ Returns the method text. The implementation only calls this function for request @@ -52,14 +52,14 @@ In this table: ] ][ [`c.get_target_impl()`] - [`string_view`] + [`core::string_view`] [ Returns the target string. The implementation only calls this function for request headers. ] ][ [`c.get_reason_impl()`] - [`string_view`] + [`core::string_view`] [ Returns the obsolete request text. The implementation only calls this for response headers when diff --git a/doc/qbk/08_design/1_http_message.qbk b/doc/qbk/08_design/1_http_message.qbk index cd3154c3df..435b2f2a69 100644 --- a/doc/qbk/08_design/1_http_message.qbk +++ b/doc/qbk/08_design/1_http_message.qbk @@ -254,15 +254,15 @@ a requirement to the [*Fields] type. First, the interface change: template struct header : Fields { - int version; + int version; - verb method() const; - string_view method_string() const; - void method(verb); - void method(string_view); + verb method() const; + core::string_view method_string() const; + void method(verb); + void method(core::string_view); - string_view target(); const; - void target(string_view); + core::string_view target(); const; + void target(core::string_view); private: verb method_; @@ -272,10 +272,10 @@ private: template struct header : Fields { - int version; - int result; - string_view reason() const; - void reason(string_view); + int version; + int result; + core::string_view reason() const; + void reason(core::string_view); }; ``` @@ -298,14 +298,14 @@ struct header : Fields int version; int status; - string_view + core::string_view reason() const { return this->reason_impl(); // protected member of Fields } void - reason(string_view s) + reason(core::string_view s) { this->reason_impl(s); // protected member of Fields } diff --git a/doc/qbk/release_notes.qbk b/doc/qbk/release_notes.qbk index 85768e9904..0f371575fe 100644 --- a/doc/qbk/release_notes.qbk +++ b/doc/qbk/release_notes.qbk @@ -426,7 +426,7 @@ * [issue 1956] Deprecate `string_param` (API Change) ['Actions Required] `string_param`, which was previously the argument type when setting field values - has been replaced by `string_view`. Because of this, it is no longer possible to + has been replaced by `core::string_view`. Because of this, it is no longer possible to set message field values directly as integrals. Users are requied to convert numeric arguments to a string type prior to calling `fields::set` et. al. diff --git a/example/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp b/example/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp index d33eba9832..d8cf7cd784 100644 --- a/example/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp +++ b/example/advanced/server-flex-awaitable/advanced_server_flex_awaitable.cpp @@ -36,21 +36,22 @@ namespace http = beast::http; namespace websocket = beast::websocket; namespace net = boost::asio; namespace ssl = boost::asio::ssl; +namespace core = boost::core; using executor_type = net::strand; using stream_type = typename beast::tcp_stream::rebind_executor::other; using acceptor_type = typename net::ip::tcp::acceptor::rebind_executor::other; // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -81,8 +82,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -111,12 +112,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -129,7 +130,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -142,7 +143,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -161,7 +162,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file @@ -416,7 +417,7 @@ net::awaitable run_session( Stream& stream, beast::flat_buffer& buffer, - beast::string_view doc_root) + core::string_view doc_root) { auto cs = co_await net::this_coro::cancellation_state; @@ -457,7 +458,7 @@ net::awaitable detect_session( stream_type stream, ssl::context& ctx, - beast::string_view doc_root) + core::string_view doc_root) { beast::flat_buffer buffer; @@ -509,7 +510,7 @@ listen( task_group& task_group, ssl::context& ctx, net::ip::tcp::endpoint endpoint, - beast::string_view doc_root) + core::string_view doc_root) { auto cs = co_await net::this_coro::cancellation_state; auto executor = co_await net::this_coro::executor; @@ -600,7 +601,7 @@ main(int argc, char* argv[]) auto const address = net::ip::make_address(argv[1]); auto const port = static_cast(std::atoi(argv[2])); auto const endpoint = net::ip::tcp::endpoint{ address, port }; - auto const doc_root = beast::string_view{ argv[3] }; + auto const doc_root = core::string_view{ argv[3] }; auto const threads = std::max(1, std::atoi(argv[4])); // The io_context is required for all I/O diff --git a/example/advanced/server-flex/advanced_server_flex.cpp b/example/advanced/server-flex/advanced_server_flex.cpp index c04c91d18e..0abad8c1dd 100644 --- a/example/advanced/server-flex/advanced_server_flex.cpp +++ b/example/advanced/server-flex/advanced_server_flex.cpp @@ -41,18 +41,19 @@ namespace http = beast::http; // from namespace websocket = beast::websocket; // from namespace net = boost::asio; // from namespace ssl = boost::asio::ssl; // from +namespace core = boost::core; // from using tcp = boost::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -83,8 +84,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -113,12 +114,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -131,7 +132,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -144,7 +145,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -163,7 +164,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/advanced/server/advanced_server.cpp b/example/advanced/server/advanced_server.cpp index e854b2a6e2..77b579caf1 100644 --- a/example/advanced/server/advanced_server.cpp +++ b/example/advanced/server/advanced_server.cpp @@ -38,17 +38,18 @@ namespace http = beast::http; // from namespace websocket = beast::websocket; // from namespace net = boost::asio; // from using tcp = boost::asio::ip::tcp; // from +namespace core = boost::core; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -79,8 +80,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -109,12 +110,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -127,7 +128,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -140,7 +141,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -159,7 +160,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/doc/http_examples.hpp b/example/doc/http_examples.hpp index dac3e248b2..94398c334f 100644 --- a/example/doc/http_examples.hpp +++ b/example/doc/http_examples.hpp @@ -376,7 +376,7 @@ response do_head_request( SyncStream& stream, DynamicBuffer& buffer, - string_view target, + core::string_view target, error_code& ec) { // Do some type checking to be a good citizen @@ -978,9 +978,9 @@ print_chunked_body( // Declare our chunk header callback This is invoked // after each chunk header and also after the last chunk. auto header_cb = - [&](std::uint64_t size, // Size of the chunk, or zero for the last chunk - string_view extensions, // The raw chunk-extensions string. Already validated. - error_code& ev) // We can set this to indicate an error + [&](std::uint64_t size, // Size of the chunk, or zero for the last chunk + core::string_view extensions, // The raw chunk-extensions string. Already validated. + error_code& ev) // We can set this to indicate an error { // Parse the chunk extensions so we can access them easily ce.parse(extensions, ev); @@ -1007,9 +1007,9 @@ print_chunked_body( // Declare the chunk body callback. This is called one or // more times for each piece of a chunk body. auto body_cb = - [&](std::uint64_t remain, // The number of bytes left in this chunk - string_view body, // A buffer holding chunk body data - error_code& ec) // We can set this to indicate an error + [&](std::uint64_t remain, // The number of bytes left in this chunk + core::string_view body, // A buffer holding chunk body data + error_code& ec) // We can set this to indicate an error { // If this is the last piece of the chunk body, // set the error so that the call to `read` returns diff --git a/example/http/client/methods/http_client_methods.cpp b/example/http/client/methods/http_client_methods.cpp index f48cf99b74..83a84f899b 100644 --- a/example/http/client/methods/http_client_methods.cpp +++ b/example/http/client/methods/http_client_methods.cpp @@ -27,6 +27,7 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from +namespace core = boost::core; // from using tcp = net::ip::tcp; // from @@ -147,7 +148,7 @@ int main(int argc, char** argv) for (char * c = argv[1]; *c != '\0'; c++) *c = static_cast(std::tolower(*c)); - beast::string_view method{argv[1]}; + core::string_view method{argv[1]}; // The io_context is required for all I/O net::io_context ioc; diff --git a/example/http/server/async-local/http_server_async_local.cpp b/example/http/server/async-local/http_server_async_local.cpp index b958b89fe9..aab49bd9d5 100644 --- a/example/http/server/async-local/http_server_async_local.cpp +++ b/example/http/server/async-local/http_server_async_local.cpp @@ -36,17 +36,18 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from using stream_protocol = net::local::stream_protocol; // from +namespace core = boost::core; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -77,8 +78,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -107,12 +108,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -125,7 +126,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -138,7 +139,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -157,7 +158,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/async-ssl/http_server_async_ssl.cpp b/example/http/server/async-ssl/http_server_async_ssl.cpp index b6498d3a2d..e7161d13dd 100644 --- a/example/http/server/async-ssl/http_server_async_ssl.cpp +++ b/example/http/server/async-ssl/http_server_async_ssl.cpp @@ -34,18 +34,19 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from namespace ssl = boost::asio::ssl; // from +namespace core = boost::core; // from using tcp = boost::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -76,8 +77,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -106,12 +107,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -124,7 +125,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -137,7 +138,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -156,7 +157,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/async/http_server_async.cpp b/example/http/server/async/http_server_async.cpp index 617701d2a3..32de9f6f5b 100644 --- a/example/http/server/async/http_server_async.cpp +++ b/example/http/server/async/http_server_async.cpp @@ -32,17 +32,18 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from using tcp = boost::asio::ip::tcp; // from +namespace core = boost::core; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -73,8 +74,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -103,12 +104,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -121,7 +122,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -134,7 +135,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -153,7 +154,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/awaitable/http_server_awaitable.cpp b/example/http/server/awaitable/http_server_awaitable.cpp index 0933bd5436..a45b68c65a 100644 --- a/example/http/server/awaitable/http_server_awaitable.cpp +++ b/example/http/server/awaitable/http_server_awaitable.cpp @@ -35,17 +35,18 @@ namespace beast = boost::beast; namespace http = beast::http; namespace net = boost::asio; +namespace core = boost::core; // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -76,8 +77,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -106,12 +107,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -124,7 +125,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -137,7 +138,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -156,7 +157,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/coro-ssl/http_server_coro_ssl.cpp b/example/http/server/coro-ssl/http_server_coro_ssl.cpp index 93e3b2f315..7ffb46e3dd 100644 --- a/example/http/server/coro-ssl/http_server_coro_ssl.cpp +++ b/example/http/server/coro-ssl/http_server_coro_ssl.cpp @@ -34,18 +34,19 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from namespace ssl = boost::asio::ssl; // from +namespace core = boost::core; // from using tcp = boost::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -76,8 +77,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -106,12 +107,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -124,7 +125,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -137,7 +138,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -156,7 +157,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/coro/http_server_coro.cpp b/example/http/server/coro/http_server_coro.cpp index 213bb4161e..061388cc2c 100644 --- a/example/http/server/coro/http_server_coro.cpp +++ b/example/http/server/coro/http_server_coro.cpp @@ -32,17 +32,18 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from using tcp = boost::asio::ip::tcp; // from +namespace core = boost::core; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -73,8 +74,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -103,12 +104,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -121,7 +122,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -134,7 +135,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -153,7 +154,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/fast/http_server_fast.cpp b/example/http/server/fast/http_server_fast.cpp index 3ddd8bb111..61968b28e8 100644 --- a/example/http/server/fast/http_server_fast.cpp +++ b/example/http/server/fast/http_server_fast.cpp @@ -30,18 +30,19 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from +namespace core = boost::core; // from using tcp = boost::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -230,7 +231,7 @@ class http_worker }); } - void send_file(beast::string_view target) + void send_file(core::string_view target) { // Request path must be absolute and not contain "..". if (target.empty() || target[0] != '/' || target.find("..") != std::string::npos) diff --git a/example/http/server/flex/http_server_flex.cpp b/example/http/server/flex/http_server_flex.cpp index b586fb7f54..82339da55c 100644 --- a/example/http/server/flex/http_server_flex.cpp +++ b/example/http/server/flex/http_server_flex.cpp @@ -33,18 +33,19 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from namespace ssl = boost::asio::ssl; // from +namespace core = boost::core; // from using tcp = boost::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -75,8 +76,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -105,12 +106,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -123,7 +124,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -136,7 +137,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -155,7 +156,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp b/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp index 8573022589..77b4c20a8c 100644 --- a/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp +++ b/example/http/server/stackless-ssl/http_server_stackless_ssl.cpp @@ -36,18 +36,19 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from namespace ssl = boost::asio::ssl; // from +namespace core = boost::core; // from using tcp = boost::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -78,8 +79,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -108,12 +109,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -126,7 +127,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -139,7 +140,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -158,7 +159,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/stackless/http_server_stackless.cpp b/example/http/server/stackless/http_server_stackless.cpp index 87d0fccc6e..ec57cb63c6 100644 --- a/example/http/server/stackless/http_server_stackless.cpp +++ b/example/http/server/stackless/http_server_stackless.cpp @@ -33,17 +33,18 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from using tcp = boost::asio::ip::tcp; // from +namespace core = boost::core; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -74,8 +75,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -104,12 +105,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -122,7 +123,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -135,7 +136,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -154,7 +155,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/sync-ssl/http_server_sync_ssl.cpp b/example/http/server/sync-ssl/http_server_sync_ssl.cpp index 3571638ee4..ca7b545ba0 100644 --- a/example/http/server/sync-ssl/http_server_sync_ssl.cpp +++ b/example/http/server/sync-ssl/http_server_sync_ssl.cpp @@ -32,18 +32,19 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from namespace ssl = boost::asio::ssl; // from +namespace core = boost::core; // from using tcp = boost::asio::ip::tcp; // from // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -74,8 +75,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -104,12 +105,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -122,7 +123,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -135,7 +136,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -154,7 +155,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/http/server/sync/http_server_sync.cpp b/example/http/server/sync/http_server_sync.cpp index 09a3af31e1..3eda215709 100644 --- a/example/http/server/sync/http_server_sync.cpp +++ b/example/http/server/sync/http_server_sync.cpp @@ -28,19 +28,20 @@ namespace beast = boost::beast; // from namespace http = beast::http; // from namespace net = boost::asio; // from using tcp = boost::asio::ip::tcp; // from +namespace core = boost::core; // from //------------------------------------------------------------------------------ // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -71,8 +72,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if (base.empty()) return std::string(path); @@ -101,12 +102,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -119,7 +120,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -132,7 +133,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -151,7 +152,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/example/websocket/server/chat-multi/http_session.cpp b/example/websocket/server/chat-multi/http_session.cpp index ee6cb0c3bc..c60ce997d9 100644 --- a/example/websocket/server/chat-multi/http_session.cpp +++ b/example/websocket/server/chat-multi/http_session.cpp @@ -12,18 +12,20 @@ #include #include +namespace core = boost::core; // from + //------------------------------------------------------------------------------ // Return a reasonable mime type based on the extension of a file. -beast::string_view -mime_type(beast::string_view path) +core::string_view +mime_type(core::string_view path) { using beast::iequals; auto const ext = [&path] { auto const pos = path.rfind("."); - if(pos == beast::string_view::npos) - return beast::string_view{}; + if(pos == core::string_view::npos) + return core::string_view{}; return path.substr(pos); }(); if(iequals(ext, ".htm")) return "text/html"; @@ -54,8 +56,8 @@ mime_type(beast::string_view path) // The returned path is normalized for the platform. std::string path_cat( - beast::string_view base, - beast::string_view path) + core::string_view base, + core::string_view path) { if(base.empty()) return std::string(path); @@ -84,12 +86,12 @@ path_cat( template http::message_generator handle_request( - beast::string_view doc_root, + core::string_view doc_root, http::request>&& req) { // Returns a bad request response auto const bad_request = - [&req](beast::string_view why) + [&req](core::string_view why) { http::response res{http::status::bad_request, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -102,7 +104,7 @@ handle_request( // Returns a not found response auto const not_found = - [&req](beast::string_view target) + [&req](core::string_view target) { http::response res{http::status::not_found, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -115,7 +117,7 @@ handle_request( // Returns a server error response auto const server_error = - [&req](beast::string_view what) + [&req](core::string_view what) { http::response res{http::status::internal_server_error, req.version()}; res.set(http::field::server, BOOST_BEAST_VERSION_STRING); @@ -134,7 +136,7 @@ handle_request( // Request path must be absolute and not contain "..". if( req.target().empty() || req.target()[0] != '/' || - req.target().find("..") != beast::string_view::npos) + req.target().find("..") != core::string_view::npos) return bad_request("Illegal request-target"); // Build the path to the requested file diff --git a/include/boost/beast/_experimental/test/impl/stream.ipp b/include/boost/beast/_experimental/test/impl/stream.ipp index 82395ba140..790c17df07 100644 --- a/include/boost/beast/_experimental/test/impl/stream.ipp +++ b/include/boost/beast/_experimental/test/impl/stream.ipp @@ -123,7 +123,7 @@ template basic_stream:: basic_stream( net::io_context& ioc, - string_view s) + core::string_view s) : in_(detail::stream_service::make_impl(ioc.get_executor(), nullptr)) { in_->b.commit(net::buffer_copy( @@ -136,7 +136,7 @@ basic_stream:: basic_stream( net::io_context& ioc, fail_count& fc, - string_view s) + core::string_view s) : in_(detail::stream_service::make_impl(ioc.get_executor(), &fc)) { in_->b.commit(net::buffer_copy( @@ -161,7 +161,7 @@ connect(basic_stream& remote) } template -string_view +core::string_view basic_stream:: str() const { @@ -175,7 +175,7 @@ str() const template void basic_stream:: -append(string_view s) +append(core::string_view s) { std::lock_guard lock{in_->m}; in_->b.commit(net::buffer_copy( diff --git a/include/boost/beast/_experimental/test/stream.hpp b/include/boost/beast/_experimental/test/stream.hpp index 4afc79e10b..a7689b3e7b 100644 --- a/include/boost/beast/_experimental/test/stream.hpp +++ b/include/boost/beast/_experimental/test/stream.hpp @@ -281,7 +281,7 @@ class basic_stream */ basic_stream( net::io_context& ioc, - string_view s); + core::string_view s); /** Construct a stream @@ -301,7 +301,7 @@ class basic_stream basic_stream( net::io_context& ioc, fail_count& fc, - string_view s); + core::string_view s); /// Establish a connection void @@ -333,12 +333,12 @@ class basic_stream } /// Returns a string view representing the pending input data - string_view + core::string_view str() const; /// Appends a string to the pending input data void - append(string_view s); + append(core::string_view s); /// Clear the pending input area void diff --git a/include/boost/beast/core/detail/impl/temporary_buffer.ipp b/include/boost/beast/core/detail/impl/temporary_buffer.ipp index 932e847371..9ea06be1a5 100644 --- a/include/boost/beast/core/detail/impl/temporary_buffer.ipp +++ b/include/boost/beast/core/detail/impl/temporary_buffer.ipp @@ -23,7 +23,7 @@ namespace detail { void temporary_buffer:: -append(string_view s) +append(core::string_view s) { grow(s.size()); unchecked_append(s); @@ -31,7 +31,7 @@ append(string_view s) void temporary_buffer:: -append(string_view s1, string_view s2) +append(core::string_view s1, core::string_view s2) { grow(s1.size() + s2.size()); unchecked_append(s1); @@ -40,7 +40,7 @@ append(string_view s1, string_view s2) void temporary_buffer:: -unchecked_append(string_view s) +unchecked_append(core::string_view s) { auto n = s.size(); std::memcpy(&data_[size_], s.data(), n); diff --git a/include/boost/beast/core/detail/static_ostream.hpp b/include/boost/beast/core/detail/static_ostream.hpp index 5eaa413b30..22014b6175 100644 --- a/include/boost/beast/core/detail/static_ostream.hpp +++ b/include/boost/beast/core/detail/static_ostream.hpp @@ -50,7 +50,7 @@ class static_ostream_buffer { } - string_view + core::string_view str() const { if(! s_.empty()) @@ -128,7 +128,7 @@ class static_ostream : public std::basic_ostream imbue(std::locale::classic()); } - string_view + core::string_view str() const { return osb_.str(); diff --git a/include/boost/beast/core/detail/string.hpp b/include/boost/beast/core/detail/string.hpp index fcaefb8822..bf7b059549 100644 --- a/include/boost/beast/core/detail/string.hpp +++ b/include/boost/beast/core/detail/string.hpp @@ -22,10 +22,10 @@ namespace detail { namespace string_literals { inline -string_view +core::string_view operator""_sv(char const* p, std::size_t n) { - return string_view{p, n}; + return core::string_view{p, n}; } } // string_literals diff --git a/include/boost/beast/core/detail/temporary_buffer.hpp b/include/boost/beast/core/detail/temporary_buffer.hpp index 8285b8f7eb..14526b1333 100644 --- a/include/boost/beast/core/detail/temporary_buffer.hpp +++ b/include/boost/beast/core/detail/temporary_buffer.hpp @@ -32,13 +32,13 @@ struct temporary_buffer BOOST_BEAST_DECL void - append(string_view s); + append(core::string_view s); BOOST_BEAST_DECL void - append(string_view s1, string_view s2); + append(core::string_view s1, core::string_view s2); - string_view + core::string_view view() const noexcept { return {data_, size_}; @@ -53,7 +53,7 @@ struct temporary_buffer private: BOOST_BEAST_DECL void - unchecked_append(string_view s); + unchecked_append(core::string_view s); BOOST_BEAST_DECL void diff --git a/include/boost/beast/core/impl/string.ipp b/include/boost/beast/core/impl/string.ipp index 7f0949eae4..3652f89a13 100644 --- a/include/boost/beast/core/impl/string.ipp +++ b/include/boost/beast/core/impl/string.ipp @@ -20,8 +20,8 @@ namespace beast { bool iequals( - beast::string_view lhs, - beast::string_view rhs) + core::string_view lhs, + core::string_view rhs) { if(lhs.size() != rhs.size()) return false; @@ -50,8 +50,8 @@ slow: bool iless::operator()( - string_view lhs, - string_view rhs) const + core::string_view lhs, + core::string_view rhs) const { using std::begin; using std::end; diff --git a/include/boost/beast/core/impl/string_param.hpp b/include/boost/beast/core/impl/string_param.hpp index 9d9278382a..4ec1028e33 100644 --- a/include/boost/beast/core/impl/string_param.hpp +++ b/include/boost/beast/core/impl/string_param.hpp @@ -30,7 +30,7 @@ print(T const& t) template typename std::enable_if< ! std::is_integral::value && - ! std::is_convertible::value + ! std::is_convertible::value >::type string_param:: print(T const& t) @@ -44,7 +44,7 @@ print(T const& t) inline void string_param:: -print(string_view sv) +print(core::string_view sv) { sv_ = sv; } @@ -60,7 +60,7 @@ print_1(T const& t) auto const it = detail::raw_to_string< char, T, std::char_traits>( last, sizeof(buf), t); - *os_ << string_view{it, + *os_ << core::string_view{it, static_cast(last - it)}; } diff --git a/include/boost/beast/core/string.hpp b/include/boost/beast/core/string.hpp index 61883643f3..64386a907c 100644 --- a/include/boost/beast/core/string.hpp +++ b/include/boost/beast/core/string.hpp @@ -27,8 +27,8 @@ namespace beast { BOOST_BEAST_DECL bool iequals( - beast::string_view lhs, - beast::string_view rhs); + core::string_view lhs, + core::string_view rhs); /** A case-insensitive less predicate for strings. @@ -36,15 +36,15 @@ iequals( As of C++14, containers using this class as the `Compare` type will take part in heterogeneous lookup if the search term is implicitly convertible to - @ref string_view. + @ref core::string_view. */ struct iless { BOOST_BEAST_DECL bool operator()( - string_view lhs, - string_view rhs) const; + core::string_view lhs, + core::string_view rhs) const; using is_transparent = void; }; @@ -55,14 +55,14 @@ struct iless As of C++14, containers using this class as the `Compare` type will take part in heterogeneous lookup if the search term is implicitly convertible to - @ref string_view. + @ref core::string_view. */ struct iequal { bool operator()( - string_view lhs, - string_view rhs) const + core::string_view lhs, + core::string_view rhs) const { return iequals(lhs, rhs); } diff --git a/include/boost/beast/core/string_param.hpp b/include/boost/beast/core/string_param.hpp index 71e231c295..16f0edbc7a 100644 --- a/include/boost/beast/core/string_param.hpp +++ b/include/boost/beast/core/string_param.hpp @@ -43,7 +43,7 @@ namespace beast { */ class string_param { - string_view sv_; + core::string_view sv_; char buf_[128]; boost::optional os_; @@ -55,12 +55,12 @@ class string_param template typename std::enable_if< ! std::is_integral::value && - ! std::is_convertible::value + ! std::is_convertible::value >::type print(T const&); void - print(string_view); + print(core::string_view); template typename std::enable_if< @@ -98,7 +98,7 @@ class string_param the result of streaming each argument in order into an output stream. It is used as a notational convenience at call sites which expect a parameter with the semantics - of a @ref string_view. + of a @ref core::string_view. The implementation uses a small, internal static buffer to avoid memory allocations especially for the case where @@ -111,14 +111,14 @@ class string_param string_param(Args const&... args); /// Returns the contained string - string_view + core::string_view str() const { return sv_; } - /// Implicit conversion to @ref string_view - operator string_view const() const + /// Implicit conversion to @ref core::string_view + operator core::string_view const() const { return sv_; } diff --git a/include/boost/beast/core/string_type.hpp b/include/boost/beast/core/string_type.hpp index 4bc6e5c67f..5c09c7172d 100644 --- a/include/boost/beast/core/string_type.hpp +++ b/include/boost/beast/core/string_type.hpp @@ -16,19 +16,11 @@ namespace boost { namespace beast { -/// The type of string view used by the library -using string_view = boost::core::string_view; - -/// The type of `basic_string_view` used by the library -template -using basic_string_view = - boost::core::basic_string_view; - template -inline string_view +inline core::string_view to_string_view(const S& s) { - return string_view(s.data(), s.size()); + return core::string_view(s.data(), s.size()); } } // beast diff --git a/include/boost/beast/http/basic_parser.hpp b/include/boost/beast/http/basic_parser.hpp index b84de80520..392d25bbcb 100644 --- a/include/boost/beast/http/basic_parser.hpp +++ b/include/boost/beast/http/basic_parser.hpp @@ -461,8 +461,8 @@ class basic_parser void on_request_impl( verb method, - string_view method_str, - string_view target, + core::string_view method_str, + core::string_view target, int version, error_code& ec) = 0; @@ -488,7 +488,7 @@ class basic_parser void on_response_impl( int code, - string_view reason, + core::string_view reason, int version, error_code& ec) = 0; @@ -512,8 +512,8 @@ class basic_parser void on_field_impl( field name, - string_view name_string, - string_view value, + core::string_view name_string, + core::string_view value, error_code& ec) = 0; /** Called once for each complete field in the HTTP trailer header. @@ -536,8 +536,8 @@ class basic_parser void on_trailer_field_impl( field name, - string_view name_string, - string_view value, + core::string_view name_string, + core::string_view value, error_code& ec) = 0; /** Called once after the complete HTTP header is received. @@ -587,7 +587,7 @@ class basic_parser virtual std::size_t on_body_impl( - string_view body, + core::string_view body, error_code& ec) = 0; /** Called each time a new chunk header of a chunk encoded body is received. @@ -607,7 +607,7 @@ class basic_parser void on_chunk_header_impl( std::uint64_t size, - string_view extensions, + core::string_view extensions, error_code& ec) = 0; /** Called each time additional data is received representing part of a body chunk. @@ -636,7 +636,7 @@ class basic_parser std::size_t on_chunk_body_impl( std::uint64_t remain, - string_view body, + core::string_view body, error_code& ec) = 0; /** Called once when the complete message is received. @@ -714,7 +714,7 @@ class basic_parser void do_field(field f, - string_view value, error_code& ec); + core::string_view value, error_code& ec); }; } // http diff --git a/include/boost/beast/http/chunk_encode.hpp b/include/boost/beast/http/chunk_encode.hpp index 8b8ff651c7..d46a392eae 100644 --- a/include/boost/beast/http/chunk_encode.hpp +++ b/include/boost/beast/http/chunk_encode.hpp @@ -154,7 +154,7 @@ class chunk_header */ chunk_header( std::size_t size, - string_view extensions); + core::string_view extensions); /** Constructor @@ -169,7 +169,7 @@ class chunk_header @param extensions The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must - be convertible to @ref string_view. This object will be copied + be convertible to @ref core::string_view. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. @@ -202,7 +202,7 @@ class chunk_header @param extensions The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must - be convertible to @ref string_view. This object will be copied + be convertible to @ref core::string_view. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. @@ -342,7 +342,7 @@ class chunk_body */ chunk_body( ConstBufferSequence const& buffers, - string_view extensions); + core::string_view extensions); /** Constructor @@ -360,7 +360,7 @@ class chunk_body @param extensions The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must - be convertible to @ref string_view. This object will be copied + be convertible to @ref core::string_view. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. @@ -373,7 +373,7 @@ class chunk_body #if ! BOOST_BEAST_DOXYGEN , class = typename std::enable_if< ! std::is_convertible::type, string_view>::value>::type + ChunkExtensions>::type, core::string_view>::value>::type #endif > chunk_body( @@ -396,7 +396,7 @@ class chunk_body @param extensions The chunk extensions object. The expression `extensions.str()` must be valid, and the return type must - be convertible to @ref string_view. This object will be copied + be convertible to @ref core::string_view. This object will be copied or moved as needed to ensure that the chunk header object retains ownership of the buffers provided by the chunk extensions object. @@ -412,7 +412,7 @@ class chunk_body #if ! BOOST_BEAST_DOXYGEN , class = typename std::enable_if< ! std::is_convertible::type, string_view>::value>::type + ChunkExtensions>::type, core::string_view>::value>::type #endif > chunk_body( @@ -582,7 +582,7 @@ class basic_chunk_extensions do_parse(FwdIt it, FwdIt last, error_code& ec); void - do_insert(string_view name, string_view value); + do_insert(core::string_view name, core::string_view value); public: /** The type of value when iterating. @@ -591,7 +591,7 @@ class basic_chunk_extensions element is the value which may be empty. The value is stored in its raw representation, without quotes or escapes. */ - using value_type = std::pair; + using value_type = std::pair; class const_iterator; @@ -630,14 +630,14 @@ class basic_chunk_extensions Any previous extensions will be cleared */ void - parse(string_view s, error_code& ec); + parse(core::string_view s, error_code& ec); /** Insert an extension name with an empty value @param name The name of the extension */ void - insert(string_view name); + insert(core::string_view name); /** Insert an extension value @@ -647,10 +647,10 @@ class basic_chunk_extensions contents, the serialized extension may use a quoted string. */ void - insert(string_view name, string_view value); + insert(core::string_view name, core::string_view value); /// Return the serialized representation of the chunk extension - string_view + core::string_view str() const { return s_; diff --git a/include/boost/beast/http/detail/basic_parsed_list.hpp b/include/boost/beast/http/detail/basic_parsed_list.hpp index 53ce60976d..764271e3d3 100644 --- a/include/boost/beast/http/detail/basic_parsed_list.hpp +++ b/include/boost/beast/http/detail/basic_parsed_list.hpp @@ -25,7 +25,7 @@ namespace detail { template class basic_parsed_list { - string_view s_; + core::string_view s_; public: /// The type of policy this list uses for parsing. @@ -130,7 +130,7 @@ class basic_parsed_list /// Construct a list from a string explicit - basic_parsed_list(string_view s) + basic_parsed_list(core::string_view s) : s_(s) { } diff --git a/include/boost/beast/http/detail/basic_parser.hpp b/include/boost/beast/http/detail/basic_parser.hpp index 5fa25333f8..c998bb2a5b 100644 --- a/include/boost/beast/http/detail/basic_parser.hpp +++ b/include/boost/beast/http/detail/basic_parser.hpp @@ -74,7 +74,7 @@ struct basic_parser_base char const* it, char const* first); static - string_view + core::string_view make_string(char const* first, char const* last) { return {first, static_cast< @@ -123,7 +123,7 @@ struct basic_parser_base BOOST_BEAST_DECL static bool - parse_dec(string_view s, std::uint64_t& v); + parse_dec(core::string_view s, std::uint64_t& v); BOOST_BEAST_DECL static @@ -140,14 +140,14 @@ struct basic_parser_base void parse_method( char const*& it, char const* last, - string_view& result, error_code& ec); + core::string_view& result, error_code& ec); BOOST_BEAST_DECL static void parse_target( char const*& it, char const* last, - string_view& result, error_code& ec); + core::string_view& result, error_code& ec); BOOST_BEAST_DECL static @@ -168,7 +168,7 @@ struct basic_parser_base void parse_reason( char const*& it, char const* last, - string_view& result, error_code& ec); + core::string_view& result, error_code& ec); BOOST_BEAST_DECL static @@ -176,8 +176,8 @@ struct basic_parser_base parse_field( char const*& p, char const* last, - string_view& name, - string_view& value, + core::string_view& name, + core::string_view& value, beast::detail::char_buffer& buf, error_code& ec); diff --git a/include/boost/beast/http/detail/basic_parser.ipp b/include/boost/beast/http/detail/basic_parser.ipp index 117fd36a38..105468d1e0 100644 --- a/include/boost/beast/http/detail/basic_parser.ipp +++ b/include/boost/beast/http/detail/basic_parser.ipp @@ -155,7 +155,7 @@ find_eol( bool basic_parser_base:: parse_dec( - string_view s, + core::string_view s, std::uint64_t& v) { char const* it = s.data(); @@ -271,7 +271,7 @@ void basic_parser_base:: parse_method( char const*& it, char const* last, - string_view& result, error_code& ec) + core::string_view& result, error_code& ec) { // parse token SP auto const first = it; @@ -308,7 +308,7 @@ void basic_parser_base:: parse_target( char const*& it, char const* last, - string_view& result, error_code& ec) + core::string_view& result, error_code& ec) { // parse target SP auto const first = it; @@ -437,7 +437,7 @@ void basic_parser_base:: parse_reason( char const*& it, char const* last, - string_view& result, error_code& ec) + core::string_view& result, error_code& ec) { auto const first = it; char const* token_last = nullptr; @@ -459,8 +459,8 @@ basic_parser_base:: parse_field( char const*& p, char const* last, - string_view& name, - string_view& value, + core::string_view& name, + core::string_view& value, beast::detail::char_buffer& buf, error_code& ec) { diff --git a/include/boost/beast/http/detail/chunk_encode.hpp b/include/boost/beast/http/detail/chunk_encode.hpp index fe38e7a6c8..dba405d2ec 100644 --- a/include/boost/beast/http/detail/chunk_encode.hpp +++ b/include/boost/beast/http/detail/chunk_encode.hpp @@ -56,7 +56,7 @@ struct is_chunk_extensions : std::false_type {}; template struct is_chunk_extensions() = std::declval().str() + std::declval() = std::declval().str() )>> : std::true_type { }; diff --git a/include/boost/beast/http/detail/rfc7230.hpp b/include/boost/beast/http/detail/rfc7230.hpp index 1699f0c7f3..63cc9f8980 100644 --- a/include/boost/beast/http/detail/rfc7230.hpp +++ b/include/boost/beast/http/detail/rfc7230.hpp @@ -58,17 +58,17 @@ std::int8_t unhex(char c); BOOST_BEAST_DECL -string_view -trim(string_view s); +core::string_view +trim(core::string_view s); struct param_iter { - using iter_type = string_view::const_iterator; + using iter_type = core::string_view::const_iterator; iter_type it; iter_type first; iter_type last; - std::pair v; + std::pair v; bool empty() const @@ -86,12 +86,12 @@ struct param_iter */ struct opt_token_list_policy { - using value_type = string_view; + using value_type = core::string_view; BOOST_BEAST_DECL bool operator()(value_type& v, - char const*& it, string_view s) const; + char const*& it, core::string_view s) const; }; } // detail diff --git a/include/boost/beast/http/detail/rfc7230.ipp b/include/boost/beast/http/detail/rfc7230.ipp index 3efa1032a4..144e1883b3 100644 --- a/include/boost/beast/http/detail/rfc7230.ipp +++ b/include/boost/beast/http/detail/rfc7230.ipp @@ -239,8 +239,8 @@ skip_token(ForwardIt& it, ForwardIt last) ++it; } -string_view -trim(string_view s) +core::string_view +trim(core::string_view s) { auto first = s.begin(); auto last = s.end(); @@ -344,7 +344,7 @@ increment() bool opt_token_list_policy::operator()(value_type& v, - char const*& it, string_view s) const + char const*& it, core::string_view s) const { v = {}; auto need_comma = it != s.data(); @@ -370,7 +370,7 @@ opt_token_list_policy::operator()(value_type& v, if(! detail::is_token_char(*it)) break; } - v = string_view{p0, + v = core::string_view{p0, static_cast(it - p0)}; return true; } diff --git a/include/boost/beast/http/detail/type_traits.hpp b/include/boost/beast/http/detail/type_traits.hpp index a9b5d64088..ee2a483164 100644 --- a/include/boost/beast/http/detail/type_traits.hpp +++ b/include/boost/beast/http/detail/type_traits.hpp @@ -45,20 +45,20 @@ struct fields_model { struct writer; - string_view method() const; - string_view reason() const; - string_view target() const; + core::string_view method() const; + core::string_view reason() const; + core::string_view target() const; protected: - string_view get_method_impl() const; - string_view get_target_impl() const; - string_view get_reason_impl() const; + core::string_view get_method_impl() const; + core::string_view get_target_impl() const; + core::string_view get_reason_impl() const; bool get_chunked_impl() const; bool get_keep_alive_impl(unsigned) const; bool has_content_length_impl() const; - void set_method_impl(string_view); - void set_target_impl(string_view); - void set_reason_impl(string_view); + void set_method_impl(core::string_view); + void set_target_impl(core::string_view); + void set_reason_impl(core::string_view); void set_chunked_impl(bool); void set_content_length_impl(boost::optional); void set_keep_alive_impl(unsigned, bool); @@ -93,21 +93,21 @@ struct is_fields_helper : T { template static auto f1(int) -> decltype( - std::declval() = std::declval().get_method_impl(), + std::declval() = std::declval().get_method_impl(), std::true_type()); static auto f1(...) -> std::false_type; using t1 = decltype(f1(0)); template static auto f2(int) -> decltype( - std::declval() = std::declval().get_target_impl(), + std::declval() = std::declval().get_target_impl(), std::true_type()); static auto f2(...) -> std::false_type; using t2 = decltype(f2(0)); template static auto f3(int) -> decltype( - std::declval() = std::declval().get_reason_impl(), + std::declval() = std::declval().get_reason_impl(), std::true_type()); static auto f3(...) -> std::false_type; using t3 = decltype(f3(0)); @@ -136,21 +136,21 @@ struct is_fields_helper : T template static auto f7(int) -> decltype( - void(std::declval().set_method_impl(std::declval())), + void(std::declval().set_method_impl(std::declval())), std::true_type()); static auto f7(...) -> std::false_type; using t7 = decltype(f7(0)); template static auto f8(int) -> decltype( - void(std::declval().set_target_impl(std::declval())), + void(std::declval().set_target_impl(std::declval())), std::true_type()); static auto f8(...) -> std::false_type; using t8 = decltype(f8(0)); template static auto f9(int) -> decltype( - void(std::declval().set_reason_impl(std::declval())), + void(std::declval().set_reason_impl(std::declval())), std::true_type()); static auto f9(...) -> std::false_type; using t9 = decltype(f9(0)); diff --git a/include/boost/beast/http/field.hpp b/include/boost/beast/http/field.hpp index 62a89ec540..6fad94ab4f 100644 --- a/include/boost/beast/http/field.hpp +++ b/include/boost/beast/http/field.hpp @@ -157,7 +157,7 @@ namespace http { @param f The field to convert */ BOOST_BEAST_DECL -string_view +core::string_view to_string(field f); /** Attempt to convert a string to a field enum. @@ -169,7 +169,7 @@ to_string(field f); */ BOOST_BEAST_DECL field -string_to_field(string_view s); +string_to_field(core::string_view s); /// Write the text for a field name to an output stream. BOOST_BEAST_DECL diff --git a/include/boost/beast/http/fields.hpp b/include/boost/beast/http/fields.hpp index 8dd92a44a7..0412cb8c72 100644 --- a/include/boost/beast/http/fields.hpp +++ b/include/boost/beast/http/fields.hpp @@ -91,7 +91,7 @@ class basic_fields protected: value_type(field name, - string_view sname, string_view value); + core::string_view sname, core::string_view value); public: /// Constructor (deleted) @@ -105,11 +105,11 @@ class basic_fields name() const; /// Returns the field name as a string - string_view const + core::string_view const name_string() const; /// Returns the value of the field - string_view const + core::string_view const value() const; }; @@ -126,7 +126,7 @@ class basic_fields /// Returns `true` if lhs is less than rhs using a strict ordering bool operator()( - string_view lhs, + core::string_view lhs, value_type const& rhs) const noexcept { if(lhs.size() < rhs.name_string().size()) @@ -140,7 +140,7 @@ class basic_fields bool operator()( value_type const& lhs, - string_view rhs) const noexcept + core::string_view rhs) const noexcept { if(lhs.name_string().size() < rhs.size()) return true; @@ -181,7 +181,7 @@ class basic_fields , public value_type { element(field name, - string_view sname, string_view value); + core::string_view sname, core::string_view value); }; using list_t = typename boost::intrusive::make_list< @@ -327,7 +327,7 @@ class basic_fields @throws std::out_of_range if the field is not found. */ - string_view const + core::string_view const at(field name) const; /** Returns the value for a field, or throws an exception. @@ -341,8 +341,8 @@ class basic_fields @throws std::out_of_range if the field is not found. */ - string_view const - at(string_view name) const; + core::string_view const + at(core::string_view name) const; /** Returns the value for a field, or `""` if it does not exist. @@ -351,7 +351,7 @@ class basic_fields @param name The name of the field. */ - string_view const + core::string_view const operator[](field name) const; /** Returns the value for a case-insensitive matching header, or `""` if it does not exist. @@ -361,8 +361,8 @@ class basic_fields @param name The name of the field. It is interpreted as a case-insensitive string. */ - string_view const - operator[](string_view name) const; + core::string_view const + operator[](core::string_view name) const; //-------------------------------------------------------------------------- // @@ -450,7 +450,7 @@ class basic_fields error code will be @ref error::header_field_value_too_large. */ void - insert(field name, string_view value); + insert(field name, core::string_view value); void insert(field, std::nullptr_t) = delete; @@ -473,10 +473,10 @@ class basic_fields error code will be @ref error::header_field_value_too_large. */ void - insert(string_view name, string_view value); + insert(core::string_view name, core::string_view value); void - insert(string_view, std::nullptr_t) = delete; + insert(core::string_view, std::nullptr_t) = delete; /** Insert a field. @@ -501,11 +501,11 @@ class basic_fields error code will be @ref error::header_field_value_too_large. */ void - insert(field name, string_view name_string, - string_view value); + insert(field name, core::string_view name_string, + core::string_view value); void - insert(field, string_view, std::nullptr_t) = delete; + insert(field, core::string_view, std::nullptr_t) = delete; /** Insert a field. @@ -530,11 +530,11 @@ class basic_fields error code will be @ref error::header_field_value_too_large. */ void - insert(field name, string_view name_string, - string_view value, error_code& ec); + insert(field name, core::string_view name_string, + core::string_view value, error_code& ec); void - insert(field, string_view, std::nullptr_t, error_code& ec) = delete; + insert(field, core::string_view, std::nullptr_t, error_code& ec) = delete; /** Set a field value, removing any other instances of that field. @@ -550,7 +550,7 @@ class basic_fields error code will be @ref error::header_field_value_too_large. */ void - set(field name, string_view value); + set(field name, core::string_view value); void set(field, std::nullptr_t) = delete; @@ -571,10 +571,10 @@ class basic_fields error code will be @ref error::header_field_value_too_large. */ void - set(string_view name, string_view value); + set(core::string_view name, core::string_view value); void - set(string_view, std::nullptr_t) = delete; + set(core::string_view, std::nullptr_t) = delete; /** Remove a field. @@ -619,7 +619,7 @@ class basic_fields @return The number of fields removed. */ std::size_t - erase(string_view name); + erase(core::string_view name); /** Return a buffer sequence representing the trailers. @@ -659,7 +659,7 @@ class basic_fields @param name The field name. It is interpreted as a case-insensitive string. */ bool - contains(string_view name) const; + contains(core::string_view name) const; /** Return the number of fields with the specified name. @@ -673,7 +673,7 @@ class basic_fields @param name The field name. It is interpreted as a case-insensitive string. */ std::size_t - count(string_view name) const; + count(core::string_view name) const; /** Returns an iterator to the case-insensitive matching field. @@ -699,7 +699,7 @@ class basic_fields no match was found. */ const_iterator - find(string_view name) const; + find(core::string_view name) const; /** Returns a range of iterators to the fields with the specified name. @@ -721,7 +721,7 @@ class basic_fields /// @copydoc boost::beast::http::basic_fields::equal_range(boost::beast::http::field) const std::pair - equal_range(string_view name) const; + equal_range(core::string_view name) const; //-------------------------------------------------------------------------- // @@ -741,21 +741,21 @@ class basic_fields @note Only called for requests. */ - string_view + core::string_view get_method_impl() const; /** Returns the request-target string. @note Only called for requests. */ - string_view + core::string_view get_target_impl() const; /** Returns the response reason-phrase string. @note Only called for responses. */ - string_view + core::string_view get_reason_impl() const; /** Returns the chunked Transfer-Encoding setting @@ -778,21 +778,21 @@ class basic_fields @note Only called for requests. */ void - set_method_impl(string_view s); + set_method_impl(core::string_view s); /** Set or clear the target string. @note Only called for requests. */ void - set_target_impl(string_view s); + set_target_impl(core::string_view s); /** Set or clear the reason string. @note Only called for responses. */ void - set_reason_impl(string_view s); + set_reason_impl(core::string_view s); /** Adjusts the chunked Transfer-Encoding value */ @@ -818,15 +818,15 @@ class basic_fields element* try_create_new_element( field name, - string_view sname, - string_view value, + core::string_view sname, + core::string_view value, error_code& ec); element& new_element( field name, - string_view sname, - string_view value); + core::string_view sname, + core::string_view value); void insert_element(element& e); @@ -838,11 +838,11 @@ class basic_fields set_element(element& e); void - realloc_string(string_view& dest, string_view s); + realloc_string(core::string_view& dest, core::string_view s); void realloc_target( - string_view& dest, string_view s); + core::string_view& dest, core::string_view s); template void @@ -874,8 +874,8 @@ class basic_fields set_t set_; list_t list_; - string_view method_; - string_view target_or_reason_; + core::string_view method_; + core::string_view target_or_reason_; }; #if BOOST_BEAST_DOXYGEN diff --git a/include/boost/beast/http/impl/basic_parser.ipp b/include/boost/beast/http/impl/basic_parser.ipp index 9a6fcb13fa..6d918aba82 100644 --- a/include/boost/beast/http/impl/basic_parser.ipp +++ b/include/boost/beast/http/impl/basic_parser.ipp @@ -236,12 +236,12 @@ inner_parse_start_line( */ auto p = in; - string_view method; + core::string_view method; parse_method(p, last, method, ec); if(ec) return; - string_view target; + core::string_view target; parse_target(p, last, target, ec); if(ec) return; @@ -321,7 +321,7 @@ inner_parse_start_line( return; // parse reason CRLF - string_view reason; + core::string_view reason; parse_reason(p, last, reason, ec); if(ec) return; @@ -361,8 +361,8 @@ basic_parser:: inner_parse_fields(char const*& in, char const* last, error_code& ec) { - string_view name; - string_view value; + core::string_view name; + core::string_view value; // https://stackoverflow.com/questions/686217/maximum-on-http-header-values beast::detail::char_buffer buf; auto p = in; @@ -533,7 +533,7 @@ parse_body(char const*& p, std::size_t n, error_code& ec) { ec = {}; - n = this->on_body_impl(string_view{p, + n = this->on_body_impl(core::string_view{p, beast::detail::clamp(len_, n)}, ec); p += n; len_ -= n; @@ -561,7 +561,7 @@ parse_body_to_eof(char const*& p, *body_limit_ -= n; } ec = {}; - n = this->on_body_impl(string_view{p, n}, ec); + n = this->on_body_impl(core::string_view{p, n}, ec); p += n; if(ec) return; @@ -666,7 +666,7 @@ parse_chunk_body(char const*& p, { ec = {}; n = this->on_chunk_body_impl( - len_, string_view{p, + len_, core::string_view{p, beast::detail::clamp(len_, n)}, ec); p += n; len_ -= n; @@ -678,7 +678,7 @@ template void basic_parser:: do_field(field f, - string_view value, error_code& ec) + core::string_view value, error_code& ec) { using namespace beast::detail::string_literals; // Connection @@ -790,7 +790,7 @@ do_field(field f, ec = {}; auto const v = token_list{value}; auto const p = std::find_if(v.begin(), v.end(), - [&](string_view const& s) + [&](core::string_view const& s) { return beast::iequals("chunked"_sv, s); }); diff --git a/include/boost/beast/http/impl/chunk_encode.hpp b/include/boost/beast/http/impl/chunk_encode.hpp index b057571faf..704a2d4754 100644 --- a/include/boost/beast/http/impl/chunk_encode.hpp +++ b/include/boost/beast/http/impl/chunk_encode.hpp @@ -35,7 +35,7 @@ inline chunk_header:: chunk_header( std::size_t size, - string_view extensions) + core::string_view extensions) : view_( size, net::const_buffer{ @@ -102,7 +102,7 @@ template chunk_body:: chunk_body( ConstBufferSequence const& buffers, - string_view extensions) + core::string_view extensions) : view_( buffer_bytes(buffers), net::const_buffer{ @@ -311,10 +311,10 @@ operator*() -> using beast::detail::varint_read; auto it = it_; auto n = varint_read(it); - value_.first = string_view{it, n}; + value_.first = core::string_view{it, n}; it += n; n = varint_read(it); - value_.second = string_view{it, n}; + value_.second = core::string_view{it, n}; return value_; } @@ -560,7 +560,7 @@ do_parse(FwdIt it, FwdIt last, error_code& ec) template void basic_chunk_extensions:: -do_insert(string_view name, string_view value) +do_insert(core::string_view name, core::string_view value) { /* chunk-ext = *( ";" chunk-ext-name [ "=" chunk-ext-val ] ) @@ -623,7 +623,7 @@ do_insert(string_view name, string_view value) template void basic_chunk_extensions:: -parse(string_view s, error_code& ec) +parse(core::string_view s, error_code& ec) { do_parse(s.data(), s.data() + s.size(), ec); if(! ec) @@ -637,7 +637,7 @@ parse(string_view s, error_code& ec) template void basic_chunk_extensions:: -insert(string_view name) +insert(core::string_view name) { do_insert(name, {}); @@ -659,7 +659,7 @@ insert(string_view name) template void basic_chunk_extensions:: -insert(string_view name, string_view value) +insert(core::string_view name, core::string_view value) { do_insert(name, value); diff --git a/include/boost/beast/http/impl/field.ipp b/include/boost/beast/http/impl/field.ipp index 09da20f414..fc1089c6a3 100644 --- a/include/boost/beast/http/impl/field.ipp +++ b/include/boost/beast/http/impl/field.ipp @@ -42,12 +42,12 @@ struct field_table } using array_type = - std::array; + std::array; // Strings are converted to lowercase static std::uint32_t - digest(string_view s) + digest(core::string_view s) { std::uint32_t r = 0; std::size_t n = s.size(); @@ -77,7 +77,7 @@ struct field_table // strings must contain only valid http field characters. static bool - equals(string_view lhs, string_view rhs) + equals(core::string_view lhs, core::string_view rhs) { using Int = std::uint32_t; // VFALCO std::size_t? auto n = lhs.size(); @@ -257,7 +257,7 @@ struct field_table } field - string_to_field(string_view s) const + string_to_field(core::string_view s) const { auto h = digest(s); auto j = h % N; @@ -302,7 +302,7 @@ get_field_table() } BOOST_BEAST_DECL -string_view +core::string_view to_string(field f) { auto const& v = get_field_table(); @@ -312,14 +312,14 @@ to_string(field f) } // detail -string_view +core::string_view to_string(field f) { return detail::to_string(f); } field -string_to_field(string_view s) +string_to_field(core::string_view s) { return detail::get_field_table().string_to_field(s); } diff --git a/include/boost/beast/http/impl/fields.hpp b/include/boost/beast/http/impl/fields.hpp index b42a3ccdd0..c387ab966c 100644 --- a/include/boost/beast/http/impl/fields.hpp +++ b/include/boost/beast/http/impl/fields.hpp @@ -192,7 +192,7 @@ writer(basic_fields const& f, " " " HTTP/X.Y\r\n" (11 chars) */ - string_view sv; + core::string_view sv; if(v == verb::unknown) sv = f_.get_method_impl(); else @@ -248,7 +248,7 @@ writer(basic_fields const& f, buf_[11]= '0' + static_cast(code % 10); buf_[12]= ' '; - string_view sv; + core::string_view sv; if(! f_.target_or_reason_.empty()) sv = f_.target_or_reason_; else @@ -289,7 +289,7 @@ template basic_fields:: value_type:: value_type(field name, - string_view sname, string_view value) + core::string_view sname, core::string_view value) : off_(static_cast(sname.size() + 2)) , len_(static_cast(value.size())) , f_(name) @@ -315,7 +315,7 @@ name() const } template -string_view const +core::string_view const basic_fields:: value_type:: name_string() const @@ -325,7 +325,7 @@ name_string() const } template -string_view const +core::string_view const basic_fields:: value_type:: value() const @@ -338,7 +338,7 @@ template basic_fields:: element:: element(field name, - string_view sname, string_view value) + core::string_view sname, core::string_view value) : value_type(name, sname, value) { } @@ -470,7 +470,7 @@ operator=(basic_fields const& other) -> //------------------------------------------------------------------------------ template -string_view const +core::string_view const basic_fields:: at(field name) const { @@ -483,9 +483,9 @@ at(field name) const } template -string_view const +core::string_view const basic_fields:: -at(string_view name) const +at(core::string_view name) const { auto const it = find(name); if(it == end()) @@ -495,7 +495,7 @@ at(string_view name) const } template -string_view const +core::string_view const basic_fields:: operator[](field name) const { @@ -507,9 +507,9 @@ operator[](field name) const } template -string_view const +core::string_view const basic_fields:: -operator[](string_view name) const +operator[](core::string_view name) const { auto const it = find(name); if(it == end()) @@ -537,7 +537,7 @@ template inline void basic_fields:: -insert(field name, string_view value) +insert(field name, core::string_view value) { BOOST_ASSERT(name != field::unknown); insert(name, to_string(name), value); @@ -546,7 +546,7 @@ insert(field name, string_view value) template void basic_fields:: -insert(string_view sname, string_view value) +insert(core::string_view sname, core::string_view value) { insert( string_to_field(sname), sname, value); @@ -557,8 +557,8 @@ void basic_fields:: insert( field name, - string_view sname, - string_view value, + core::string_view sname, + core::string_view value, error_code& ec) { ec = {}; @@ -572,7 +572,7 @@ template void basic_fields:: insert(field name, - string_view sname, string_view value) + core::string_view sname, core::string_view value) { insert_element( new_element(name, sname, value)); @@ -581,7 +581,7 @@ insert(field name, template void basic_fields:: -set(field name, string_view value) +set(field name, core::string_view value) { BOOST_ASSERT(name != field::unknown); set_element( @@ -591,7 +591,7 @@ set(field name, string_view value) template void basic_fields:: -set(string_view sname, string_view value) +set(core::string_view sname, core::string_view value) { set_element(new_element( string_to_field(sname), sname, value)); @@ -623,7 +623,7 @@ erase(field name) template std::size_t basic_fields:: -erase(string_view name) +erase(core::string_view name) { std::size_t n =0; set_.erase_and_dispose(name, key_compare{}, @@ -672,7 +672,7 @@ contains(field name) const template bool basic_fields:: -contains(string_view name) const +contains(core::string_view name) const { return find(name) != end(); } @@ -690,7 +690,7 @@ count(field name) const template std::size_t basic_fields:: -count(string_view name) const +count(core::string_view name) const { return set_.count(name, key_compare{}); } @@ -709,7 +709,7 @@ find(field name) const -> template auto basic_fields:: -find(string_view name) const -> +find(core::string_view name) const -> const_iterator { auto const it = set_.find( @@ -733,7 +733,7 @@ equal_range(field name) const -> template auto basic_fields:: -equal_range(string_view name) const -> +equal_range(core::string_view name) const -> std::pair { auto result = @@ -752,13 +752,13 @@ namespace detail { struct iequals_predicate { bool - operator()(string_view s) const + operator()(core::string_view s) const { return beast::iequals(s, sv1) || beast::iequals(s, sv2); } - string_view sv1; - string_view sv2; + core::string_view sv1; + core::string_view sv2; }; // Filter the last item in a token list @@ -766,13 +766,13 @@ BOOST_BEAST_DECL void filter_token_list_last( beast::detail::temporary_buffer& s, - string_view value, + core::string_view value, iequals_predicate const& pred); BOOST_BEAST_DECL void keep_alive_impl( - beast::detail::temporary_buffer& s, string_view value, + beast::detail::temporary_buffer& s, core::string_view value, unsigned version, bool keep_alive); } // detail @@ -783,7 +783,7 @@ keep_alive_impl( template inline -string_view +core::string_view basic_fields:: get_method_impl() const { @@ -792,7 +792,7 @@ get_method_impl() const template inline -string_view +core::string_view basic_fields:: get_target_impl() const { @@ -805,7 +805,7 @@ get_target_impl() const template inline -string_view +core::string_view basic_fields:: get_reason_impl() const { @@ -860,7 +860,7 @@ template inline void basic_fields:: -set_method_impl(string_view s) +set_method_impl(core::string_view s) { realloc_string(method_, s); } @@ -869,7 +869,7 @@ template inline void basic_fields:: -set_target_impl(string_view s) +set_target_impl(core::string_view s) { realloc_target( target_or_reason_, s); @@ -879,7 +879,7 @@ template inline void basic_fields:: -set_reason_impl(string_view s) +set_reason_impl(core::string_view s) { realloc_string( target_or_reason_, s); @@ -967,8 +967,8 @@ auto basic_fields:: try_create_new_element( field name, - string_view sname, - string_view value, + core::string_view sname, + core::string_view value, error_code& ec) -> element* { if(sname.size() > max_name_size) @@ -998,8 +998,8 @@ auto basic_fields:: new_element( field name, - string_view sname, - string_view value) -> element& + core::string_view sname, + core::string_view value) -> element& { error_code ec; auto* e = try_create_new_element(name, sname, value, ec); @@ -1083,7 +1083,7 @@ set_element(element& e) template void basic_fields:: -realloc_string(string_view& dest, string_view s) +realloc_string(core::string_view& dest, core::string_view s) { if(dest.empty() && s.empty()) return; @@ -1109,7 +1109,7 @@ template void basic_fields:: realloc_target( - string_view& dest, string_view s) + core::string_view& dest, core::string_view s) { // The target string are stored with an // extra space at the beginning to help diff --git a/include/boost/beast/http/impl/fields.ipp b/include/boost/beast/http/impl/fields.ipp index 487f052835..8450b90576 100644 --- a/include/boost/beast/http/impl/fields.ipp +++ b/include/boost/beast/http/impl/fields.ipp @@ -29,7 +29,7 @@ inline void filter_token_list( beast::detail::temporary_buffer& s, - string_view value, + core::string_view value, iequals_predicate const& pred) { token_list te{value}; @@ -53,7 +53,7 @@ filter_token_list( void filter_token_list_last( beast::detail::temporary_buffer& s, - string_view value, + core::string_view value, iequals_predicate const& pred) { token_list te{value}; @@ -87,7 +87,7 @@ filter_token_list_last( void keep_alive_impl( - beast::detail::temporary_buffer& s, string_view value, + beast::detail::temporary_buffer& s, core::string_view value, unsigned version, bool keep_alive) { if(version < 11) diff --git a/include/boost/beast/http/impl/message.hpp b/include/boost/beast/http/impl/message.hpp index 4b101ad3b9..27cc3b6e6f 100644 --- a/include/boost/beast/http/impl/message.hpp +++ b/include/boost/beast/http/impl/message.hpp @@ -49,7 +49,7 @@ method(verb v) } template -string_view +core::string_view header:: method_string() const { @@ -61,7 +61,7 @@ method_string() const template void header:: -method_string(string_view s) +method_string(core::string_view s) { method_ = string_to_verb(s); if(method_ != verb::unknown) @@ -71,7 +71,7 @@ method_string(string_view s) } template -string_view +core::string_view header:: target() const { @@ -81,7 +81,7 @@ target() const template void header:: -target(string_view s) +target(core::string_view s) { this->set_target_impl(s); } @@ -149,7 +149,7 @@ result_int() const } template -string_view +core::string_view header:: reason() const { @@ -162,7 +162,7 @@ reason() const template void header:: -reason(string_view s) +reason(core::string_view s) { this->set_reason_impl(s); } @@ -208,7 +208,7 @@ message(header_type const& h, BodyArgs&&... body_args) template template message:: -message(verb method, string_view target, Version version) +message(verb method, core::string_view target, Version version) : header_type(method, target, version) { } @@ -216,7 +216,7 @@ message(verb method, string_view target, Version version) template template message:: -message(verb method, string_view target, +message(verb method, core::string_view target, Version version, BodyArg&& body_arg) : header_type(method, target, version) , boost::empty_value< @@ -229,7 +229,7 @@ template template message:: message( - verb method, string_view target, Version version, + verb method, core::string_view target, Version version, BodyArg&& body_arg, FieldsArg&& fields_arg) : header_type(method, target, version, diff --git a/include/boost/beast/http/impl/rfc7230.hpp b/include/boost/beast/http/impl/rfc7230.hpp index 2310cec8ef..6357790b8c 100644 --- a/include/boost/beast/http/impl/rfc7230.hpp +++ b/include/boost/beast/http/impl/rfc7230.hpp @@ -19,7 +19,7 @@ namespace http { class param_list::const_iterator { - using iter_type = string_view::const_iterator; + using iter_type = core::string_view::const_iterator; std::string s_; detail::param_iter pi_; @@ -89,7 +89,7 @@ class param_list::const_iterator BOOST_BEAST_DECL static void - unquote(string_view sr, std::string & s); + unquote(core::string_view sr, std::string & s); BOOST_BEAST_DECL void diff --git a/include/boost/beast/http/impl/rfc7230.ipp b/include/boost/beast/http/impl/rfc7230.ipp index 5bb0372e95..a060ece23d 100644 --- a/include/boost/beast/http/impl/rfc7230.ipp +++ b/include/boost/beast/http/impl/rfc7230.ipp @@ -19,7 +19,7 @@ namespace http { void param_list::const_iterator:: -unquote(string_view sr, std::string &s) +unquote(core::string_view sr, std::string &s) { s.clear(); s.reserve(sr.size()); @@ -49,7 +49,7 @@ increment() pi_.v.second.front() == '"') { unquote(pi_.v.second, s_); - pi_.v.second = string_view{ + pi_.v.second = core::string_view{ s_.data(), s_.size()}; } } @@ -96,7 +96,7 @@ increment() if(! detail::is_token_char(*it_)) break; } - v_.first = string_view{&*p0, + v_.first = core::string_view{&*p0, static_cast(it_ - p0)}; if (it_ == last_) return; @@ -110,7 +110,7 @@ increment() if(pi.empty()) break; } - v_.second = param_list{string_view{&*it_, + v_.second = param_list{core::string_view{&*it_, static_cast(pi.it - it_)}}; it_ = pi.it; return; @@ -124,7 +124,7 @@ increment() auto ext_list:: -find(string_view const& s) -> const_iterator +find(core::string_view const& s) -> const_iterator { return std::find_if(begin(), end(), [&s](value_type const& v) @@ -135,7 +135,7 @@ find(string_view const& s) -> const_iterator bool ext_list:: -exists(string_view const& s) +exists(core::string_view const& s) { return find(s) != end(); } @@ -175,7 +175,7 @@ increment() if(! detail::is_token_char(*it_)) break; } - v_ = string_view{&*p0, + v_ = core::string_view{&*p0, static_cast(it_ - p0)}; return; } @@ -188,7 +188,7 @@ increment() bool token_list:: -exists(string_view const& s) +exists(core::string_view const& s) { return std::find_if(begin(), end(), [&s](value_type const& v) diff --git a/include/boost/beast/http/impl/status.ipp b/include/boost/beast/http/impl/status.ipp index 61bcdbe1ce..7071f198f2 100644 --- a/include/boost/beast/http/impl/status.ipp +++ b/include/boost/beast/http/impl/status.ipp @@ -127,7 +127,7 @@ to_status_class(status v) return to_status_class(static_cast(v)); } -string_view +core::string_view obsolete_reason(status v) { switch(static_cast(v)) diff --git a/include/boost/beast/http/impl/verb.ipp b/include/boost/beast/http/impl/verb.ipp index 988f1b9430..24017da411 100644 --- a/include/boost/beast/http/impl/verb.ipp +++ b/include/boost/beast/http/impl/verb.ipp @@ -18,7 +18,7 @@ namespace boost { namespace beast { namespace http { -string_view +core::string_view to_string(verb v) { using namespace beast::detail::string_literals; @@ -72,7 +72,7 @@ to_string(verb v) } verb -string_to_verb(string_view v) +string_to_verb(core::string_view v) { /* ACL diff --git a/include/boost/beast/http/message.hpp b/include/boost/beast/http/message.hpp index 3c75ac26fe..ead1291e1e 100644 --- a/include/boost/beast/http/message.hpp +++ b/include/boost/beast/http/message.hpp @@ -149,7 +149,7 @@ class header : public Fields @see method */ - string_view + core::string_view method_string() const; /** Set the request-method. @@ -163,7 +163,7 @@ class header : public Fields @note This function is only available when `isRequest == true`. */ void - method_string(string_view s); + method_string(core::string_view s); /** Returns the request-target string. @@ -174,7 +174,7 @@ class header : public Fields @note This function is only available when `isRequest == true`. */ - string_view + core::string_view target() const; /** Set the request-target string. @@ -190,7 +190,7 @@ class header : public Fields @note This function is only available when `isRequest == true`. */ void - target(string_view s); + target(core::string_view s); // VFALCO Don't rearrange these declarations or // ifdefs, or else the documentation will break. @@ -235,7 +235,7 @@ class header : public Fields template header( verb method, - string_view target_, + core::string_view target_, unsigned version_value, FieldsArgs&&... fields_args) : Fields(std::forward(fields_args)...) @@ -390,7 +390,7 @@ class header : public Fields @note This function is only available when `isRequest == false`. */ - string_view + core::string_view reason() const; /** Set the response reason-phrase (deprecated) @@ -412,7 +412,7 @@ class header : public Fields @note This function is only available when `isRequest == false`. */ void - reason(string_view s); + reason(core::string_view s); private: #if ! BOOST_BEAST_DOXYGEN @@ -557,12 +557,12 @@ class message @note This function is only available when `isRequest == true`. */ #if BOOST_BEAST_DOXYGEN - message(verb method, string_view target, unsigned version); + message(verb method, core::string_view target, unsigned version); #else template::value>::type> - message(verb method, string_view target, Version version); + message(verb method, core::string_view target, Version version); #endif /** Constructor @@ -579,13 +579,13 @@ class message */ #if BOOST_BEAST_DOXYGEN template - message(verb method, string_view target, + message(verb method, core::string_view target, unsigned version, BodyArg&& body_arg); #else template::value>::type> - message(verb method, string_view target, + message(verb method, core::string_view target, Version version, BodyArg&& body_arg); #endif @@ -605,13 +605,13 @@ class message */ #if BOOST_BEAST_DOXYGEN template - message(verb method, string_view target, unsigned version, + message(verb method, core::string_view target, unsigned version, BodyArg&& body_arg, FieldsArg&& fields_arg); #else template::value>::type> - message(verb method, string_view target, Version version, + message(verb method, core::string_view target, Version version, BodyArg&& body_arg, FieldsArg&& fields_arg); #endif diff --git a/include/boost/beast/http/message_generator.hpp b/include/boost/beast/http/message_generator.hpp index b81184b901..f77c1a1c8a 100644 --- a/include/boost/beast/http/message_generator.hpp +++ b/include/boost/beast/http/message_generator.hpp @@ -34,7 +34,7 @@ namespace http { @code template http::message_generator handle_request( - string_view doc_root, + core::string_view doc_root, http::request&& request); @endcode diff --git a/include/boost/beast/http/parser.hpp b/include/boost/beast/http/parser.hpp index 3e00a15ea6..e754146ce3 100644 --- a/include/boost/beast/http/parser.hpp +++ b/include/boost/beast/http/parser.hpp @@ -76,12 +76,12 @@ class parser std::function cb_h_; std::function cb_b_; public: @@ -225,7 +225,7 @@ class parser @par Example @code auto callback = - [](std::uint64_t size, string_view extensions, error_code& ec) + [](std::uint64_t size, core::string_view extensions, error_code& ec) { //... }; @@ -237,9 +237,9 @@ class parser @code void on_chunk_header( - std::uint64_t size, // Size of the chunk, zero for the last chunk - string_view extensions, // The chunk-extensions in raw form - error_code& ec); // May be set by the callback to indicate an error + std::uint64_t size, // Size of the chunk, zero for the last chunk + core::string_view extensions, // The chunk-extensions in raw form + error_code& ec); // May be set by the callback to indicate an error @endcode */ template @@ -273,7 +273,7 @@ class parser @par Example @code auto callback = - [](std::uint64_t remain, string_view body, error_code& ec) + [](std::uint64_t remain, core::string_view body, error_code& ec) { //... }; @@ -285,9 +285,9 @@ class parser @code std::size_t on_chunk_header( - std::uint64_t remain, // Octets remaining in this chunk, includes `body` - string_view body, // A buffer holding some or all of the remainder of the chunk body - error_code& ec); // May be set by the callback to indicate an error + std::uint64_t remain, // Octets remaining in this chunk, includes `body` + core::string_view body, // A buffer holding some or all of the remainder of the chunk body + error_code& ec); // May be set by the callback to indicate an error @endcode */ template @@ -387,8 +387,8 @@ class parser void on_request_impl( verb method, - string_view method_str, - string_view target, + core::string_view method_str, + core::string_view target, int version, error_code& ec, std::true_type) @@ -417,7 +417,7 @@ class parser void on_request_impl( - verb, string_view, string_view, + verb, core::string_view, core::string_view, int, error_code&, std::false_type) { } @@ -425,8 +425,8 @@ class parser void on_request_impl( verb method, - string_view method_str, - string_view target, + core::string_view method_str, + core::string_view target, int version, error_code& ec) override { @@ -438,7 +438,7 @@ class parser void on_response_impl( int code, - string_view reason, + core::string_view reason, int version, error_code& ec, std::true_type) @@ -464,7 +464,7 @@ class parser void on_response_impl( - int, string_view, int, + int, core::string_view, int, error_code&, std::false_type) { } @@ -472,7 +472,7 @@ class parser void on_response_impl( int code, - string_view reason, + core::string_view reason, int version, error_code& ec) override { @@ -484,8 +484,8 @@ class parser void on_field_impl( field name, - string_view name_string, - string_view value, + core::string_view name_string, + core::string_view value, error_code& ec) override { m_.insert(name, name_string, value, ec); @@ -494,8 +494,8 @@ class parser void on_trailer_field_impl( field name, - string_view name_string, - string_view value, + core::string_view name_string, + core::string_view value, error_code& ec) override { if(! token_list{m_[field::trailer]}.exists(name_string)) @@ -538,7 +538,7 @@ class parser std::size_t on_body_impl( - string_view body, + core::string_view body, error_code& ec) override { return rd_.put(net::buffer( @@ -548,7 +548,7 @@ class parser void on_chunk_header_impl( std::uint64_t size, - string_view extensions, + core::string_view extensions, error_code& ec) override { if(cb_h_) @@ -558,7 +558,7 @@ class parser std::size_t on_chunk_body_impl( std::uint64_t remain, - string_view body, + core::string_view body, error_code& ec) override { if(cb_b_) diff --git a/include/boost/beast/http/rfc7230.hpp b/include/boost/beast/http/rfc7230.hpp index c83494e666..62b8db38ce 100644 --- a/include/boost/beast/http/rfc7230.hpp +++ b/include/boost/beast/http/rfc7230.hpp @@ -52,7 +52,7 @@ namespace http { */ class param_list { - string_view s_; + core::string_view s_; public: /** The type of each element in the list. @@ -62,7 +62,7 @@ class param_list be empty). */ using value_type = - std::pair; + std::pair; /// A constant iterator to the list #if BOOST_BEAST_DOXYGEN @@ -80,7 +80,7 @@ class param_list must remain valid for the lifetime of the container. */ explicit - param_list(string_view s) + param_list(core::string_view s) : s_(s) { } @@ -140,9 +140,9 @@ class param_list */ class ext_list { - using iter_type = string_view::const_iterator; + using iter_type = core::string_view::const_iterator; - string_view s_; + core::string_view s_; public: /** The type of each element in the list. @@ -151,7 +151,7 @@ class ext_list second element of the pair is an iterable container holding the extension's name/value parameters. */ - using value_type = std::pair; + using value_type = std::pair; /// A constant iterator to the list #if BOOST_BEAST_DOXYGEN @@ -166,7 +166,7 @@ class ext_list must remain valid for the lifetime of the container. */ explicit - ext_list(string_view s) + ext_list(core::string_view s) : s_(s) { } @@ -192,7 +192,7 @@ class ext_list */ BOOST_BEAST_DECL const_iterator - find(string_view const& s); + find(core::string_view const& s); /** Return `true` if a token is present in the list. @@ -200,7 +200,7 @@ class ext_list */ BOOST_BEAST_DECL bool - exists(string_view const& s); + exists(core::string_view const& s); }; //------------------------------------------------------------------------------ @@ -233,13 +233,13 @@ class ext_list */ class token_list { - using iter_type = string_view::const_iterator; + using iter_type = core::string_view::const_iterator; - string_view s_; + core::string_view s_; public: /// The type of each element in the token list. - using value_type = string_view; + using value_type = core::string_view; /// A constant iterator to the list #if BOOST_BEAST_DOXYGEN @@ -254,7 +254,7 @@ class token_list must remain valid for the lifetime of the container. */ explicit - token_list(string_view s) + token_list(core::string_view s) : s_(s) { } @@ -277,7 +277,7 @@ class token_list */ BOOST_BEAST_DECL bool - exists(string_view const& s); + exists(core::string_view const& s); }; /** A list of tokens in a comma separated HTTP field value. diff --git a/include/boost/beast/http/status.hpp b/include/boost/beast/http/status.hpp index 377ade6a0f..084d442a72 100644 --- a/include/boost/beast/http/status.hpp +++ b/include/boost/beast/http/status.hpp @@ -163,7 +163,7 @@ to_status_class(status v); @param v The status code to use. */ BOOST_BEAST_DECL -string_view +core::string_view obsolete_reason(status v); /// Outputs the standard reason phrase of a status code to a stream. diff --git a/include/boost/beast/http/verb.hpp b/include/boost/beast/http/verb.hpp index 5352851a48..bd4217b9bf 100644 --- a/include/boost/beast/http/verb.hpp +++ b/include/boost/beast/http/verb.hpp @@ -135,11 +135,11 @@ enum class verb */ BOOST_BEAST_DECL verb -string_to_verb(string_view s); +string_to_verb(core::string_view s); /// Returns the text representation of a request method verb. BOOST_BEAST_DECL -string_view +core::string_view to_string(verb v); /// Write the text for a request method verb to an output stream. diff --git a/include/boost/beast/websocket/detail/hybi13.hpp b/include/boost/beast/websocket/detail/hybi13.hpp index 7aeae2a386..7783762e39 100644 --- a/include/boost/beast/websocket/detail/hybi13.hpp +++ b/include/boost/beast/websocket/detail/hybi13.hpp @@ -34,7 +34,7 @@ BOOST_BEAST_DECL void make_sec_ws_accept( sec_ws_accept_type& accept, - string_view key); + core::string_view key); } // detail } // websocket diff --git a/include/boost/beast/websocket/detail/hybi13.ipp b/include/boost/beast/websocket/detail/hybi13.ipp index 3e22c3130b..dcf7ded705 100644 --- a/include/boost/beast/websocket/detail/hybi13.ipp +++ b/include/boost/beast/websocket/detail/hybi13.ipp @@ -38,7 +38,7 @@ make_sec_ws_key(sec_ws_key_type& key) void make_sec_ws_accept( sec_ws_accept_type& accept, - string_view key) + core::string_view key) { BOOST_ASSERT(key.size() <= sec_ws_key_type::static_capacity); using namespace beast::detail::string_literals; diff --git a/include/boost/beast/websocket/detail/pmd_extension.hpp b/include/boost/beast/websocket/detail/pmd_extension.hpp index 8a52a26393..6e3acedc54 100644 --- a/include/boost/beast/websocket/detail/pmd_extension.hpp +++ b/include/boost/beast/websocket/detail/pmd_extension.hpp @@ -45,7 +45,7 @@ struct pmd_offer BOOST_BEAST_DECL int -parse_bits(string_view s); +parse_bits(core::string_view s); BOOST_BEAST_DECL void diff --git a/include/boost/beast/websocket/detail/pmd_extension.ipp b/include/boost/beast/websocket/detail/pmd_extension.ipp index 005feec19d..b86455209e 100644 --- a/include/boost/beast/websocket/detail/pmd_extension.ipp +++ b/include/boost/beast/websocket/detail/pmd_extension.ipp @@ -18,7 +18,7 @@ namespace websocket { namespace detail { int -parse_bits(string_view s) +parse_bits(core::string_view s) { if(s.size() == 0) return -1; diff --git a/include/boost/beast/websocket/impl/accept.hpp b/include/boost/beast/websocket/impl/accept.hpp index e20b4d1cfd..3385b3ebf1 100644 --- a/include/boost/beast/websocket/impl/accept.hpp +++ b/include/boost/beast/websocket/impl/accept.hpp @@ -79,7 +79,7 @@ build_response( decorator(res); if(! res.contains(http::field::server)) res.set(http::field::server, - string_view(BOOST_BEAST_VERSION_STRING)); + core::string_view(BOOST_BEAST_VERSION_STRING)); }; auto err = [&](error e) @@ -113,7 +113,7 @@ build_response( if(! http::token_list{it->value()}.exists("websocket")) return err(error::no_upgrade_websocket); } - string_view key; + core::string_view key; { auto const it = req.find(http::field::sec_websocket_key); if(it == req.end()) diff --git a/include/boost/beast/websocket/impl/handshake.hpp b/include/boost/beast/websocket/impl/handshake.hpp index f5bfb6c443..d21da0d305 100644 --- a/include/boost/beast/websocket/impl/handshake.hpp +++ b/include/boost/beast/websocket/impl/handshake.hpp @@ -231,8 +231,8 @@ void stream:: do_handshake( response_type* res_p, - string_view host, - string_view target, + core::string_view host, + core::string_view target, RequestDecorator const& decorator, error_code& ec) { @@ -310,8 +310,8 @@ template BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler) stream:: async_handshake( - string_view host, - string_view target, + core::string_view host, + core::string_view target, HandshakeHandler&& handler) { static_assert(is_async_stream::value, @@ -335,8 +335,8 @@ BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler) stream:: async_handshake( response_type& res, - string_view host, - string_view target, + core::string_view host, + core::string_view target, HandshakeHandler&& handler) { static_assert(is_async_stream::value, @@ -357,8 +357,8 @@ async_handshake( template void stream:: -handshake(string_view host, - string_view target) +handshake(core::string_view host, + core::string_view target) { static_assert(is_sync_stream::value, "SyncStream type requirements not met"); @@ -373,8 +373,8 @@ template void stream:: handshake(response_type& res, - string_view host, - string_view target) + core::string_view host, + core::string_view target) { static_assert(is_sync_stream::value, "SyncStream type requirements not met"); @@ -387,8 +387,8 @@ handshake(response_type& res, template void stream:: -handshake(string_view host, - string_view target, error_code& ec) +handshake(core::string_view host, + core::string_view target, error_code& ec) { static_assert(is_sync_stream::value, "SyncStream type requirements not met"); @@ -400,8 +400,8 @@ template void stream:: handshake(response_type& res, - string_view host, - string_view target, + core::string_view host, + core::string_view target, error_code& ec) { static_assert(is_sync_stream::value, diff --git a/include/boost/beast/websocket/impl/stream.hpp b/include/boost/beast/websocket/impl/stream.hpp index 2c044ebdf4..0ee5e51102 100644 --- a/include/boost/beast/websocket/impl/stream.hpp +++ b/include/boost/beast/websocket/impl/stream.hpp @@ -251,7 +251,7 @@ template void stream:: control_callback(std::function< - void(frame_type, string_view)> cb) + void(frame_type, core::string_view)> cb) { impl_->ctrl_cb = std::move(cb); } diff --git a/include/boost/beast/websocket/impl/stream_impl.hpp b/include/boost/beast/websocket/impl/stream_impl.hpp index 701919ddc9..edf960f91c 100644 --- a/include/boost/beast/websocket/impl/stream_impl.hpp +++ b/include/boost/beast/websocket/impl/stream_impl.hpp @@ -257,7 +257,7 @@ struct stream::impl_type request_type build_request( detail::sec_ws_key_type& key, - string_view host, string_view target, + core::string_view host, core::string_view target, Decorator const& decorator); void @@ -623,7 +623,7 @@ request_type stream::impl_type:: build_request( detail::sec_ws_key_type& key, - string_view host, string_view target, + core::string_view host, core::string_view target, Decorator const& decorator) { request_type req; diff --git a/include/boost/beast/websocket/rfc6455.hpp b/include/boost/beast/websocket/rfc6455.hpp index 7611096bba..19582657cc 100644 --- a/include/boost/beast/websocket/rfc6455.hpp +++ b/include/boost/beast/websocket/rfc6455.hpp @@ -187,7 +187,7 @@ struct close_reason } /// Construct from a reason string. code is @ref close_code::normal. - close_reason(string_view s) + close_reason(core::string_view s) : code(close_code::normal) , reason(s.data(), s.size()) { @@ -201,7 +201,7 @@ struct close_reason } /// Construct from a close code and reason string. - close_reason(close_code code_, string_view s) + close_reason(close_code code_, core::string_view s) : code(code_) , reason(s.data(), s.size()) { diff --git a/include/boost/beast/websocket/stream.hpp b/include/boost/beast/websocket/stream.hpp index 1aa47e359b..f9e3db5275 100644 --- a/include/boost/beast/websocket/stream.hpp +++ b/include/boost/beast/websocket/stream.hpp @@ -156,7 +156,7 @@ class stream std::chrono::steady_clock::time_point; using control_cb_type = - std::function; + std::function; #ifndef BOOST_BEAST_DOXYGEN friend class close_test; @@ -524,8 +524,8 @@ class stream @code void callback( - frame_type kind, // The type of frame - string_view payload // The payload in the frame + frame_type kind, // The type of frame + core::string_view payload // The payload in the frame ); @endcode The implementation type-erases the callback which may require @@ -545,7 +545,7 @@ class stream in undefined behavior. */ void - control_callback(std::function cb); + control_callback(std::function cb); /** Reset the control frame callback. @@ -762,8 +762,8 @@ class stream */ void handshake( - string_view host, - string_view target); + core::string_view host, + core::string_view target); /** Perform the WebSocket handshake in the client role. @@ -820,8 +820,8 @@ class stream void handshake( response_type& res, - string_view host, - string_view target); + core::string_view host, + core::string_view target); /** Perform the WebSocket handshake in the client role. @@ -868,8 +868,8 @@ class stream */ void handshake( - string_view host, - string_view target, + core::string_view host, + core::string_view target, error_code& ec); /** Perform the WebSocket handshake in the client role. @@ -925,8 +925,8 @@ class stream void handshake( response_type& res, - string_view host, - string_view target, + core::string_view host, + core::string_view target, error_code& ec); /** Perform the WebSocket handshake asynchronously in the client role. @@ -1002,8 +1002,8 @@ class stream > BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler) async_handshake( - string_view host, - string_view target, + core::string_view host, + core::string_view target, HandshakeHandler&& handler = net::default_completion_token_t< executor_type>{}); @@ -1091,8 +1091,8 @@ class stream BOOST_BEAST_ASYNC_RESULT1(HandshakeHandler) async_handshake( response_type& res, - string_view host, - string_view target, + core::string_view host, + core::string_view target, HandshakeHandler&& handler = net::default_completion_token_t< executor_type>{}); @@ -2909,7 +2909,7 @@ class stream template void do_handshake(response_type* res_p, - string_view host, string_view target, + core::string_view host, core::string_view target, RequestDecorator const& decorator, error_code& ec); diff --git a/test/beast/_experimental/icy_stream.cpp b/test/beast/_experimental/icy_stream.cpp index d7913c6f29..fcafd4153f 100644 --- a/test/beast/_experimental/icy_stream.cpp +++ b/test/beast/_experimental/icy_stream.cpp @@ -28,7 +28,7 @@ class icy_stream_test { public: void - doMatrix(string_view in, string_view out) + doMatrix(core::string_view in, core::string_view out) { using net::mutable_buffer; net::io_context ioc; diff --git a/test/beast/core/_detail_base64.cpp b/test/beast/core/_detail_base64.cpp index c4c06f240d..f1d02c9347 100644 --- a/test/beast/core/_detail_base64.cpp +++ b/test/beast/core/_detail_base64.cpp @@ -32,14 +32,14 @@ class base64_test : public beast::unit_test::suite } std::string - base64_encode(string_view s) + base64_encode(core::string_view s) { return base64_encode (reinterpret_cast < std::uint8_t const*> (s.data()), s.size()); } std::string - base64_decode(string_view data) + base64_decode(core::string_view data) { std::string dest; dest.resize(base64::decoded_size(data.size())); diff --git a/test/beast/core/basic_stream.cpp b/test/beast/core/basic_stream.cpp index 2db8d63987..5d8912b4d4 100644 --- a/test/beast/core/basic_stream.cpp +++ b/test/beast/core/basic_stream.cpp @@ -167,7 +167,7 @@ struct test_acceptor class test_server { - string_view s_; + core::string_view s_; std::ostream& log_; net::io_context ioc_; net::ip::tcp::acceptor acceptor_; @@ -175,7 +175,7 @@ class test_server std::thread t_; void - fail(error_code const& ec, string_view what) + fail(error_code const& ec, core::string_view what) { if(ec != net::error::operation_aborted) log_ << what << ": " << ec.message() << "\n"; @@ -183,7 +183,7 @@ class test_server public: test_server( - string_view s, + core::string_view s, net::ip::tcp::endpoint ep, std::ostream& log) : s_(s) @@ -253,12 +253,12 @@ class test_server class session : public std::enable_shared_from_this { - string_view s_; + core::string_view s_; net::ip::tcp::socket socket_; public: session( - string_view s, + core::string_view s, net::ip::tcp::socket sock, std::ostream&) : s_(s) diff --git a/test/beast/core/bind_handler.cpp b/test/beast/core/bind_handler.cpp index 1a074dd0a5..2298adf7ab 100644 --- a/test/beast/core/bind_handler.cpp +++ b/test/beast/core/bind_handler.cpp @@ -287,7 +287,7 @@ class bind_handler_test : public unit_test::suite } void - operator()(int v, string_view s) + operator()(int v, core::string_view s) { fail_ = false; BEAST_EXPECT(v == 42); @@ -295,7 +295,7 @@ class bind_handler_test : public unit_test::suite } void - operator()(int v, string_view s, move_arg<1>) + operator()(int v, core::string_view s, move_arg<1>) { fail_ = false; BEAST_EXPECT(v == 42); @@ -303,7 +303,7 @@ class bind_handler_test : public unit_test::suite } void - operator()(int v, string_view s, move_arg<1>, move_arg<2>) + operator()(int v, core::string_view s, move_arg<1>, move_arg<2>) { fail_ = false; BEAST_EXPECT(v == 42); @@ -319,7 +319,7 @@ class bind_handler_test : public unit_test::suite void operator()( - error_code, std::size_t n, string_view s) + error_code, std::size_t n, core::string_view s) { boost::ignore_unused(s); fail_ = false; @@ -527,7 +527,7 @@ class bind_handler_test : public unit_test::suite // void(error_code, size_t) bind_front_handler(test_cb{}, ec, n)(); - // void(error_code, size_t)(string_view) + // void(error_code, size_t)(core::string_view) bind_front_handler(test_cb{}, ec, n)("s"); // perfect forwarding diff --git a/test/beast/core/buffers_cat.cpp b/test/beast/core/buffers_cat.cpp index 7cd3e64234..588b98ddde 100644 --- a/test/beast/core/buffers_cat.cpp +++ b/test/beast/core/buffers_cat.cpp @@ -72,7 +72,7 @@ class buffers_cat_test : public unit_test::suite void testBufferSequence() { - string_view s = "Hello, world!"; + core::string_view s = "Hello, world!"; net::const_buffer b1(s.data(), 6); net::const_buffer b2( s.data() + b1.size(), s.size() - b1.size()); diff --git a/test/beast/core/buffers_range.cpp b/test/beast/core/buffers_range.cpp index d809841dc5..579326f7b9 100644 --- a/test/beast/core/buffers_range.cpp +++ b/test/beast/core/buffers_range.cpp @@ -69,7 +69,7 @@ class buffers_range_test : public beast::unit_test::suite testBufferSequence() { { - string_view s = "Hello, world!"; + core::string_view s = "Hello, world!"; test_buffer_sequence(buffers_range( net::const_buffer{s.data(), s.size()})); } diff --git a/test/beast/core/buffers_suffix.cpp b/test/beast/core/buffers_suffix.cpp index e08bfdf300..284bc2e93f 100644 --- a/test/beast/core/buffers_suffix.cpp +++ b/test/beast/core/buffers_suffix.cpp @@ -37,7 +37,7 @@ class buffers_suffix_test : public beast::unit_test::suite // const { - string_view src = "Hello, world!"; + core::string_view src = "Hello, world!"; std::array b{{ net::const_buffer(src.data(), 3), net::const_buffer(src.data() + 3, 4), diff --git a/test/beast/core/detect_ssl.cpp b/test/beast/core/detect_ssl.cpp index 1155fb1571..1339826fee 100644 --- a/test/beast/core/detect_ssl.cpp +++ b/test/beast/core/detect_ssl.cpp @@ -31,21 +31,21 @@ class detect_ssl_test : public unit_test::suite testDetect() { auto const yes = - [](int n, string_view s) + [](int n, core::string_view s) { BEAST_EXPECT(detail::is_tls_client_hello( net::const_buffer(s.data(), n))); }; auto const no = - [](int n, string_view s) + [](int n, core::string_view s) { BEAST_EXPECT(! detail::is_tls_client_hello( net::const_buffer(s.data(), n))); }; auto const maybe = - [](int n, string_view s) + [](int n, core::string_view s) { BEAST_EXPECT(boost::indeterminate( detail::is_tls_client_hello( diff --git a/test/beast/core/file_test.hpp b/test/beast/core/file_test.hpp index e5a54b9d20..2a8e6c1558 100644 --- a/test/beast/core/file_test.hpp +++ b/test/beast/core/file_test.hpp @@ -393,7 +393,7 @@ test_file() // read and write { - string_view const s = "Hello, world!"; + core::string_view const s = "Hello, world!"; // write { diff --git a/test/beast/core/flat_buffer.cpp b/test/beast/core/flat_buffer.cpp index a17acfe9f0..0035a26ec9 100644 --- a/test/beast/core/flat_buffer.cpp +++ b/test/beast/core/flat_buffer.cpp @@ -255,7 +255,7 @@ class flat_buffer_test : public beast::unit_test::suite // operations { - string_view const s = "Hello, world!"; + core::string_view const s = "Hello, world!"; flat_buffer b1{64}; BEAST_EXPECT(b1.size() == 0); BEAST_EXPECT(b1.max_size() == 64); diff --git a/test/beast/core/flat_static_buffer.cpp b/test/beast/core/flat_static_buffer.cpp index d70338e586..064ad03c1f 100644 --- a/test/beast/core/flat_static_buffer.cpp +++ b/test/beast/core/flat_static_buffer.cpp @@ -41,7 +41,7 @@ class flat_static_buffer_test : public beast::unit_test::suite void testMembers() { - string_view const s = "Hello, world!"; + core::string_view const s = "Hello, world!"; // flat_static_buffer_base { diff --git a/test/beast/core/make_printable.cpp b/test/beast/core/make_printable.cpp index 0b081cd438..423bb66284 100644 --- a/test/beast/core/make_printable.cpp +++ b/test/beast/core/make_printable.cpp @@ -43,7 +43,7 @@ class make_printable_test : public beast::unit_test::suite { char buf[13]; buffers_triple b(buf, sizeof(buf)); - string_view src = "Hello, world!"; + core::string_view src = "Hello, world!"; BEAST_EXPECT(src.size() == sizeof(buf)); net::buffer_copy(b, net::const_buffer(src.data(), src.size())); diff --git a/test/beast/core/multi_buffer.cpp b/test/beast/core/multi_buffer.cpp index cc32543942..40cf12dad4 100644 --- a/test/beast/core/multi_buffer.cpp +++ b/test/beast/core/multi_buffer.cpp @@ -418,7 +418,7 @@ class multi_buffer_test : public beast::unit_test::suite } } { - string_view const s = "Hello, world!"; + core::string_view const s = "Hello, world!"; multi_buffer b1{64}; BEAST_EXPECT(b1.size() == 0); BEAST_EXPECT(b1.max_size() == 64); @@ -683,7 +683,7 @@ class multi_buffer_test : public beast::unit_test::suite void testMatrix1() { - string_view s = "Hello, world"; + core::string_view s = "Hello, world"; BEAST_EXPECT(s.size() == 12); for(std::size_t i = 1; i < 12; ++i) { for(std::size_t x = 1; x < 4; ++x) { diff --git a/test/beast/core/ostream.cpp b/test/beast/core/ostream.cpp index 1a4f6cb08b..b0fcd4c920 100644 --- a/test/beast/core/ostream.cpp +++ b/test/beast/core/ostream.cpp @@ -27,7 +27,7 @@ class ostream_test : public beast::unit_test::suite void testOstream() { - string_view const s = "0123456789abcdef"; + core::string_view const s = "0123456789abcdef"; BEAST_EXPECT(s.size() == 16); // overflow @@ -75,7 +75,7 @@ class ostream_test : public beast::unit_test::suite { // Issue #1853 flat_static_buffer<16> b; - auto half_view = string_view(s.data(), 8); + auto half_view = core::string_view(s.data(), 8); { auto os = ostream(b); os << half_view; @@ -88,9 +88,9 @@ class ostream_test : public beast::unit_test::suite flat_static_buffer<16> b; { auto os = ostream(b); - os << string_view(s.data(), 8); + os << core::string_view(s.data(), 8); os.flush(); - os << string_view(s.data() + 8, 8); + os << core::string_view(s.data() + 8, 8); os.flush(); } BEAST_EXPECT(buffers_to_string(b.data()) == s); diff --git a/test/beast/core/static_buffer.cpp b/test/beast/core/static_buffer.cpp index 4bf17f6e28..e2310e5844 100644 --- a/test/beast/core/static_buffer.cpp +++ b/test/beast/core/static_buffer.cpp @@ -45,7 +45,7 @@ class static_buffer_test : public beast::unit_test::suite void testMembers() { - string_view const s = "Hello, world!"; + core::string_view const s = "Hello, world!"; // static_buffer_base { diff --git a/test/beast/core/static_string.cpp b/test/beast/core/static_string.cpp index 7b73e877ce..f68b3d2502 100644 --- a/test/beast/core/static_string.cpp +++ b/test/beast/core/static_string.cpp @@ -126,13 +126,13 @@ class static_string_test : public beast::unit_test::suite } { static_string<3> s1( - string_view("123")); + core::string_view("123")); BEAST_EXPECT(s1 == "123"); BEAST_EXPECT(*s1.end() == 0); try { static_string<2> s2( - string_view("123")); + core::string_view("123")); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -235,13 +235,13 @@ class static_string_test : public beast::unit_test::suite } { static_string<3> s1; - s1 = string_view("123"); + s1 = core::string_view("123"); BEAST_EXPECT(s1 == "123"); BEAST_EXPECT(*s1.end() == 0); try { static_string<1> s2; - s2 = string_view("123"); + s2 = core::string_view("123"); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -373,15 +373,15 @@ class static_string_test : public beast::unit_test::suite } { static_string<5> s1; - s1.assign(string_view("123")); + s1.assign(core::string_view("123")); BEAST_EXPECT(s1 == "123"); BEAST_EXPECT(*s1.end() == 0); - s1.assign(string_view("12345")); + s1.assign(core::string_view("12345")); BEAST_EXPECT(s1 == "12345"); BEAST_EXPECT(*s1.end() == 0); try { - s1.assign(string_view("1234567")); + s1.assign(core::string_view("1234567")); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -486,7 +486,7 @@ class static_string_test : public beast::unit_test::suite } { static_string<3> s("123"); - string_view sv = s; + core::string_view sv = s; BEAST_EXPECT(static_string<5>(sv) == "123"); } } @@ -754,13 +754,13 @@ class static_string_test : public beast::unit_test::suite } { static_string<5> s1("123"); - s1.insert(1, string_view("UV")); + s1.insert(1, core::string_view("UV")); BEAST_EXPECT(s1 == "1UV23"); BEAST_EXPECT(*s1.end() == 0); try { static_string<4> s2("123"); - s2.insert(1, string_view("UV")); + s2.insert(1, core::string_view("UV")); fail("", __FILE__, __LINE__); } catch(std::length_error const&) @@ -770,7 +770,7 @@ class static_string_test : public beast::unit_test::suite try { static_string<5> s2("123"); - s2.insert(5, string_view("UV")); + s2.insert(5, core::string_view("UV")); fail("", __FILE__, __LINE__); } catch(std::out_of_range const&) @@ -1033,7 +1033,7 @@ class static_string_test : public beast::unit_test::suite } } { - string_view s1("XYZ"); + core::string_view s1("XYZ"); static_string<5> s2("12"); s2.append(s1); BEAST_EXPECT(s2 == "12XYZ"); @@ -1133,7 +1133,7 @@ class static_string_test : public beast::unit_test::suite } } { - string_view s1("34"); + core::string_view s1("34"); static_string<4> s2("12"); s2 += s1; BEAST_EXPECT(s2 == "1234"); diff --git a/test/beast/core/test_buffer.hpp b/test/beast/core/test_buffer.hpp index d534bc2932..f92c1fb9bd 100644 --- a/test/beast/core/test_buffer.hpp +++ b/test/beast/core/test_buffer.hpp @@ -119,7 +119,7 @@ void test_mutable_buffers( MutableBufferSequence const& b, net::mutable_buffer) { - string_view src = "Hello, world!"; + core::string_view src = "Hello, world!"; BOOST_ASSERT(buffer_bytes(b) <= src.size()); if(src.size() > buffer_bytes(b)) src = {src.data(), buffer_bytes(b)}; @@ -298,7 +298,7 @@ test_mutable_dynamic_buffer( typename MutableDynamicBuffer_v0::mutable_buffers_type, typename MutableDynamicBuffer_v0::const_buffers_type>::value); - string_view src = "Hello, world!"; + core::string_view src = "Hello, world!"; if(src.size() > b0.max_size()) src = {src.data(), b0.max_size()}; @@ -385,7 +385,7 @@ test_dynamic_buffer( // members { - string_view src = "Hello, world!"; + core::string_view src = "Hello, world!"; DynamicBuffer_v0 b1(b0); auto const mb = b1.prepare(src.size()); @@ -524,7 +524,7 @@ test_dynamic_buffer( // setup source buffer char buf[13]; unsigned char k0 = 0; - string_view src(buf, sizeof(buf)); + core::string_view src(buf, sizeof(buf)); if(src.size() > b0.max_size()) src = {src.data(), b0.max_size()}; BEAST_EXPECT(b0.max_size() >= src.size()); @@ -559,7 +559,7 @@ test_dynamic_buffer( // k = consume size for(std::size_t h = 1; h <= src.size(); ++h) { - string_view in(src.data(), h); + core::string_view in(src.data(), h); for(std::size_t i = 1; i <= in.size(); ++i) { for(std::size_t j = 1; j <= i + 1; ++j) { for(std::size_t k = 1; k <= in.size(); ++k) { @@ -620,7 +620,7 @@ test_dynamic_buffer_ref(DynamicBuffer_v0 b0) // members { - string_view src = "Hello, world!"; + core::string_view src = "Hello, world!"; DynamicBuffer_v0 b1(b0); auto const mb = b1.prepare(src.size()); @@ -702,7 +702,7 @@ test_dynamic_buffer_ref(DynamicBuffer_v0 b0) // setup source buffer char buf[13]; unsigned char k0 = 0; - string_view src(buf, sizeof(buf)); + core::string_view src(buf, sizeof(buf)); if(src.size() > b0.max_size()) src = {src.data(), b0.max_size()}; BEAST_EXPECT(b0.max_size() >= src.size()); @@ -737,7 +737,7 @@ test_dynamic_buffer_ref(DynamicBuffer_v0 b0) // k = consume size for(std::size_t h = 1; h <= src.size(); ++h) { - string_view in(src.data(), h); + core::string_view in(src.data(), h); for(std::size_t i = 1; i <= in.size(); ++i) { for(std::size_t j = 1; j <= i + 1; ++j) { for(std::size_t k = 1; k <= in.size(); ++k) { diff --git a/test/beast/http/basic_parser.cpp b/test/beast/http/basic_parser.cpp index 60c5ddd972..009a76eca0 100644 --- a/test/beast/http/basic_parser.cpp +++ b/test/beast/http/basic_parser.cpp @@ -213,7 +213,7 @@ class basic_parser_test : public beast::unit_test::suite template void - parsegrind(string_view msg, Test const& test, bool skip = false) + parsegrind(core::string_view msg, Test const& test, bool skip = false) { parsegrind(net::const_buffer{ msg.data(), msg.size()}, test, skip); @@ -229,14 +229,14 @@ class basic_parser_test : public beast::unit_test::suite template void - parsegrind(string_view msg) + parsegrind(core::string_view msg) { parsegrind(msg, [](Parser const&){}); } template void - failgrind(string_view msg, error_code const& result) + failgrind(core::string_view msg, error_code const& result) { for(std::size_t i = 1; i < msg.size() - 1; ++i) { @@ -321,7 +321,7 @@ class basic_parser_test : public beast::unit_test::suite testObsFold() { auto const check = - [&](std::string const& s, string_view value) + [&](std::string const& s, core::string_view value) { std::string m = "GET / HTTP/1.1\r\n" @@ -952,7 +952,7 @@ class basic_parser_test : public beast::unit_test::suite static net::const_buffer - buf(string_view s) + buf(core::string_view s) { return {s.data(), s.size()}; } @@ -1140,7 +1140,7 @@ class basic_parser_test : public beast::unit_test::suite error_code ec; test_parser p; p.eager(true); - string_view s = + core::string_view s = "GET / HTTP/1.1\r\n" "\r\n" "die!"; @@ -1177,7 +1177,7 @@ class basic_parser_test : public beast::unit_test::suite error_code ec; test_parser p; p.eager(true); - string_view s = + core::string_view s = "HTTP/1.1 101 Switching Protocols\r\n" "Content-Length: 2147483648\r\n" "\r\n"; @@ -1194,12 +1194,12 @@ class basic_parser_test : public beast::unit_test::suite testFuzz() { auto const grind = - [&](string_view s) + [&](core::string_view s) { static_string<100> ss(s.data(), s.size()); test::fuzz_rand r; test::fuzz(ss, 4, 5, r, - [&](string_view s) + [&](core::string_view s) { error_code ec; test_parser p; @@ -1209,7 +1209,7 @@ class basic_parser_test : public beast::unit_test::suite }); }; auto const good = - [&](string_view s) + [&](core::string_view s) { std::string msg = "HTTP/1.1 200 OK\r\n" @@ -1226,7 +1226,7 @@ class basic_parser_test : public beast::unit_test::suite grind(msg); }; auto const bad = - [&](string_view s) + [&](core::string_view s) { std::string msg = "HTTP/1.1 200 OK\r\n" @@ -1282,7 +1282,7 @@ class basic_parser_test : public beast::unit_test::suite { using base = detail::basic_parser_base; auto const good = - [&](string_view s, std::uint32_t v0) + [&](core::string_view s, std::uint32_t v0) { std::uint64_t v; auto const result = @@ -1291,7 +1291,7 @@ class basic_parser_test : public beast::unit_test::suite BEAST_EXPECTS(v == v0, s); }; auto const bad = - [&](string_view s) + [&](core::string_view s) { std::uint64_t v; auto const result = @@ -1318,7 +1318,7 @@ class basic_parser_test : public beast::unit_test::suite { using base = detail::basic_parser_base; auto const good = - [&](string_view s, std::uint64_t v0) + [&](core::string_view s, std::uint64_t v0) { std::uint64_t v; auto it = s.data(); @@ -1328,7 +1328,7 @@ class basic_parser_test : public beast::unit_test::suite BEAST_EXPECTS(v == v0, s); }; auto const bad = - [&](string_view s) + [&](core::string_view s) { std::uint64_t v; auto it = s.data(); @@ -1513,7 +1513,7 @@ class basic_parser_test : public beast::unit_test::suite void testChunkedBodySize() { - string_view resp = + core::string_view resp = "HTTP/1.1 200 OK\r\n" "Server: test\r\n" "Transfer-Encoding: chunked\r\n" diff --git a/test/beast/http/chunk_encode.cpp b/test/beast/http/chunk_encode.cpp index ceedf6368a..9e04fe97ab 100644 --- a/test/beast/http/chunk_encode.cpp +++ b/test/beast/http/chunk_encode.cpp @@ -38,7 +38,7 @@ class chunk_encode_test template void - check(string_view match, Args&&... args) + check(core::string_view match, Args&&... args) { T t(std::forward(args)...); BEAST_EXPECT(buffers_to_string(t) == match); @@ -50,7 +50,7 @@ class chunk_encode_test template void - check_fwd(string_view match, Args&&... args) + check_fwd(core::string_view match, Args&&... args) { T t(std::forward(args)...); BEAST_EXPECT(buffers_to_string(t) == match); @@ -64,7 +64,7 @@ class chunk_encode_test static cb_t - cb(string_view s) + cb(core::string_view s) { return {s.data(), s.size()}; } @@ -227,7 +227,7 @@ class chunk_encode_test testParseChunkExtensions() { auto const grind = - [&](string_view s) + [&](core::string_view s) { error_code ec; static_string<200> ss(s.data(), s.size()); @@ -235,7 +235,7 @@ class chunk_encode_test for(auto i = 3; i--;) { test::fuzz(ss, 5, 5, r, - [&](string_view s) + [&](core::string_view s) { chunk_extensions c1; c1.parse(s, ec); @@ -259,7 +259,7 @@ class chunk_encode_test } }; auto const good = - [&](string_view s) + [&](core::string_view s) { error_code ec; chunk_extensions ce; @@ -268,7 +268,7 @@ class chunk_encode_test grind(s); }; auto const bad = - [&](string_view s) + [&](core::string_view s) { error_code ec; chunk_extensions ce; diff --git a/test/beast/http/field.cpp b/test/beast/http/field.cpp index 78437c4b98..c6f5c98e69 100644 --- a/test/beast/http/field.cpp +++ b/test/beast/http/field.cpp @@ -23,7 +23,7 @@ class field_test : public beast::unit_test::suite testField() { auto const match = - [&](field f, string_view s) + [&](field f, core::string_view s) { BEAST_EXPECT(iequals(to_string(f), s)); BEAST_EXPECT(string_to_field(s) == f); @@ -163,7 +163,7 @@ class field_test : public beast::unit_test::suite match(field::x_xss_protection, "X-XSS-Protection"); auto const unknown = - [&](string_view s) + [&](core::string_view s) { BEAST_EXPECT(string_to_field(s) == field::unknown); }; diff --git a/test/beast/http/fields.cpp b/test/beast/http/fields.cpp index c1aa3bbe7c..0eb3036342 100644 --- a/test/beast/http/fields.cpp +++ b/test/beast/http/fields.cpp @@ -1042,30 +1042,30 @@ class fields_test : public beast::unit_test::suite BOOST_CORE_STATIC_ASSERT((! set_test::value)); BOOST_CORE_STATIC_ASSERT((! set_test::value)); BOOST_CORE_STATIC_ASSERT((! set_test::value)); - BOOST_CORE_STATIC_ASSERT((! set_test::value)); - BOOST_CORE_STATIC_ASSERT((! set_test::value)); - BOOST_CORE_STATIC_ASSERT((! set_test::value)); + BOOST_CORE_STATIC_ASSERT((! set_test::value)); + BOOST_CORE_STATIC_ASSERT((! set_test::value)); + BOOST_CORE_STATIC_ASSERT((! set_test::value)); BOOST_CORE_STATIC_ASSERT(( set_test::value)); - BOOST_CORE_STATIC_ASSERT(( set_test::value)); + BOOST_CORE_STATIC_ASSERT(( set_test::value)); BOOST_CORE_STATIC_ASSERT(( set_test::value)); - BOOST_CORE_STATIC_ASSERT(( set_test::value)); - BOOST_CORE_STATIC_ASSERT(( set_test::value)); - BOOST_CORE_STATIC_ASSERT(( set_test::value)); + BOOST_CORE_STATIC_ASSERT(( set_test::value)); + BOOST_CORE_STATIC_ASSERT(( set_test::value)); + BOOST_CORE_STATIC_ASSERT(( set_test::value)); BOOST_CORE_STATIC_ASSERT((! insert_test::value)); BOOST_CORE_STATIC_ASSERT((! insert_test::value)); BOOST_CORE_STATIC_ASSERT((! insert_test::value)); - BOOST_CORE_STATIC_ASSERT((! insert_test::value)); - BOOST_CORE_STATIC_ASSERT((! insert_test::value)); - BOOST_CORE_STATIC_ASSERT((! insert_test::value)); + BOOST_CORE_STATIC_ASSERT((! insert_test::value)); + BOOST_CORE_STATIC_ASSERT((! insert_test::value)); + BOOST_CORE_STATIC_ASSERT((! insert_test::value)); BOOST_CORE_STATIC_ASSERT(( insert_test::value)); - BOOST_CORE_STATIC_ASSERT(( insert_test::value)); + BOOST_CORE_STATIC_ASSERT(( insert_test::value)); BOOST_CORE_STATIC_ASSERT(( insert_test::value)); - BOOST_CORE_STATIC_ASSERT(( insert_test::value)); - BOOST_CORE_STATIC_ASSERT(( insert_test::value)); - BOOST_CORE_STATIC_ASSERT(( insert_test::value)); + BOOST_CORE_STATIC_ASSERT(( insert_test::value)); + BOOST_CORE_STATIC_ASSERT(( insert_test::value)); + BOOST_CORE_STATIC_ASSERT(( insert_test::value)); } template diff --git a/test/beast/http/file_body.cpp b/test/beast/http/file_body.cpp index 3f049cd442..00bf40fdff 100644 --- a/test/beast/http/file_body.cpp +++ b/test/beast/http/file_body.cpp @@ -103,7 +103,7 @@ class file_body_test : public beast::unit_test::suite doTestFileBody() { error_code ec; - string_view const s = + core::string_view const s = "HTTP/1.1 200 OK\r\n" "Server: test\r\n" "Content-Length: 3\r\n" @@ -147,7 +147,7 @@ class file_body_test : public beast::unit_test::suite sr.next(ec, visit); BEAST_EXPECTS(! ec, ec.message()); auto const b = buffers_front(visit.buffer.data()); - string_view const s1{ + core::string_view const s1{ reinterpret_cast(b.data()), b.size()}; BEAST_EXPECTS(s1 == s, s1); @@ -164,7 +164,7 @@ class file_body_test : public beast::unit_test::suite auto temp = temp_file(log); error_code ec; - string_view const ten = + core::string_view const ten = "0123456789"; // 40 // create the temporary file { @@ -219,7 +219,7 @@ class file_body_test : public beast::unit_test::suite auto temp = temp_file(log); error_code ec; - string_view const ten = + core::string_view const ten = "0123456789"; // 40 // create the temporary file { diff --git a/test/beast/http/message.cpp b/test/beast/http/message.cpp index d24e130629..0392a47754 100644 --- a/test/beast/http/message.cpp +++ b/test/beast/http/message.cpp @@ -87,23 +87,23 @@ class message_test : public beast::unit_test::suite >::value); //BOOST_CORE_STATIC_ASSERT(! std::is_constructible, - // verb, string_view, unsigned>::value); + // verb, core::string_view, unsigned>::value); BOOST_CORE_STATIC_ASSERT(std::is_constructible, - verb, string_view, unsigned, Arg1>::value); + verb, core::string_view, unsigned, Arg1>::value); BOOST_CORE_STATIC_ASSERT(std::is_constructible, - verb, string_view, unsigned, Arg1&&>::value); + verb, core::string_view, unsigned, Arg1&&>::value); BOOST_CORE_STATIC_ASSERT(std::is_constructible, - verb, string_view, unsigned, Arg1 const>::value); + verb, core::string_view, unsigned, Arg1 const>::value); BOOST_CORE_STATIC_ASSERT(std::is_constructible, - verb, string_view, unsigned, Arg1 const&>::value); + verb, core::string_view, unsigned, Arg1 const&>::value); // 1-arg + fields BOOST_CORE_STATIC_ASSERT(std::is_constructible, - verb, string_view, unsigned, Arg1, fields::allocator_type>::value); + verb, core::string_view, unsigned, Arg1, fields::allocator_type>::value); BOOST_CORE_STATIC_ASSERT(std::is_constructible, std::piecewise_construct_t, std::tuple>::value); @@ -198,15 +198,15 @@ class message_test : public beast::unit_test::suite test_fields() = delete; test_fields(token) {} - string_view get_method_impl() const { return {}; } - string_view get_target_impl() const { return target; } - string_view get_reason_impl() const { return {}; } + core::string_view get_method_impl() const { return {}; } + core::string_view get_target_impl() const { return target; } + core::string_view get_reason_impl() const { return {}; } bool get_chunked_impl() const { return false; } bool get_keep_alive_impl(unsigned) const { return true; } bool has_content_length_impl() const { return false; } - void set_method_impl(string_view) {} - void set_target_impl(string_view s) { target = std::string(s); } - void set_reason_impl(string_view) {} + void set_method_impl(core::string_view) {} + void set_target_impl(core::string_view s) { target = std::string(s); } + void set_reason_impl(core::string_view) {} void set_chunked_impl(bool) {} void set_content_length_impl(boost::optional) {} void set_keep_alive_impl(unsigned, bool) {} @@ -352,7 +352,7 @@ class message_test : public beast::unit_test::suite BEAST_EXPECT(h.method_string() == to_string(v)); }; auto const scheck = - [&](string_view s) + [&](core::string_view s) { h.method_string(s); BEAST_EXPECT(h.method() == string_to_verb(s)); diff --git a/test/beast/http/message_fuzz.hpp b/test/beast/http/message_fuzz.hpp index f6d9f89db7..f719c2f055 100644 --- a/test/beast/http/message_fuzz.hpp +++ b/test/beast/http/message_fuzz.hpp @@ -22,7 +22,7 @@ namespace http { template std::string -escaped_string(string_view s) +escaped_string(core::string_view s) { std::string out; out.reserve(s.size()); diff --git a/test/beast/http/parser.cpp b/test/beast/http/parser.cpp index 05e5a0e5eb..09eef495db 100644 --- a/test/beast/http/parser.cpp +++ b/test/beast/http/parser.cpp @@ -36,7 +36,7 @@ class parser_test static net::const_buffer - buf(string_view s) + buf(core::string_view s) { return {s.data(), s.size()}; } @@ -70,7 +70,7 @@ class parser_test template void - doMatrix(string_view s0, F const& f) + doMatrix(core::string_view s0, F const& f) { // parse a single buffer { diff --git a/test/beast/http/read.cpp b/test/beast/http/read.cpp index 61a0c99444..b5888fb951 100644 --- a/test/beast/http/read.cpp +++ b/test/beast/http/read.cpp @@ -440,7 +440,7 @@ class read_test template void - readgrind(string_view s, Pred&& pred) + readgrind(core::string_view s, Pred&& pred) { for(std::size_t n = 1; n < s.size() - 1; ++n) { @@ -600,8 +600,8 @@ class read_test request_parser p; test::stream s(ioc_); - s.append(string_view(hdr)); - s.append(string_view(body)); + s.append(core::string_view(hdr)); + s.append(core::string_view(body)); flat_buffer fb; error_code ec; auto bt = async_read_header(s, fb, p, yield[ec]); @@ -685,8 +685,8 @@ class read_test // bytes_transferred returns length of header request_parser p; test::stream s(ioc); - s.append(string_view(hdr)); - s.append(string_view(body)); + s.append(core::string_view(hdr)); + s.append(core::string_view(body)); flat_buffer fb; error_code ec; auto bt = read_header(s, fb, p, ec); @@ -703,8 +703,8 @@ class read_test // bytes_transferred returns length of header request_parser p; test::stream s(ioc); - s.append(string_view(hdr)); - s.append(string_view(body)); + s.append(core::string_view(hdr)); + s.append(core::string_view(body)); std::string res ; auto fb = asio::dynamic_buffer(res); error_code ec; diff --git a/test/beast/http/rfc7230.cpp b/test/beast/http/rfc7230.cpp index 1bcc135349..52584295de 100644 --- a/test/beast/http/rfc7230.cpp +++ b/test/beast/http/rfc7230.cpp @@ -31,7 +31,7 @@ class rfc7230_test : public beast::unit_test::suite static std::string - str(string_view s) + str(core::string_view s) { return std::string(s.data(), s.size()); } @@ -246,7 +246,7 @@ class rfc7230_test : public beast::unit_test::suite template static std::vector - to_vector(string_view in) + to_vector(core::string_view in) { std::vector v; detail::basic_parsed_list list{in}; @@ -258,7 +258,7 @@ class rfc7230_test : public beast::unit_test::suite template void - validate(string_view in, + validate(core::string_view in, std::vector const& v) { BEAST_EXPECT(to_vector(in) == v); @@ -266,7 +266,7 @@ class rfc7230_test : public beast::unit_test::suite template void - good(string_view in) + good(core::string_view in) { BEAST_EXPECT(validate_list( detail::basic_parsed_list{in})); @@ -274,7 +274,7 @@ class rfc7230_test : public beast::unit_test::suite template void - good(string_view in, + good(core::string_view in, std::vector const& v) { BEAST_EXPECT(validate_list( @@ -284,7 +284,7 @@ class rfc7230_test : public beast::unit_test::suite template void - bad(string_view in) + bad(core::string_view in) { BEAST_EXPECT(! validate_list( detail::basic_parsed_list{in})); diff --git a/test/beast/http/test_parser.hpp b/test/beast/http/test_parser.hpp index 3a56d39700..681a28028e 100644 --- a/test/beast/http/test_parser.hpp +++ b/test/beast/http/test_parser.hpp @@ -55,8 +55,8 @@ class test_parser } void - on_request_impl(verb, string_view method_str_, - string_view path_, int version_, error_code& ec) + on_request_impl(verb, core::string_view method_str_, + core::string_view path_, int version_, error_code& ec) { method = std::string( method_str_.data(), method_str_.size()); @@ -70,7 +70,7 @@ class test_parser void on_response_impl(int code, - string_view reason_, + core::string_view reason_, int version_, error_code& ec) { status = code; @@ -83,8 +83,8 @@ class test_parser } void - on_field_impl(field, string_view name, - string_view value, error_code& ec) + on_field_impl(field, core::string_view name, + core::string_view value, error_code& ec) { ++got_on_field; if(fc_) @@ -93,8 +93,8 @@ class test_parser } void - on_trailer_field_impl(field, string_view name, - string_view value, error_code& ec) + on_trailer_field_impl(field, core::string_view name, + core::string_view value, error_code& ec) { ++got_on_trailer_field; if(fc_) @@ -125,7 +125,7 @@ class test_parser } std::size_t - on_body_impl(string_view s, + on_body_impl(core::string_view s, error_code& ec) { body.append(s.data(), s.size()); @@ -137,7 +137,7 @@ class test_parser void on_chunk_header_impl( std::uint64_t, - string_view, + core::string_view, error_code& ec) { ++got_on_chunk; @@ -148,7 +148,7 @@ class test_parser std::size_t on_chunk_body_impl( std::uint64_t, - string_view s, + core::string_view s, error_code& ec) { body.append(s.data(), s.size()); diff --git a/test/beast/http/verb.cpp b/test/beast/http/verb.cpp index 46ef531f0e..e9b956b4a7 100644 --- a/test/beast/http/verb.cpp +++ b/test/beast/http/verb.cpp @@ -66,7 +66,7 @@ class verb_test good(verb::unlink); auto const bad = - [&](string_view s) + [&](core::string_view s) { auto const v = string_to_verb(s); BEAST_EXPECTS(v == verb::unknown, to_string(v)); diff --git a/test/beast/http/write.cpp b/test/beast/http/write.cpp index a8a618a437..4bc7629dd3 100644 --- a/test/beast/http/write.cpp +++ b/test/beast/http/write.cpp @@ -274,7 +274,7 @@ class write_test template bool - equal_body(string_view sv, string_view body) + equal_body(core::string_view sv, core::string_view body) { test::stream ts{ioc_, sv}, tr{ioc_}; ts.connect(tr); diff --git a/test/beast/websocket/accept.cpp b/test/beast/websocket/accept.cpp index ca6d43572c..18a53b5c68 100644 --- a/test/beast/websocket/accept.cpp +++ b/test/beast/websocket/accept.cpp @@ -482,7 +482,7 @@ class accept_test : public unit_test::suite //: public websocket_test_suite net::io_context ioc; auto const check = - [&](error_code ev, string_view s) + [&](error_code ev, core::string_view s) { for(int i = 0; i < 3; ++i) { @@ -798,7 +798,7 @@ class accept_test : public unit_test::suite //: public websocket_test_suite { { stream ws1(ioc); - string_view s = + core::string_view s = "GET / HTTP/1.1\r\n" "Host: localhost\r\n" "Upgrade: websocket\r\n" diff --git a/test/beast/websocket/close.cpp b/test/beast/websocket/close.cpp index ddf7a53d65..f80d3a1c2b 100644 --- a/test/beast/websocket/close.cpp +++ b/test/beast/websocket/close.cpp @@ -361,7 +361,7 @@ class close_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add a ping and message to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x89\x00" "\x81\x01*", 5}); std::size_t count = 0; ws.async_read(b, @@ -402,7 +402,7 @@ class close_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add an invalid frame to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x09\x00", 2}); std::size_t count = 0; ws.async_read(b, @@ -443,7 +443,7 @@ class close_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add a close frame to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x88\x00", 2}); std::size_t count = 0; ws.async_read(b, @@ -485,7 +485,7 @@ class close_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add a close frame to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x88\x00", 2}); std::size_t count = 0; ws.async_write(net::buffer(s), @@ -529,7 +529,7 @@ class close_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add a ping frame to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x89\x00", 2}); std::size_t count = 0; ws.async_write(net::buffer(s), diff --git a/test/beast/websocket/handshake.cpp b/test/beast/websocket/handshake.cpp index 3ac501699c..33ac381282 100644 --- a/test/beast/websocket/handshake.cpp +++ b/test/beast/websocket/handshake.cpp @@ -309,7 +309,7 @@ class handshake_test : public websocket_test_suite detail::pmd_offer po; auto const accept = - [&](string_view s) + [&](core::string_view s) { http::fields f; f.set(http::field::sec_websocket_extensions, s); @@ -319,7 +319,7 @@ class handshake_test : public websocket_test_suite }; auto const reject = - [&](string_view s) + [&](core::string_view s) { http::fields f; f.set(http::field::sec_websocket_extensions, s); @@ -401,7 +401,7 @@ class handshake_test : public websocket_test_suite detail::pmd_offer po; auto const check = - [&](string_view match) + [&](core::string_view match) { http::fields f; detail::pmd_write(f, po); @@ -447,7 +447,7 @@ class handshake_test : public websocket_test_suite auto const reject = [&]( - string_view offer) + core::string_view offer) { detail::pmd_offer po; { @@ -463,8 +463,8 @@ class handshake_test : public websocket_test_suite auto const accept = [&]( - string_view offer, - string_view result) + core::string_view offer, + core::string_view result) { detail::pmd_offer po; { diff --git a/test/beast/websocket/ping.cpp b/test/beast/websocket/ping.cpp index ba70628054..c2933e3fb7 100644 --- a/test/beast/websocket/ping.cpp +++ b/test/beast/websocket/ping.cpp @@ -148,7 +148,7 @@ class ping_test : public websocket_test_suite true }); unsigned n_pongs = 0; - ws1.control_callback({[&](frame_type kind, string_view) + ws1.control_callback({[&](frame_type kind, core::string_view) { if (kind == frame_type::pong) ++n_pongs; @@ -247,7 +247,7 @@ class ping_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add a ping and message to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x89\x00" "\x81\x01*", 5}); std::size_t count = 0; multi_buffer b; @@ -288,7 +288,7 @@ class ping_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add an invalid frame to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x09\x00", 2}); std::size_t count = 0; @@ -330,7 +330,7 @@ class ping_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add a close frame to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x88\x00", 2}); std::size_t count = 0; multi_buffer b; diff --git a/test/beast/websocket/read1.cpp b/test/beast/websocket/read1.cpp index 0b03e230b8..e99e2c3558 100644 --- a/test/beast/websocket/read1.cpp +++ b/test/beast/websocket/read1.cpp @@ -185,7 +185,7 @@ class read1_test : public unit_test::suite stream_base::none(), false}); // add a close frame to the input - ws1.next_layer().append(string_view{ + ws1.next_layer().append(core::string_view{ "\x88\x00", 2}); ws1.async_read(b, test::fail_handler( beast::error::timeout)); diff --git a/test/beast/websocket/read2.cpp b/test/beast/websocket/read2.cpp index 3cb2408db3..d3150228b9 100644 --- a/test/beast/websocket/read2.cpp +++ b/test/beast/websocket/read2.cpp @@ -102,7 +102,7 @@ class read2_test [&](ws_type_t& ws) { ws.next_layer().append( - string_view( + core::string_view( "\x01\x00" "\x80\x00", 4)); multi_buffer b; w.read(ws, b); @@ -133,7 +133,7 @@ class read2_test {0x89, 0x00})); bool invoked = false; ws.control_callback( - [&](frame_type kind, string_view) + [&](frame_type kind, core::string_view) { BEAST_EXPECT(! invoked); BEAST_EXPECT(kind == frame_type::ping); @@ -155,7 +155,7 @@ class read2_test {0x88, 0x00})); bool invoked = false; ws.control_callback( - [&](frame_type kind, string_view) + [&](frame_type kind, core::string_view) { BEAST_EXPECT(! invoked); BEAST_EXPECT(kind == frame_type::close); @@ -171,7 +171,7 @@ class read2_test { bool once = false; ws.control_callback( - [&](frame_type kind, string_view s) + [&](frame_type kind, core::string_view s) { BEAST_EXPECT(kind == frame_type::pong); BEAST_EXPECT(! once); @@ -194,7 +194,7 @@ class read2_test { bool once = false; ws.control_callback( - [&](frame_type kind, string_view s) + [&](frame_type kind, core::string_view s) { BEAST_EXPECT(kind == frame_type::pong); BEAST_EXPECT(! once); @@ -389,7 +389,7 @@ class read2_test // close frames { auto const check = - [&](error_code ev, string_view s) + [&](error_code ev, core::string_view s) { echo_server es{log}; stream ws{ioc_}; @@ -560,7 +560,7 @@ class read2_test w.read_some(ws, net::buffer(buf, sizeof(buf))); BEAST_EXPECT(bytes_written > 0); BEAST_EXPECT( - string_view(buf, 3).substr(0, bytes_written) == + core::string_view(buf, 3).substr(0, bytes_written) == s.substr(0, bytes_written)); }); @@ -637,7 +637,7 @@ class read2_test // Read close frames { auto const check = - [&](error_code ev, string_view s) + [&](error_code ev, core::string_view s) { echo_server es{log}; stream ws{ioc_}; diff --git a/test/beast/websocket/read3.cpp b/test/beast/websocket/read3.cpp index a16060db9a..92ebc67e79 100644 --- a/test/beast/websocket/read3.cpp +++ b/test/beast/websocket/read3.cpp @@ -99,7 +99,7 @@ class read3_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // insert a ping - ws.next_layer().append(string_view( + ws.next_layer().append(core::string_view( "\x89\x00", 2)); std::size_t count = 0; std::string const s = "Hello, world"; @@ -139,7 +139,7 @@ class read3_test : public websocket_test_suite std::size_t count = 0; // insert fragmented message with // a ping in between the frames. - ws.next_layer().append(string_view( + ws.next_layer().append(core::string_view( "\x01\x01*" "\x89\x00" "\x80\x01*", 8)); @@ -187,7 +187,7 @@ class read3_test : public websocket_test_suite std::size_t count = 0; // insert fragmented message with // a close in between the frames. - ws.next_layer().append(string_view( + ws.next_layer().append(core::string_view( "\x01\x01*" "\x88\x00" "\x80\x01*", 8)); @@ -219,7 +219,7 @@ class read3_test : public websocket_test_suite testParseFrame() { auto const bad = - [&](string_view s) + [&](core::string_view s) { echo_server es{log}; net::io_context ioc; @@ -335,8 +335,8 @@ class read3_test : public websocket_test_suite } // length not canonical - bad(string_view("\x81\x7e\x00\x7d", 4)); - bad(string_view("\x81\x7f\x00\x00\x00\x00\x00\x00\xff\xff", 10)); + bad(core::string_view("\x81\x7e\x00\x7d", 4)); + bad(core::string_view("\x81\x7f\x00\x00\x00\x00\x00\x00\xff\xff", 10)); } void @@ -398,7 +398,7 @@ class read3_test : public websocket_test_suite bool called_cb = false; bool called_handler = false; ws.control_callback( - [&called_cb](frame_type, string_view) + [&called_cb](frame_type, core::string_view) { called_cb = true; }); diff --git a/test/beast/websocket/test.hpp b/test/beast/websocket/test.hpp index 1575db32bb..ee4b98af5b 100644 --- a/test/beast/websocket/test.hpp +++ b/test/beast/websocket/test.hpp @@ -526,8 +526,8 @@ class websocket_test_suite void handshake( stream& ws, - string_view uri, - string_view path) const + core::string_view uri, + core::string_view path) const { ws.handshake(uri, path); } @@ -537,8 +537,8 @@ class websocket_test_suite handshake( stream& ws, response_type& res, - string_view uri, - string_view path) const + core::string_view uri, + core::string_view path) const { ws.handshake(res, uri, path); } @@ -549,8 +549,8 @@ class websocket_test_suite void handshake_ex( stream& ws, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const& d) const { ws.handshake_ex(uri, path, d); @@ -563,8 +563,8 @@ class websocket_test_suite handshake_ex( stream& ws, response_type& res, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const& d) const { ws.handshake_ex(res, uri, path, d); @@ -780,8 +780,8 @@ class websocket_test_suite void handshake( stream& ws, - string_view uri, - string_view path) const + core::string_view uri, + core::string_view path) const { error_code ec; ws.async_handshake( @@ -795,8 +795,8 @@ class websocket_test_suite handshake( stream& ws, response_type& res, - string_view uri, - string_view path) const + core::string_view uri, + core::string_view path) const { error_code ec; ws.async_handshake( @@ -811,8 +811,8 @@ class websocket_test_suite void handshake_ex( stream& ws, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const &d) const { error_code ec; @@ -829,8 +829,8 @@ class websocket_test_suite handshake_ex( stream& ws, response_type& res, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const &d) const { error_code ec; @@ -1061,8 +1061,8 @@ struct test_sync_api handshake( stream& ws, response_type& res, - string_view uri, - string_view path) const + core::string_view uri, + core::string_view path) const { ws.handshake(res, uri, path); } @@ -1073,8 +1073,8 @@ struct test_sync_api void handshake_ex( stream& ws, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const& d) const { ws.handshake_ex(uri, path, d); @@ -1087,8 +1087,8 @@ struct test_sync_api handshake_ex( stream& ws, response_type& res, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const& d) const { ws.handshake_ex(res, uri, path, d); @@ -1361,8 +1361,8 @@ class test_async_api void handshake( stream& ws, - string_view uri, - string_view path) const + core::string_view uri, + core::string_view path) const { error_code ec; ws.async_handshake( @@ -1378,8 +1378,8 @@ class test_async_api handshake( stream& ws, response_type& res, - string_view uri, - string_view path) const + core::string_view uri, + core::string_view path) const { error_code ec; ws.async_handshake( @@ -1396,8 +1396,8 @@ class test_async_api void handshake_ex( stream& ws, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const &d) const { error_code ec; @@ -1416,8 +1416,8 @@ class test_async_api handshake_ex( stream& ws, response_type& res, - string_view uri, - string_view path, + core::string_view uri, + core::string_view path, Decorator const &d) const { error_code ec; diff --git a/test/beast/websocket/timer.cpp b/test/beast/websocket/timer.cpp index 7ad3a59f17..311b971a03 100644 --- a/test/beast/websocket/timer.cpp +++ b/test/beast/websocket/timer.cpp @@ -48,7 +48,7 @@ struct timer_test : unit_test::suite flat_buffer b2; bool received = false; ws1.control_callback( - [&received](frame_type ft, string_view) + [&received](frame_type ft, core::string_view) { received = true; BEAST_EXPECT(ft == frame_type::ping); diff --git a/test/beast/websocket/write.cpp b/test/beast/websocket/write.cpp index 84978969b8..a679fafaaa 100644 --- a/test/beast/websocket/write.cpp +++ b/test/beast/websocket/write.cpp @@ -375,7 +375,7 @@ class write_test : public websocket_test_suite ws.next_layer().connect(es.stream()); ws.handshake("localhost", "/"); // add a ping and message to the input - ws.next_layer().append(string_view{ + ws.next_layer().append(core::string_view{ "\x89\x00" "\x81\x01*", 5}); std::size_t count = 0; multi_buffer b; diff --git a/test/beast/zlib/deflate_stream.cpp b/test/beast/zlib/deflate_stream.cpp index 6a003bff33..9557db1fec 100644 --- a/test/beast/zlib/deflate_stream.cpp +++ b/test/beast/zlib/deflate_stream.cpp @@ -203,7 +203,7 @@ class deflate_stream_test : public beast::unit_test::suite static std::string compress( - string_view const& in, + core::string_view const& in, int level, // 0=none, 1..9, -1=default int windowBits, // 9..15 int memLevel) // 1..9 (8=default) @@ -240,7 +240,7 @@ class deflate_stream_test : public beast::unit_test::suite static std::string - decompress(string_view const& in) + decompress(core::string_view const& in) { int result; std::string out; @@ -474,7 +474,7 @@ class deflate_stream_test : public beast::unit_test::suite c.init(); std::string out; out.resize(1024); - string_view s = "Hello"; + core::string_view s = "Hello"; c.next_in(s.data()); c.avail_in(s.size()); c.next_out(&out.front()); @@ -501,7 +501,7 @@ class deflate_stream_test : public beast::unit_test::suite c.init(); std::string out; out.resize(1024); - string_view s = "Hello"; + core::string_view s = "Hello"; c.next_in(s.data()); c.avail_in(s.size()); c.next_out(&out.front()); diff --git a/test/beast/zlib/inflate_stream.cpp b/test/beast/zlib/inflate_stream.cpp index 900f78c1c7..03631d96e5 100644 --- a/test/beast/zlib/inflate_stream.cpp +++ b/test/beast/zlib/inflate_stream.cpp @@ -187,7 +187,7 @@ class inflate_stream_test : public beast::unit_test::suite static std::string compress( - string_view const& in, + core::string_view const& in, int level, // 0=none, 1..9, -1=default int windowBits, // 9..15 int memLevel, // 1..9 (8=default) diff --git a/test/bench/buffers/bench_buffers.cpp b/test/bench/buffers/bench_buffers.cpp index fdd00a4703..8af640908b 100644 --- a/test/bench/buffers/bench_buffers.cpp +++ b/test/bench/buffers/bench_buffers.cpp @@ -174,7 +174,7 @@ class buffers_test : public beast::unit_test::suite template void - do_trials(string_view name, + do_trials(core::string_view name, std::size_t trials, F0&& f0, FN... fn) { using namespace std::chrono; diff --git a/test/bench/parser/bench_parser.cpp b/test/bench/parser/bench_parser.cpp index b796b1f795..e79ffe74e8 100644 --- a/test/bench/parser/bench_parser.cpp +++ b/test/bench/parser/bench_parser.cpp @@ -153,21 +153,21 @@ class parser_test : public beast::unit_test::suite { void on_request_impl( - verb, string_view, string_view, + verb, core::string_view, core::string_view, int, error_code&) override { } void on_response_impl( - int, string_view, int, + int, core::string_view, int, error_code&) override { } void on_field_impl( - field, string_view, string_view, + field, core::string_view, core::string_view, error_code&) override { } @@ -186,7 +186,7 @@ class parser_test : public beast::unit_test::suite std::size_t on_body_impl( - string_view, + core::string_view, error_code&) override { return 0; @@ -195,7 +195,7 @@ class parser_test : public beast::unit_test::suite void on_chunk_header_impl( std::uint64_t, - string_view, + core::string_view, error_code&) override { } @@ -203,7 +203,7 @@ class parser_test : public beast::unit_test::suite std::size_t on_chunk_body_impl( std::uint64_t, - string_view, + core::string_view, error_code&) override { return 0; @@ -222,26 +222,26 @@ class parser_test : public beast::unit_test::suite net::mutable_buffer; void - on_request_impl(verb, string_view, - string_view, int, error_code&) override + on_request_impl(verb, core::string_view, + core::string_view, int, error_code&) override { } void on_response_impl(int, - string_view, int, error_code&) override + core::string_view, int, error_code&) override { } void on_field_impl(field, - string_view, string_view, error_code&) override + core::string_view, core::string_view, error_code&) override { } void on_trailer_field_impl(field, - string_view, string_view, error_code&) override + core::string_view, core::string_view, error_code&) override { } @@ -259,20 +259,20 @@ class parser_test : public beast::unit_test::suite std::size_t on_body_impl( - string_view s, error_code&) override + core::string_view s, error_code&) override { return s.size(); } void on_chunk_header_impl(std::uint64_t, - string_view, error_code&) override + core::string_view, error_code&) override { } std::size_t on_chunk_body_impl(std::uint64_t, - string_view s, error_code&) override + core::string_view s, error_code&) override { return s.size(); } diff --git a/test/bench/zlib/deflate_stream.cpp b/test/bench/zlib/deflate_stream.cpp index 72c039aaf8..912ddf0f1f 100644 --- a/test/bench/zlib/deflate_stream.cpp +++ b/test/bench/zlib/deflate_stream.cpp @@ -65,7 +65,7 @@ class deflate_stream_test : public beast::unit_test::suite } std::string - doDeflateBeast(string_view const& in) + doDeflateBeast(core::string_view const& in) { z_params zs; deflate_stream ds; @@ -88,7 +88,7 @@ class deflate_stream_test : public beast::unit_test::suite } std::string - doDeflateZLib(string_view const& in) + doDeflateZLib(core::string_view const& in) { int result; z_stream zs; diff --git a/test/bench/zlib/inflate_stream.cpp b/test/bench/zlib/inflate_stream.cpp index e2c1f5f02f..0c2e7fefe2 100644 --- a/test/bench/zlib/inflate_stream.cpp +++ b/test/bench/zlib/inflate_stream.cpp @@ -66,7 +66,7 @@ class inflate_stream_test : public beast::unit_test::suite static std::string - compress(string_view const& in) + compress(core::string_view const& in) { int result; z_stream zs; @@ -98,7 +98,7 @@ class inflate_stream_test : public beast::unit_test::suite } std::string - doInflateBeast(string_view const& in) + doInflateBeast(core::string_view const& in) { z_params zs; std::string out; @@ -125,7 +125,7 @@ class inflate_stream_test : public beast::unit_test::suite } std::string - doInflateZLib(string_view const& in) + doInflateZLib(core::string_view const& in) { int result; z_stream zs; diff --git a/test/doc/core_1_refresher.cpp b/test/doc/core_1_refresher.cpp index 25362d87aa..0b61b98108 100644 --- a/test/doc/core_1_refresher.cpp +++ b/test/doc/core_1_refresher.cpp @@ -24,6 +24,8 @@ namespace boost { namespace beast { +namespace core = boost::core; // + namespace { void @@ -33,13 +35,13 @@ snippets() { //[code_core_1_refresher_1s net::const_buffer cb("Hello, world!", 13); - assert(string_view(reinterpret_cast( + assert(core::string_view(reinterpret_cast( cb.data()), cb.size()) == "Hello, world!"); char storage[13]; net::mutable_buffer mb(storage, sizeof(storage)); std::memcpy(mb.data(), cb.data(), mb.size()); - assert(string_view(reinterpret_cast( + assert(core::string_view(reinterpret_cast( mb.data()), mb.size()) == "Hello, world!"); //] } diff --git a/test/doc/core_snippets.cpp b/test/doc/core_snippets.cpp index b4ab125733..a137fef5bd 100644 --- a/test/doc/core_snippets.cpp +++ b/test/doc/core_snippets.cpp @@ -29,6 +29,7 @@ void fxx() using namespace boost::beast; namespace net = boost::asio; namespace ssl = boost::asio::ssl; +namespace core = boost::core; using tcp = net::ip::tcp; net::io_context ioc; @@ -68,7 +69,7 @@ net::connect(stream, r.resolve("www.example.com", "http")); //[snippet_core_3 template -void write_string(SyncWriteStream& stream, string_view s) +void write_string(SyncWriteStream& stream, core::string_view s) { static_assert(is_sync_write_stream::value, "SyncWriteStream type requirements not met"); diff --git a/test/doc/exemplars.cpp b/test/doc/exemplars.cpp index c09a58b007..dbe6b5f016 100644 --- a/test/doc/exemplars.cpp +++ b/test/doc/exemplars.cpp @@ -20,6 +20,8 @@ namespace boost { namespace beast { namespace http { +namespace core = boost::core; // + class BodyWriter; class BodyReader; @@ -199,21 +201,21 @@ class Fields @note Only called for requests. */ - string_view + core::string_view get_method_impl() const; /** Returns the request-target string. @note Only called for requests. */ - string_view + core::string_view get_target_impl() const; /** Returns the response reason-phrase string. @note Only called for responses. */ - string_view + core::string_view get_reason_impl() const; /** Returns the chunked Transfer-Encoding setting @@ -236,21 +238,21 @@ class Fields @note Only called for requests. */ void - set_method_impl(string_view s); + set_method_impl(core::string_view s); /** Set or clear the target string. @note Only called for requests. */ void - set_target_impl(string_view s); + set_target_impl(core::string_view s); /** Set or clear the reason string. @note Only called for responses. */ void - set_reason_impl(string_view s); + set_reason_impl(core::string_view s); /** Sets or clears the chunked Transfer-Encoding value */ diff --git a/test/doc/http_10_custom_parser.cpp b/test/doc/http_10_custom_parser.cpp index cc3603a5a8..7395cc7f2e 100644 --- a/test/doc/http_10_custom_parser.cpp +++ b/test/doc/http_10_custom_parser.cpp @@ -13,6 +13,8 @@ namespace boost { namespace beast { namespace http { +namespace core = boost::core; // + //[code_http_10_custom_parser template @@ -40,11 +42,11 @@ class custom_parser : public basic_parser */ void on_request_impl( - verb method, // The method verb, verb::unknown if no match - string_view method_str, // The method as a string - string_view target, // The request-target - int version, // The HTTP-version - error_code& ec) override; // The error returned to the caller, if any + verb method, // The method verb, verb::unknown if no match + core::string_view method_str, // The method as a string + core::string_view target, // The request-target + int version, // The HTTP-version + error_code& ec) override; // The error returned to the caller, if any /** Called after receiving the status-line. @@ -66,10 +68,10 @@ class custom_parser : public basic_parser */ void on_response_impl( - int code, // The status-code - string_view reason, // The obsolete reason-phrase - int version, // The HTTP-version - error_code& ec) override; // The error returned to the caller, if any + int code, // The status-code + core::string_view reason, // The obsolete reason-phrase + int version, // The HTTP-version + error_code& ec) override; // The error returned to the caller, if any /** Called once for each complete field in the HTTP header. @@ -89,10 +91,10 @@ class custom_parser : public basic_parser */ void on_field_impl( - field f, // The known-field enumeration constant - string_view name, // The field name string. - string_view value, // The field value - error_code& ec) override; // The error returned to the caller, if any + field f, // The known-field enumeration constant + core::string_view name, // The field name string. + core::string_view value, // The field value + error_code& ec) override; // The error returned to the caller, if any /** Called once after the complete HTTP header is received. @@ -141,8 +143,8 @@ class custom_parser : public basic_parser */ std::size_t on_body_impl( - string_view s, // A portion of the body - error_code& ec) override; // The error returned to the caller, if any + core::string_view s, // A portion of the body + error_code& ec) override; // The error returned to the caller, if any /** Called each time a new chunk header of a chunk encoded body is received. @@ -159,10 +161,10 @@ class custom_parser : public basic_parser */ void on_chunk_header_impl( - std::uint64_t size, // The size of the upcoming chunk, - // or zero for the last chunk - string_view extension, // The chunk extensions (may be empty) - error_code& ec) override; // The error returned to the caller, if any + std::uint64_t size, // The size of the upcoming chunk, + // or zero for the last chunk + core::string_view extension, // The chunk extensions (may be empty) + error_code& ec) override; // The error returned to the caller, if any /** Called each time additional data is received representing part of a body chunk. @@ -188,11 +190,11 @@ class custom_parser : public basic_parser */ std::size_t on_chunk_body_impl( - std::uint64_t remain, // The number of bytes remaining in the chunk, - // including what is being passed here. - // or zero for the last chunk - string_view body, // The next piece of the chunk body - error_code& ec) override; // The error returned to the caller, if any + std::uint64_t remain, // The number of bytes remaining in the chunk, + // including what is being passed here. + // or zero for the last chunk + core::string_view body, // The next piece of the chunk body + error_code& ec) override; // The error returned to the caller, if any /** Called once when the complete message is received. @@ -216,8 +218,8 @@ class custom_parser : public basic_parser template void custom_parser:: -on_request_impl(verb method, string_view method_str, - string_view path, int version, error_code& ec) +on_request_impl(verb method, core::string_view method_str, + core::string_view path, int version, error_code& ec) { boost::ignore_unused(method, method_str, path, version); ec = {}; @@ -227,7 +229,7 @@ template void custom_parser:: on_response_impl( int status, - string_view reason, + core::string_view reason, int version, error_code& ec) { @@ -239,8 +241,8 @@ template void custom_parser:: on_field_impl( field f, - string_view name, - string_view value, + core::string_view name, + core::string_view value, error_code& ec) { boost::ignore_unused(f, name, value); @@ -266,7 +268,7 @@ on_body_init_impl( template std::size_t custom_parser:: -on_body_impl(string_view body, error_code& ec) +on_body_impl(core::string_view body, error_code& ec) { boost::ignore_unused(body); ec = {}; @@ -277,7 +279,7 @@ template void custom_parser:: on_chunk_header_impl( std::uint64_t size, - string_view extension, + core::string_view extension, error_code& ec) { boost::ignore_unused(size, extension); @@ -288,7 +290,7 @@ template std::size_t custom_parser:: on_chunk_body_impl( std::uint64_t remain, - string_view body, + core::string_view body, error_code& ec) { boost::ignore_unused(remain); diff --git a/test/doc/http_examples.cpp b/test/doc/http_examples.cpp index 6c99f34130..ce8736994f 100644 --- a/test/doc/http_examples.cpp +++ b/test/doc/http_examples.cpp @@ -32,6 +32,8 @@ namespace boost { namespace beast { namespace http { +namespace core = boost::core; // + class examples_test : public beast::unit_test::suite , public beast::test::enable_yield_to @@ -55,7 +57,7 @@ class examples_test template bool - equal_body(string_view sv, string_view body) + equal_body(core::string_view sv, core::string_view body) { test::stream ts{ioc_, sv}; message m; @@ -271,7 +273,7 @@ class examples_test doExplicitChunkSerialize() { auto const buf = - [](string_view s) + [](core::string_view s) { return net::const_buffer{ s.data(), s.size()}; diff --git a/test/doc/http_snippets.cpp b/test/doc/http_snippets.cpp index 52dfe9ee85..e10bc84b95 100644 --- a/test/doc/http_snippets.cpp +++ b/test/doc/http_snippets.cpp @@ -14,6 +14,7 @@ #include using namespace boost::beast; +namespace core = boost::core; // //[http_snippet_1 @@ -251,7 +252,7 @@ void fxx() { //[http_snippet_23 // Manually emit a trailer. // We are responsible for ensuring that the trailer format adheres to the specification. - string_view ext = + core::string_view ext = "Content-Digest: f4a5c16584f03d90\r\n" "\r\n"; net::write(sock, make_chunk_last(net::const_buffer{ext.data(), ext.size()})); diff --git a/test/doc/websocket_2_handshaking.cpp b/test/doc/websocket_2_handshaking.cpp index 6dff929dcb..61569a0b89 100644 --- a/test/doc/websocket_2_handshaking.cpp +++ b/test/doc/websocket_2_handshaking.cpp @@ -20,6 +20,8 @@ #include #include +namespace core = boost::core; // + namespace { #include "websocket_common.ipp" @@ -136,14 +138,14 @@ snippets() //[code_websocket_2_6 // a function to select the most preferred protocol from a comma-separated list - auto select_protocol = [](string_view offered_tokens) -> std::string + auto select_protocol = [](core::string_view offered_tokens) -> std::string { // tokenize the Sec-Websocket-Protocol header offered by the client http::token_list offered( offered_tokens ); // an array of protocols supported by this server // in descending order of preference - static const std::array + static const std::array supported = {{ "v3.my.chat", "v2.my.chat", diff --git a/test/doc/websocket_5_control_frames.cpp b/test/doc/websocket_5_control_frames.cpp index dee0643316..560c05a61d 100644 --- a/test/doc/websocket_5_control_frames.cpp +++ b/test/doc/websocket_5_control_frames.cpp @@ -20,6 +20,8 @@ #include #include +namespace core = boost::core; // + namespace { #include "websocket_common.ipp" @@ -33,7 +35,7 @@ snippets() //[code_websocket_5_1 ws.control_callback( - [](frame_type kind, string_view payload) + [](frame_type kind, core::string_view payload) { // Do something with the payload boost::ignore_unused(kind, payload); diff --git a/test/extras/include/boost/beast/test/fuzz.hpp b/test/extras/include/boost/beast/test/fuzz.hpp index 5491b2e284..f127d8234b 100644 --- a/test/extras/include/boost/beast/test/fuzz.hpp +++ b/test/extras/include/boost/beast/test/fuzz.hpp @@ -92,7 +92,7 @@ fuzz( break; } } - f(string_view{mod.data(), mod.size()}); + f(core::string_view{mod.data(), mod.size()}); if(depth > 0) fuzz(mod, repeat, depth - 1, r, f); } diff --git a/test/fuzz/http_response.cpp b/test/fuzz/http_response.cpp index 5a10fb8bbd..bdc029af07 100644 --- a/test/fuzz/http_response.cpp +++ b/test/fuzz/http_response.cpp @@ -21,7 +21,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) http::chunk_extensions ce; http::response_parser parser; - auto chunk_header_cb = [&ce](std::uint64_t, string_view extensions, error_code& ev) + auto chunk_header_cb = [&ce](std::uint64_t, core::string_view extensions, error_code& ev) { ce.parse(extensions, ev); }; diff --git a/test/fuzz/websocket_server.cpp b/test/fuzz/websocket_server.cpp index 996c6391c8..ab83da5e0e 100644 --- a/test/fuzz/websocket_server.cpp +++ b/test/fuzz/websocket_server.cpp @@ -18,7 +18,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) test::stream remote{ioc}; websocket::stream ws{ - ioc, string_view{reinterpret_cast(data), size}}; + ioc, core::string_view{reinterpret_cast(data), size}}; ws.set_option(websocket::stream_base::decorator( [](websocket::response_type& res)