Http_Cookies.h

Go to the documentation of this file.
00001 // ZenLib::Format::Http::Cookies - Cookies handling
00002 // Copyright (C) 2008-2011 MediaArea.net SARL, Info@MediaArea.net
00003 //
00004 // This software is provided 'as-is', without any express or implied
00005 // warranty.  In no event will the authors be held liable for any damages
00006 // arising from the use of this software.
00007 //
00008 // Permission is granted to anyone to use this software for any purpose,
00009 // including commercial applications, and to alter it and redistribute it
00010 // freely, subject to the following restrictions:
00011 //
00012 // 1. The origin of this software must not be misrepresented; you must not
00013 //    claim that you wrote the original software. If you use this software
00014 //    in a product, an acknowledgment in the product documentation would be
00015 //    appreciated but is not required.
00016 // 2. Altered source versions must be plainly marked as such, and must not be
00017 //    misrepresented as being the original software.
00018 // 3. This notice may not be removed or altered from any source distribution.
00019 //
00020 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00021 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00022 //
00023 // Cookies handling
00024 //
00025 //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00026 
00027 //---------------------------------------------------------------------------
00028 #ifndef ZenLib_Format_Http_CookiesH
00029 #define ZenLib_Format_Http_CookiesH
00030 //---------------------------------------------------------------------------
00031 
00032 //---------------------------------------------------------------------------
00033 #include <string>
00034 #include <ctime>
00035 #include <map>
00036 #include <sstream>
00037 //---------------------------------------------------------------------------
00038 
00039 namespace ZenLib
00040 {
00041 
00042 namespace Format
00043 {
00044 
00045 namespace Http
00046 {
00047 
00048 //***************************************************************************
00049 /// @brief 
00050 //***************************************************************************
00051 
00052 struct Cookie
00053 {
00054     std::string Value;
00055     std::time_t Expires;
00056     std::string Path;
00057     std::string Domain;
00058     bool Secure;
00059 
00060     Cookie()
00061     {
00062         Expires=0;
00063         Secure=false;
00064     }
00065 };
00066  
00067 extern std::string EmptyString; //Must not change
00068 
00069 class Cookies : public std::map<std::string, Cookie>
00070 {
00071 public :
00072     //Constructor/Destructor
00073     Cookies();
00074 
00075     //Helpers
00076     size_t Set(const std::string &Name, const std::string &Value=EmptyString, std::time_t Expires=(std::time_t)-1, const std::string &Path=EmptyString, const std::string &Domain=EmptyString, bool Secure=false);
00077     Cookie &Get(const std::string &Name);
00078     void Create_Lines(std::ostream& Out);
00079 };
00080 
00081 } //Namespace
00082 
00083 } //Namespace
00084 
00085 } //Namespace
00086 
00087 #endif
00088 
00089 
00090 
00091 

Generated on Sun Apr 8 21:22:59 2012 for ZenLib by  doxygen 1.4.7