Google
Web alhem.net

Web.h

Go to the documentation of this file.
00001 // Web.h
00002 /*
00003 Copyright (C) 2003  Anders Hedstrom
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 */
00019 
00020 #ifndef _WEB_H
00021 #define _WEB_H
00022 
00023 #ifdef _WIN32
00024 #define STL_USING_STRING
00025 #define STL_USING_LIST
00026 #include <stlhelper.h>
00027 #else
00028 #include <string>
00029 #include <list>
00030 #endif
00031 
00032 
00033 namespace Cgi {
00034 
00035 class Form;
00036 class Cookies;
00037 class WebForm;
00038 
00040 
00041 class Web 
00042 {
00043 public:
00044         Web();
00049         Web(const std::string &cd,const std::string &cp,const std::string& id = "");
00054         Web(int argc,char *argv[],const std::string &cd,const std::string &cp,const std::string& id = "");
00055         virtual ~Web();
00056 
00058         void Init(const std::string& id);
00059 
00060         void SetCookieDomain(const std::string &);
00061         void SetCookiePath(const std::string &);
00062         void SetCookie(const std::string &name,const std::string &value);
00063         void SetCookie(const std::string &name,long value);
00064         void SetCookie(const std::string &name,int value);
00065         void Execute();
00066         void SetCgiName(const std::string &);
00067         std::string GetCgiName();
00068         Form *GetForm();
00069         Cookies *GetCookies();
00070 
00071         void RegWebForm(WebForm *);
00072 
00073         virtual void GetEnvironment();
00074         virtual void ReadCookies();
00075         virtual void FormInput();
00076         virtual void ValidateAuth();
00077         virtual void CreateHeader();
00078         virtual void GenerateDocument();
00079 
00080         std::string GetDate();
00081         std::string GetRequestMethod();
00082         void UpdateModified(const std::string& );
00083         std::string datetime2httpdate(const std::string& dt);
00084         const std::string& GetLastModified() { return m_lastmodified; }
00085         const std::string& GetQueryString() { return m_query_string; }
00086 
00088         void SetRealm(const std::string& realm_id);
00089         const std::string& GetRealm() { return m_realm; }
00091         virtual bool ValidateUser(const std::string& user,const std::string& pw);
00093         const std::string& GetUser();
00095         bool Valid();
00096 
00097         void SetContentType(const std::string& x) { m_contentType = x; }
00098         void SetContentDisposition(const std::string& x) { m_contentDisposition = x; }
00099         void SetLocation(const std::string& x) { m_location = x; }
00100 
00101 protected:
00102         Form *m_pclForm;
00103         Cookies *m_pclCookies;
00104 
00105 private:
00106         Web(const Web& ) {}
00107         Web& operator=(const Web& ) { return *this; }
00108         std::string m_strCookieDomain;
00109         std::string m_strCookiePath;
00110         std::string m_strCgiName;
00111         std::list<WebForm *> m_forms;
00112         std::string m_date;
00113         std::string m_method; // request_method
00114         std::string m_lastmodified;
00115         std::string m_query_string;
00116         std::string m_realm; 
00117         std::string m_user;
00118         bool m_bValid;
00119         std::string m_contentType;
00120         std::string m_contentDisposition;
00121         std::string m_location;
00122 };
00123 
00124 } // namespace
00125 
00126 #endif // _WEB_H

Generated for cgi++ by doxygen 1.3.7

Page, code, and content Copyright (C) 2004 by Anders Hedström