delete copy constructor and operator assign for most classes

master
Chunting Gu 4 years ago
parent b76ce67726
commit 751a3539ae

@ -44,6 +44,9 @@ public:
public:
ClientPool() = default;
ClientPool(const ClientPool&) = delete;
ClientPool& operator=(const ClientPool&) = delete;
~ClientPool();
ClientPtr Get(const Key& key) const;

@ -22,6 +22,9 @@ class ClientSession {
public:
explicit ClientSession(std::size_t buffer_size = 0);
ClientSession(const ClientSession&) = delete;
ClientSession& operator=(const ClientSession&) = delete;
~ClientSession();
// Start Asio loop in a thread.

@ -170,7 +170,7 @@ public:
public:
explicit Error(Code code = kOK, const std::string& message = "")
: code_(code), message_(message), timeout_(false) {
: code_(code), message_(message) {
}
// Note that `noexcept` is required by GCC.
@ -206,7 +206,7 @@ public:
private:
Code code_;
std::string message_;
bool timeout_;
bool timeout_ = false;
};
std::ostream& operator<<(std::ostream& os, const Error& error);

@ -16,6 +16,9 @@ class Message {
public:
Message();
Message(const Message&) = delete;
Message& operator=(const Message&) = delete;
virtual ~Message() = default;
// ---------------------------------------------------------------------------

@ -19,6 +19,9 @@ public:
explicit BodyHandler(Message* message) : message_(message) {
}
BodyHandler(const BodyHandler&) = delete;
BodyHandler& operator=(const BodyHandler&) = delete;
virtual ~BodyHandler() = default;
virtual void AddContent(const char* data, std::size_t count) = 0;

@ -29,6 +29,11 @@ public:
using ReadHandler =
std::function<void(boost::system::error_code, std::size_t)>;
SocketBase() = default;
SocketBase(const SocketBase&) = delete;
SocketBase& operator=(const SocketBase&) = delete;
virtual ~SocketBase() = default;
virtual void AsyncConnect(const std::string& host, const Endpoints& endpoints,

@ -27,9 +27,6 @@ public:
explicit Url(const std::string& str, bool encode = false);
Url(Url&&) = default;
Url& operator=(Url&&) = default;
const std::string& scheme() const {
return scheme_;
}
@ -134,7 +131,7 @@ public:
std::regex operator()() const {
std::regex::flag_type flags = std::regex::ECMAScript | std::regex::icase;
return std::regex(url_, flags);
return std::regex{ url_, flags };
}
private:

@ -10,8 +10,13 @@ namespace webcc {
class View {
public:
View() = default;
virtual ~View() = default;
View(const View&) = delete;
View& operator=(const View&) = delete;
virtual ResponsePtr Handle(RequestPtr request) = 0;
// Return true if you want the request data of the given method to be streamed

Loading…
Cancel
Save