|
From: Christian P. <cp...@us...> - 2005-01-14 14:57:03
|
Update of /cvsroot/pclasses/pclasses2/include/pclasses/Net In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21416/include/pclasses/Net Modified Files: HTTPHeader.h Log Message: Use PropertyMap as base-class for Headers. Index: HTTPHeader.h =================================================================== RCS file: /cvsroot/pclasses/pclasses2/include/pclasses/Net/HTTPHeader.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- HTTPHeader.h 7 Jan 2005 13:41:23 -0000 1.1 +++ HTTPHeader.h 14 Jan 2005 14:56:50 -0000 1.2 @@ -21,8 +21,8 @@ #ifndef P_Net_HTTPHeader_h #define P_Net_HTTPHeader_h +#include <pclasses/PropertyMap.h> #include <string> -#include <map> namespace P { @@ -32,24 +32,11 @@ /*! The base class for a HTTP-Request or -Response. */ -class HTTPHeader { +class HTTPHeader: public PropertyMap<std::string, std::string> { public: - typedef std::map<std::string, std::string> FieldMap; - typedef FieldMap::iterator iterator; - typedef FieldMap::const_iterator const_iterator; - HTTPHeader(); ~HTTPHeader(); - void set(const std::string& head, const std::string& val); - const std::string& get(const std::string& head) const; - - bool remove(const std::string& head); - bool contains(const std::string& head) const; - - iterator find(const std::string& head); - const_iterator find(const std::string& head) const; - inline void setCacheControl(const std::string& val) { set("Cache-Control", val); } @@ -83,22 +70,6 @@ inline void setWarning(const std::string& val) { set("Warning", val); } - const std::string& operator[](const std::string& head) const; - - inline const_iterator begin() const - { return _values.begin(); } - - inline const_iterator end() const - { return _values.end(); } - - inline iterator begin() - { return _values.begin(); } - - inline iterator end() - { return _values.end(); } - - private: - FieldMap _values; }; //! HTTP Request-Header @@ -107,8 +78,8 @@ */ class HTTPRequestHeader: public HTTPHeader { public: - HTTPRequestHeader() {} - ~HTTPRequestHeader() {} + HTTPRequestHeader(); + ~HTTPRequestHeader(); inline void setAccept(const std::string& val) { set("Accept", val); } @@ -174,8 +145,8 @@ */ class HTTPResponseHeader: public HTTPHeader { public: - HTTPResponseHeader() {} - ~HTTPResponseHeader() {} + HTTPResponseHeader(); + ~HTTPResponseHeader(); inline void setAcceptRanges(const std::string& val) { set("Accept-Ranges", val); } |