OSDN Git Service

http_core.hpp: request_header, respose_headerをクラス外に
authorMyun2 <myun2@nwhite.info>
Tue, 14 Dec 2010 08:10:30 +0000 (17:10 +0900)
committerMyun2 <myun2@nwhite.info>
Tue, 14 Dec 2010 08:10:30 +0000 (17:10 +0900)
roast/include/roast/net/http_core.hpp

index 04468fd..7012f0d 100644 (file)
 
 namespace roast
 {
+       class http_request_header : public ::std::map<::std::string, ::std::string>
+       {
+       public:
+       };
+       
+       ///////////////////
+       
+       typedef ::std::map<::std::string, ::std::string> http_response_header;
+       
+       ///////////////////
+       
        template <typename _TelnetT = ::roast::telnet >
        class http_core_ : public _TelnetT
        {
        public:
-       
-               //////////////////////////////////////////////////////////////////////////////////////////////////////
+               typedef ::roast::http_request_header request_header;
+               typedef ::roast::http_response_header response_header;
 
-               //typedef ::std::map< ::std::string, ::std::string > _request_header_t, _request_header, request_header;
-               typedef class request_header : public ::std::map< ::std::string, ::std::string >
-               {
-               public:
-               }
-                _request_header_t, _request_header;
-               
-               //////////////////////////////////////////////////////////////////////////////////////////////////////
-               
-               typedef ::std::map< ::std::string, ::std::string > _response_header_t, _response_header, response_header;
-       
                class response
                {
                private:
@@ -44,7 +44,7 @@ namespace roast
                public:
                        const char* version;
                        int status_code;
-                       _response_header headers;
+                       response_header headers;
                        ::std::string body;
 
                public:
@@ -148,12 +148,12 @@ namespace roast
                        s += _CRLF;
                        return s;
                }
-               void request(const char* method, const char* path=NULL, _request_header *p_req_header=NULL)
+               void request(const char* method, const char* path=NULL, request_header *p_req_header=NULL)
                {
                        *this << make_request_line(method, path);
                        if ( p_req_header )
                        {
-                               _request_header::iterator it = p_req_header->begin();
+                               request_header::iterator it = p_req_header->begin();
                                for(; it != p_req_header->end(); it++){
                                        *this << it->first << ": " << it->second << _CRLF;
 
@@ -177,7 +177,7 @@ namespace roast
                        while( rs << *this );
                        return rs;
                }
-               response get(const char* path=NULL, _request_header *p_req_header=NULL)
+               response get(const char* path=NULL, request_header *p_req_header=NULL)
                {
                        //////////////////////////////////////////////////////////////////////
                        //      Path is considered to be URL if called by the default constructor. 
@@ -191,7 +191,7 @@ namespace roast
                        request("GET", path, p_req_header);
                        return get_response();
                }
-               response post(const char* path=NULL, _request_header *p_req_header=NULL)
+               response post(const char* path=NULL, request_header *p_req_header=NULL)
                {
                        //////////////////////////////////////////////////////////////////////
                        //      Path is considered to be URL if called by the default constructor.