Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members  

cookie.hh

00001 /*
00002 *  Name:         cookie.hh
00003 *  Author:       Francisco Rodrigo Escobedo Robles
00004 *  Contributor:  Rafael Jesus Alcantara Perez
00005 *  Summary:      HTTP Cookie handling
00006 *  Date:         $Date: 2003/04/14 00:18:31 $
00007 *  Revision:     $Revision: 1.1 $
00008 *
00009 *  Copyright (C) 2000-2001  Francisco Rodrigo Escobedo Robles <frer@pepix.net>
00010 *  Copyright (C) 2001-2002  Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com>
00011 *
00012 *  This program is free software; you can redistribute it and/or modify
00013 *  it under the terms of the GNU General Public License as published by
00014 *  the Free Software Foundation; either version 2 of the License, or
00015 *  (at your option) any later version.
00016 *
00017 *  This program is distributed in the hope that it will be useful,
00018 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 *  GNU General Public License for more details.
00021 *
00022 *  You should have received a copy of the GNU General Public License
00023 *  along with this program; if not, write to the Free Software
00024 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00025 *  MA 02111-1307, USA.
00026 */
00027 
00028 #ifndef _MPCL_NET_CGI_COOKIE__
00029 #define _MPCL_NET_CGI_COOKIE__
00030 
00031 #include "../../io/streamable.hh"
00032 #include "../../text/gmt_date.hh"
00033 #include "../../text/string.hh"
00034 
00035 
00037 namespace mpcl
00038 {
00039 
00041   namespace net
00042   {
00043 
00045     namespace cgi
00046     {
00047 
00048       using io::IStreamable;
00049       using text::IDate;
00050       using text::TGmtDate;
00051       using text::TString;
00052 
00057       class TCookie : public IStreamable<>
00058       {
00059 
00060         private:
00061 
00063           bool   gSecure;
00064 
00066           TGmtDate   tExpires;
00067 
00069           TString    yDomain;
00070 
00072           TString    yName;
00073 
00075           TString    yPath;
00076 
00078           TString    yValue;
00079 
00080 
00081         public:
00082 
00083           //
00084           //  C O N S T R U C T O R S
00085           //
00086 
00091           TCookie (const TCookie& rktCGI_COOKIE)   :
00092             IStreamable<> ()                       ,
00093             gSecure       (rktCGI_COOKIE.gSecure)  ,
00094             tExpires      (rktCGI_COOKIE.tExpires) ,
00095             yDomain       (rktCGI_COOKIE.yDomain)  ,
00096             yName         (rktCGI_COOKIE.yName)    ,
00097             yPath         (rktCGI_COOKIE.yPath)    ,
00098             yValue        (rktCGI_COOKIE.yValue)   {}
00099 
00109           TCookie ( const TString&  rkyNAME                               ,
00110                     const TString&  rkyVALUE                              ,
00111                     const TGmtDate& rktEXPIRES = TGmtDate (IDate::eEmpty) ,
00112                     const TString&  rkyPATH    = ""                       ,
00113                     const TString&  rkyDOMAIN  = ""                       ,
00114                     const bool      kgSECURE   = false                    ) :
00115             IStreamable<> ()                                                ,
00116             gSecure       (kgSECURE)                                        ,
00117             tExpires      (rktEXPIRES)                                      ,
00118             yDomain       (rkyDOMAIN)                                       ,
00119             yName         (rkyNAME)                                         ,
00120             yPath         (rkyPATH)                                         ,
00121             yValue        (rkyVALUE)                                        {}
00122 
00127           TCookie (std::basic_istream<char_type, traits_type>& rtSOURCE_ISTREAM) :
00128             IStreamable<> ()                                                     ,
00129             gSecure       (false)                                                ,
00130             tExpires      (TGmtDate (IDate::eEmpty))                             ,
00131             yDomain       ()                                                     ,
00132             yName         ()                                                     ,
00133             yPath         ()                                                     ,
00134             yValue        ()
00135           {
00136             read (rtSOURCE_ISTREAM);
00137           }
00138 
00139 
00140         protected:
00141 
00142           //
00143           //  S E L E C T O R S
00144           //
00145 
00150           void read (std::basic_istream<char_type, traits_type>& rtSOURCE_ISTREAM);
00151 
00156           void write (std::basic_ostream<char_type, traits_type>& rtTARGET_OSTREAM) const;
00157 
00158 
00159         public:
00160 
00161           //
00162           //  S E L E C T O R S
00163           //
00164 
00166           TString name (void) const
00167           {
00168             return yName;
00169           }
00170 
00172           TString value (void) const
00173           {
00174             return yValue;
00175           }
00176 
00182           bool operator == (const TCookie& rktCOOKIE) const
00183           {
00184             return ( ( yName == rktCOOKIE.yName ) && ( yValue == rktCOOKIE.yValue ) );
00185           }
00186 
00187       };  // class TCookie
00188 
00189     }  // namespace cgi
00190 
00191   }  // namespace net
00192 
00193 }  // namespace mpcl
00194 
00195 
00196 #endif  // not _MPCL_NET_CGI_COOKIE__

Generated on Mon Oct 13 02:35:22 2003 for MPCL by doxygen1.2.18