Logo
~Sockets~
~Examples~
~Contact~


HttpdCookies.h

Go to the documentation of this file.
00001 
00003 /*
00004 Copyright (C) 2003-2007  Anders Hedstrom
00005 
00006 This library is made available under the terms of the GNU GPL.
00007 
00008 If you would like to use this library in a closed-source application,
00009 a separate license agreement is available. For information about 
00010 the closed-source license agreement for the C++ sockets library,
00011 please visit http://www.alhem.net/Sockets/license.html and/or
00012 email license@alhem.net.
00013 
00014 This program is free software; you can redistribute it and/or
00015 modify it under the terms of the GNU General Public License
00016 as published by the Free Software Foundation; either version 2
00017 of the License, or (at your option) any later version.
00018 
00019 This program is distributed in the hope that it will be useful,
00020 but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License
00025 along with this program; if not, write to the Free Software
00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 */
00028 
00029 #ifndef _SOCKETS_HttpdCookies_H
00030 #define _SOCKETS_HttpdCookies_H
00031 
00032 #include "sockets-config.h"
00033 #include <list>
00034 #include <string>
00035 
00036 #ifdef SOCKETS_NAMESPACE
00037 namespace SOCKETS_NAMESPACE {
00038 #endif
00039 
00040 
00042 
00043 
00044 
00046 class HTTPSocket;
00047 
00052 class HttpdCookies 
00053 {
00056         struct COOKIE
00057         {
00058                 COOKIE(const std::string& n,const std::string& v) : name(n),value(v) {}
00059                 std::string name;
00060                 std::string value;
00061         };
00063         typedef std::list<COOKIE *> cookie_v;
00064 public:
00065         HttpdCookies();
00066         HttpdCookies(const std::string& query_string);
00067         ~HttpdCookies();
00068 
00069         bool getvalue(const std::string&,std::string&) const;
00070         void replacevalue(const std::string& ,const std::string& );
00071         void replacevalue(const std::string& ,long);
00072         void replacevalue(const std::string& ,int);
00073         size_t getlength(const std::string& ) const;
00074         void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,const std::string& v);
00075         void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,long v);
00076         void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,int v);
00077         const std::string& expiredatetime() const;
00078 
00079         cookie_v& GetHttpdCookies() { return m_cookies; }
00080 
00081 private:
00082         cookie_v m_cookies;
00083         mutable std::string m_date;
00084 };
00085 
00086 
00087 #ifdef SOCKETS_NAMESPACE
00088 }
00089 #endif
00090 
00091 #endif // _SOCKETS_HttpdCookies_H
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4