1
1
#include < cassert>
2
2
#include < array>
3
3
4
- #include < boost/utility/string_view .hpp>
4
+ #include < boost/utility/string_ref .hpp>
5
5
#include " restc-cpp/restc-cpp.h"
6
6
#include " restc-cpp/Url.h"
7
7
#include " restc-cpp/error.h"
@@ -28,18 +28,18 @@ Url& Url::operator = (const char *url) {
28
28
constexpr auto magic_7 = 7 ;
29
29
30
30
assert (url != nullptr && " A valid URL is required" );
31
- protocol_name_ = boost::string_view (url);
31
+ protocol_name_ = boost::string_ref (url);
32
32
if (protocol_name_.find (" https://" ) == 0 ) {
33
- protocol_name_ = boost::string_view (url, magic_8);
33
+ protocol_name_ = boost::string_ref (url, magic_8);
34
34
protocol_ = Protocol::HTTPS;
35
35
} else if (protocol_name_.find (" http://" ) == 0 ) {
36
- protocol_name_ = boost::string_view (url, magic_7);
36
+ protocol_name_ = boost::string_ref (url, magic_7);
37
37
protocol_ = Protocol::HTTP;
38
38
} else {
39
39
throw ParseException (" Invalid protocol in url. Must be 'http[s]://'" );
40
40
}
41
41
42
- auto remains = boost::string_view (protocol_name_.end ());
42
+ auto remains = boost::string_ref (protocol_name_.end ());
43
43
const auto args_start = remains.find (' ?' );
44
44
if (args_start != string::npos) {
45
45
args_ = {remains.begin () + args_start + 1 ,
@@ -55,8 +55,8 @@ Url& Url::operator = (const char *url) {
55
55
if (remains.length () <= static_cast <decltype (host_.length ())>(port_start + 2 )) {
56
56
throw ParseException (" Invalid host (no port after column)" );
57
57
}
58
- // port_ = boost::string_view (&remains[port_start+1]);
59
- // host_ = boost::string_view (host_.data(), port_start);
58
+ // port_ = boost::string_ref (&remains[port_start+1]);
59
+ // host_ = boost::string_ref (host_.data(), port_start);
60
60
host_ = {remains.begin (), port_start};
61
61
remains = {remains.begin () + port_start + 1 , remains.size () - (port_start + 1 )};
62
62
0 commit comments