#ifndef __KINGATE_HEADERS_H #define __KINGATE_HEADERS_H #include #include #include /** * @file * @brief the headers -- HTTP headers container class. */ namespace kingate { using namespace std; /** * The container class for HTTP headers. */ class headers : public multimap { public: /** * Reference header if one exists. * @param k the header. * @return reference to the content. */ const mapped_type& operator[](const key_type& k) const { return get_header(k); } /** * Reference header, creating one if needed. * @param k the header. * @return reference to the content. */ mapped_type& operator[](const key_type& k) { return get_header(k); } /** * Set HTTP header. Remove all existent occurences of headers with * this name. * @param h header name. * @param c header content. */ void set_header(const key_type& h,const mapped_type& c); /** * Add HTTP header. * @param h header name. * @param c header content. */ void add_header(const key_type& h,const mapped_type& c); /** * Remove named header. * @param h header name. */ void unset_header(const key_type& h); /** * Return const reference to the existing header. * @param h header name. * @return reference to header content. */ const mapped_type& get_header(const key_type& h) const; /** * Return reference to the header, creating one if needed. * @param h header name. * @return reference to the content. */ mapped_type& get_header(const key_type& h); /** * Return the range of headers with a certain name. * @param h header name. * @return pair of const iterators with the beginning and the end * of range. */ pair get_headers(const key_type& h) const; /** * Return the range of headers with a certain name. * @param h header name. * @return pair of iterators with the beginning and the end * of range. */ pair get_headers(const key_type& h); /** * Inquire whether the named header exists. * @param h header name. * @return true if exists. */ bool has_header(const key_type& h) const; }; } #endif /* __KINGATE_HEADERS_H */