Jelajahi Sumber

move some code from header file to source file

ithewei 2 tahun lalu
induk
melakukan
09fd9ccd57
2 mengubah file dengan 25 tambahan dan 20 penghapusan
  1. 22 0
      http/HttpMessage.cpp
  2. 3 20
      http/HttpMessage.h

+ 22 - 0
http/HttpMessage.cpp

@@ -13,6 +13,28 @@ http_body    NoBody;
 HttpCookie   NoCookie;
 char HttpMessage::s_date[32] = {0};
 
+HttpCookie::HttpCookie() {
+    init();
+}
+
+void HttpCookie::init()  {
+    max_age = 0;
+    secure = false;
+    httponly = false;
+    samesite = Default;
+    priority = NotSet;
+}
+
+void HttpCookie::reset() {
+    init();
+    name.clear();
+    value.clear();
+    domain.clear();
+    path.clear();
+    expires.clear();
+    kv.clear();
+}
+
 bool HttpCookie::parse(const std::string& str) {
     std::stringstream ss;
     ss << str;

+ 3 - 20
http/HttpMessage.h

@@ -84,27 +84,10 @@ struct HV_EXPORT HttpCookie {
     } priority;
     hv::KeyValue kv; // for multiple names
 
-    HttpCookie() {
-        init();
-    }
-
-    void init()  {
-        max_age = 0;
-        secure = false;
-        httponly = false;
-        samesite = Default;
-        priority = NotSet;
-    }
+    HttpCookie();
 
-    void reset() {
-        init();
-        name.clear();
-        value.clear();
-        domain.clear();
-        path.clear();
-        expires.clear();
-        kv.clear();
-    }
+    void init();
+    void reset();
 
     bool parse(const std::string& str);
     std::string dump() const;