Skip to content

Commit 1e57b61

Browse files
committed
string_view reverted to string_ref (req for boost 1.58)
1 parent 6efc0e1 commit 1e57b61

File tree

4 files changed

+21
-21
lines changed

4 files changed

+21
-21
lines changed

include/restc-cpp/Url.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#ifndef RESTC_CPP_URL_H_
44
#define RESTC_CPP_URL_H_
55

6-
#include <boost/utility/string_view.hpp>
6+
#include <boost/utility/string_ref.hpp>
77

88
namespace restc_cpp {
99

@@ -20,19 +20,19 @@ namespace restc_cpp {
2020

2121
Url& operator = (const char *url);
2222

23-
boost::string_view GetProtocolName() const { return protocol_name_; }
24-
boost::string_view GetHost() const { return host_; }
25-
boost::string_view GetPort() const { return port_; }
26-
boost::string_view GetPath() const { return path_; }
27-
boost::string_view GetArgs() const { return args_; }
23+
boost::string_ref GetProtocolName() const { return protocol_name_; }
24+
boost::string_ref GetHost() const { return host_; }
25+
boost::string_ref GetPort() const { return port_; }
26+
boost::string_ref GetPath() const { return path_; }
27+
boost::string_ref GetArgs() const { return args_; }
2828
Protocol GetProtocol() const { return protocol_; }
2929

3030
private:
31-
boost::string_view protocol_name_;
32-
boost::string_view host_;
33-
boost::string_view port_;
34-
boost::string_view path_ = "/";
35-
boost::string_view args_;
31+
boost::string_ref protocol_name_;
32+
boost::string_ref host_;
33+
boost::string_ref port_;
34+
boost::string_ref path_ = "/";
35+
boost::string_ref args_;
3636
Protocol protocol_ = Protocol::UNKNOWN;
3737
};
3838

include/restc-cpp/url_encode.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22

33
#include "restc-cpp.h"
44

5-
#include <boost/utility/string_view.hpp>
5+
#include <boost/utility/string_ref.hpp>
66

77
namespace restc_cpp {
88

9-
std::string url_encode(const boost::string_view& src);
9+
std::string url_encode(const boost::string_ref& src);
1010

1111
} // namespace
1212

src/Url.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include <cassert>
22
#include <array>
33

4-
#include <boost/utility/string_view.hpp>
4+
#include <boost/utility/string_ref.hpp>
55
#include "restc-cpp/restc-cpp.h"
66
#include "restc-cpp/Url.h"
77
#include "restc-cpp/error.h"
@@ -28,18 +28,18 @@ Url& Url::operator = (const char *url) {
2828
constexpr auto magic_7 = 7;
2929

3030
assert(url != nullptr && "A valid URL is required");
31-
protocol_name_ = boost::string_view(url);
31+
protocol_name_ = boost::string_ref(url);
3232
if (protocol_name_.find("https://") == 0) {
33-
protocol_name_ = boost::string_view(url, magic_8);
33+
protocol_name_ = boost::string_ref(url, magic_8);
3434
protocol_ = Protocol::HTTPS;
3535
} 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);
3737
protocol_ = Protocol::HTTP;
3838
} else {
3939
throw ParseException("Invalid protocol in url. Must be 'http[s]://'");
4040
}
4141

42-
auto remains = boost::string_view(protocol_name_.end());
42+
auto remains = boost::string_ref(protocol_name_.end());
4343
const auto args_start = remains.find('?');
4444
if (args_start != string::npos) {
4545
args_ = {remains.begin() + args_start + 1,
@@ -55,8 +55,8 @@ Url& Url::operator = (const char *url) {
5555
if (remains.length() <= static_cast<decltype(host_.length())>(port_start + 2)) {
5656
throw ParseException("Invalid host (no port after column)");
5757
}
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);
6060
host_ = {remains.begin(), port_start};
6161
remains = {remains.begin() + port_start + 1, remains.size() - (port_start + 1)};
6262

src/url_encode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ allchars_t get_normal_ch() {
3535

3636
} // anonymous namespace
3737

38-
std::string url_encode(const boost::string_view& src) {
38+
std::string url_encode(const boost::string_ref& src) {
3939
constexpr auto magic_4 = 4;
4040
constexpr auto magic_0x0f = 0x0f;
4141

0 commit comments

Comments
 (0)