mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-14 12:05:58 +08:00
优化代码
空构造和析构函数替换为缺省 去除多余分号
This commit is contained in:
@@ -189,7 +189,7 @@ public:
|
||||
_data = map_addr.get() + offset;
|
||||
_size = size;
|
||||
}
|
||||
~BufferMmap() override {};
|
||||
~BufferMmap() override = default;
|
||||
//返回数据长度
|
||||
char *data() const override { return _data; }
|
||||
size_t size() const override { return _size; }
|
||||
|
||||
@@ -30,9 +30,9 @@ namespace mediakit {
|
||||
class HttpBody : public std::enable_shared_from_this<HttpBody>{
|
||||
public:
|
||||
using Ptr = std::shared_ptr<HttpBody>;
|
||||
HttpBody(){}
|
||||
HttpBody() = default;
|
||||
|
||||
virtual ~HttpBody(){}
|
||||
virtual ~HttpBody() = default;
|
||||
|
||||
/**
|
||||
* 剩余数据大小,如果返回-1, 那么就不设置content-length
|
||||
@@ -151,7 +151,7 @@ public:
|
||||
* @param boundary boundary字符串
|
||||
*/
|
||||
HttpMultiFormBody(const HttpArgs &args,const std::string &filePath,const std::string &boundary = "0xKhTmLbOuNdArY");
|
||||
virtual ~HttpMultiFormBody(){}
|
||||
virtual ~HttpMultiFormBody() = default;
|
||||
int64_t remainSize() override ;
|
||||
toolkit::Buffer::Ptr readData(size_t size) override;
|
||||
|
||||
|
||||
@@ -27,8 +27,8 @@ class HttpCookie {
|
||||
public:
|
||||
using Ptr = std::shared_ptr<HttpCookie>;
|
||||
friend class HttpCookieStorage;
|
||||
HttpCookie(){}
|
||||
~HttpCookie(){}
|
||||
HttpCookie() = default;
|
||||
~HttpCookie() = default;
|
||||
|
||||
void setPath(const std::string &path);
|
||||
void setHost(const std::string &host);
|
||||
@@ -52,12 +52,14 @@ private:
|
||||
*/
|
||||
class HttpCookieStorage{
|
||||
public:
|
||||
~HttpCookieStorage(){}
|
||||
~HttpCookieStorage() = default;
|
||||
static HttpCookieStorage &Instance();
|
||||
void set(const HttpCookie::Ptr &cookie);
|
||||
std::vector<HttpCookie::Ptr> get(const std::string &host,const std::string &path);
|
||||
|
||||
private:
|
||||
HttpCookieStorage(){};
|
||||
HttpCookieStorage() = default;
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string/*host*/, std::map<std::string/*cookie path*/,std::map<std::string/*cookie_key*/, HttpCookie::Ptr> > > _all_cookie;
|
||||
std::mutex _mtx_cookie;
|
||||
|
||||
@@ -24,8 +24,8 @@ public:
|
||||
typedef std::function<void(int code, const StrCaseMap &headerOut, const HttpBody::Ptr &body)> HttpResponseInvokerLambda0;
|
||||
typedef std::function<void(int code, const StrCaseMap &headerOut, const std::string &body)> HttpResponseInvokerLambda1;
|
||||
|
||||
HttpResponseInvokerImp(){}
|
||||
~HttpResponseInvokerImp(){}
|
||||
HttpResponseInvokerImp() = default;
|
||||
~HttpResponseInvokerImp() = default;
|
||||
template<typename C>
|
||||
HttpResponseInvokerImp(const C &c):HttpResponseInvokerImp(typename toolkit::function_traits<C>::stl_function_type(c)) {}
|
||||
HttpResponseInvokerImp(const HttpResponseInvokerLambda0 &lambda);
|
||||
|
||||
@@ -18,8 +18,8 @@ namespace mediakit {
|
||||
|
||||
class HttpRequestSplitter {
|
||||
public:
|
||||
HttpRequestSplitter(){};
|
||||
virtual ~HttpRequestSplitter(){};
|
||||
HttpRequestSplitter() = default;
|
||||
virtual ~HttpRequestSplitter() = default;
|
||||
|
||||
/**
|
||||
* 添加数据
|
||||
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
|
||||
template <typename... ArgsType>
|
||||
ClientTypeImp(ArgsType &&...args) : ClientType(std::forward<ArgsType>(args)...) {}
|
||||
~ClientTypeImp() override {};
|
||||
~ClientTypeImp() override = default;
|
||||
|
||||
protected:
|
||||
/**
|
||||
|
||||
@@ -82,7 +82,7 @@ template<typename Creator, typename HttpSessionType = mediakit::HttpSession, med
|
||||
class WebSocketSessionBase : public HttpSessionType {
|
||||
public:
|
||||
WebSocketSessionBase(const toolkit::Socket::Ptr &pSock) : HttpSessionType(pSock){}
|
||||
virtual ~WebSocketSessionBase(){}
|
||||
virtual ~WebSocketSessionBase() = default;
|
||||
|
||||
//收到eof或其他导致脱离TcpServer事件的回调
|
||||
void onError(const toolkit::SockException &err) override{
|
||||
@@ -248,7 +248,7 @@ template<typename SessionType,typename HttpSessionType = mediakit::HttpSession,
|
||||
class WebSocketSession : public WebSocketSessionBase<SessionCreator<SessionType>,HttpSessionType,DataType>{
|
||||
public:
|
||||
WebSocketSession(const toolkit::Socket::Ptr &pSock) : WebSocketSessionBase<SessionCreator<SessionType>,HttpSessionType,DataType>(pSock){}
|
||||
virtual ~WebSocketSession(){}
|
||||
virtual ~WebSocketSession() = default;
|
||||
};
|
||||
|
||||
#endif //ZLMEDIAKIT_WEBSOCKETSESSION_H
|
||||
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
//根据内存地址设置掩码随机数
|
||||
_mask.assign((uint8_t*)(&ptr), (uint8_t*)(&ptr) + 4);
|
||||
}
|
||||
virtual ~WebSocketHeader(){}
|
||||
virtual ~WebSocketHeader() = default;
|
||||
|
||||
public:
|
||||
bool _fin;
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
WebSocketBuffer(WebSocketHeader::Type headType, bool fin, ARGS &&...args)
|
||||
: toolkit::BufferString(std::forward<ARGS>(args)...), _fin(fin), _head_type(headType){}
|
||||
|
||||
~WebSocketBuffer() override {}
|
||||
~WebSocketBuffer() override = default;
|
||||
|
||||
WebSocketHeader::Type headType() const { return _head_type; }
|
||||
|
||||
@@ -84,8 +84,8 @@ private:
|
||||
|
||||
class WebSocketSplitter : public WebSocketHeader{
|
||||
public:
|
||||
WebSocketSplitter(){}
|
||||
virtual ~WebSocketSplitter(){}
|
||||
WebSocketSplitter() = default;
|
||||
virtual ~WebSocketSplitter() = default;
|
||||
|
||||
/**
|
||||
* 输入数据以便解包webSocket数据以及处理粘包问题
|
||||
|
||||
Reference in New Issue
Block a user