diff options
author | George Hazan <ghazan@miranda.im> | 2018-04-17 15:56:52 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2018-04-17 15:56:52 +0300 |
commit | 3e05d92dcb5f6c2017bc462554901ba27816bdb4 (patch) | |
tree | 3276a7c3527006b74afc00c197ab48a3a43b1e9e /protocols | |
parent | e285d61d903c2616f5a7ea3026a1068ceb59b513 (diff) |
MNonCopyable - the common class to avoid declaring fake private constructors
Diffstat (limited to 'protocols')
-rw-r--r-- | protocols/FacebookRM/src/http_request.h | 12 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.cpp | 4 | ||||
-rw-r--r-- | protocols/IRCG/src/irclib.h | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/http_request.h | 12 | ||||
-rw-r--r-- | protocols/Steam/src/http_request.h | 12 |
5 files changed, 13 insertions, 31 deletions
diff --git a/protocols/FacebookRM/src/http_request.h b/protocols/FacebookRM/src/http_request.h index df79b87b68..f21e5be78c 100644 --- a/protocols/FacebookRM/src/http_request.h +++ b/protocols/FacebookRM/src/http_request.h @@ -18,15 +18,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _HTTP_REQUEST_H_ #define _HTTP_REQUEST_H_ -class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject +class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject, private MNonCopyable { - HttpRequest& operator=(const HttpRequest&); // to prevent copying; - va_list formatArgs; CMStringA url; protected: - class HttpRequestUrl + class HttpRequestUrl : private MNonCopyable { friend HttpRequest; @@ -45,8 +43,6 @@ protected: request.szUrl = request.url.GetBuffer(); } - HttpRequestUrl& operator=(const HttpRequestUrl&); // to prevent copying; - public: HttpRequestUrl& operator<<(const char *param); HttpRequestUrl& operator<<(const BOOL_PARAM ¶m); @@ -60,10 +56,8 @@ protected: } }; - class HttpRequestHeaders + class HttpRequestHeaders : private MNonCopyable { - HttpRequestHeaders& operator=(const HttpRequestHeaders&); // to prevent copying; - HttpRequest &request; void Add(LPCSTR szName) diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 5cd1451059..5ffb9c22f1 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -75,7 +75,7 @@ void CIrcMessage::Reset() parameters.destroy(); } -CIrcMessage& CIrcMessage::operator = (const CIrcMessage& m) +CIrcMessage& CIrcMessage::operator=(const CIrcMessage& m) { if (&m != this) { sCommand = m.sCommand; @@ -89,7 +89,7 @@ CIrcMessage& CIrcMessage::operator = (const CIrcMessage& m) return *this; } -CIrcMessage& CIrcMessage::operator = (const wchar_t* lpszCmdLine) +CIrcMessage& CIrcMessage::operator=(const wchar_t* lpszCmdLine) { Reset(); ParseIrcCommand(lpszCmdLine); diff --git a/protocols/IRCG/src/irclib.h b/protocols/IRCG/src/irclib.h index dcb6fccf00..7677956762 100644 --- a/protocols/IRCG/src/irclib.h +++ b/protocols/IRCG/src/irclib.h @@ -81,8 +81,8 @@ public : void Reset();
- CIrcMessage& operator = (const CIrcMessage& m);
- CIrcMessage& operator = (const wchar_t* lpszCmdLine);
+ CIrcMessage& operator=(const CIrcMessage& m);
+ CIrcMessage& operator=(const wchar_t* lpszCmdLine);
private :
void ParseIrcCommand(const wchar_t* lpszCmdLine);
diff --git a/protocols/SkypeWeb/src/http_request.h b/protocols/SkypeWeb/src/http_request.h index 65bafa00fd..7b67fe44c6 100644 --- a/protocols/SkypeWeb/src/http_request.h +++ b/protocols/SkypeWeb/src/http_request.h @@ -58,17 +58,15 @@ struct FORMAT_VALUE : public VALUE }
};
-class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject
+class HttpRequest : public NETLIBHTTPREQUEST, public MZeroedObject, private MNonCopyable
{
- HttpRequest& operator=(const HttpRequest&); // to prevent copying;
-
va_list formatArgs;
CMStringA url;
protected:
enum HttpRequestUrlFormat { FORMAT };
- class HttpRequestUrl
+ class HttpRequestUrl : private MNonCopyable
{
friend HttpRequest;
@@ -87,8 +85,6 @@ protected: request.szUrl = request.url.GetBuffer();
}
- HttpRequestUrl& operator=(const HttpRequestUrl&); // to prevent copying;
-
public:
HttpRequestUrl &operator<<(const VALUE ¶m)
{
@@ -120,10 +116,8 @@ protected: }
};
- class HttpRequestHeaders
+ class HttpRequestHeaders : private MNonCopyable
{
- HttpRequestHeaders& operator=(const HttpRequestHeaders&); // to prevent copying;
-
HttpRequest &request;
void Add(LPCSTR szName)
diff --git a/protocols/Steam/src/http_request.h b/protocols/Steam/src/http_request.h index 64849f2983..3d87defe43 100644 --- a/protocols/Steam/src/http_request.h +++ b/protocols/Steam/src/http_request.h @@ -4,7 +4,7 @@ class HttpRequest; class HttpResponse; -class HttpUri +class HttpUri : private MNonCopyable { friend class HttpRequest; @@ -53,8 +53,6 @@ private: } public: - HttpUri& operator=(const HttpUri&); // to prevent copying; - operator const char*() const { return m_request @@ -87,7 +85,7 @@ public: } }; -class HttpHeaders +class HttpHeaders : private MNonCopyable { friend class HttpContent; friend class HttpRequest; @@ -119,8 +117,6 @@ private: } public: - HttpHeaders& operator=(const HttpHeaders&); // to prevent copying; - const NETLIBHTTPHEADER* operator[](size_t idx) const { return m_request @@ -158,7 +154,7 @@ public: } }; -class HttpContent +class HttpContent : private MNonCopyable { friend class HttpRequest; friend class HttpResponse; @@ -182,8 +178,6 @@ protected: } public: - HttpContent& operator=(const HttpContent&); // to prevent copying; - operator bool() const { return m_request && m_request->pData && m_request->dataLength; |