00001 /* -*- c++ -*- 00002 * $Id: CGIApplication.h,v 1.11 2006/05/16 20:12:15 brook Exp $ 00003 */ 00004 00005 /* 00006 * ClearSilver++ Software License. 00007 * 00008 * Copyright (c) 2006 Brook Milligan <brook@nmsu.edu> 00009 * All rights reserved. 00010 * 00011 * Redistribution and use in source and binary forms, with or without 00012 * modification, are permitted provided that the following conditions 00013 * are met: 00014 * 00015 * 1. Redistributions of source code must retain the above copyright 00016 * notice, this list of conditions and the following disclaimer. 00017 * 2. Redistributions in binary form must reproduce the above 00018 * copyright notice, this list of conditions and the following 00019 * disclaimer in the documentation and/or other materials provided 00020 * with the distribution. 00021 * 3. The name of the author may not be used to endorse or promote 00022 * products derived from this software without specific prior 00023 * written permission. 00024 * 00025 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 00026 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00027 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00028 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00029 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00030 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00031 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00032 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00033 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00034 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00035 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00036 */ 00037 00043 #ifndef CGIApplication_h_ 00044 #define CGIApplication_h_ 1 00045 00046 #include <boost/shared_ptr.hpp> 00047 #include "CGI.h" 00048 #include "TraceObject.h" 00049 00050 namespace ClearSilver 00051 { 00052 00073 class CGIApplication : TraceObject 00074 { 00075 public: 00077 //\{ 00078 typedef boost::shared_ptr<CGIApplication> Ptr; 00079 //\} 00080 00081 public: 00083 //\{ 00084 // constructors 00086 CGIApplication (); 00088 explicit CGIApplication (const char*); 00090 explicit CGIApplication (const std::string&); 00092 explicit CGIApplication (const ClearSilver::HDF&); 00094 explicit CGIApplication (const ClearSilver::CGI&); 00096 CGIApplication (const CGIApplication&); 00098 virtual ~CGIApplication () throw(); 00099 00101 CGIApplication& operator = (const CGIApplication&); 00103 CGIApplication& operator = (const CGI&); 00105 void swap (CGIApplication&) throw(); 00106 //\} 00107 00129 void operator () (); 00130 00132 //\{ 00134 CGI cgi () const; 00136 HDF hdf (); 00137 //\} 00138 00139 protected: 00147 //\{ 00148 00150 virtual void initialize (); 00151 00172 virtual bool authenticate() = 0; 00173 00187 virtual void execute(); 00188 00204 virtual void display(); 00205 00212 virtual void execute_unauthenticated(); 00213 00228 virtual void display_unauthenticated(); 00229 00239 virtual void terminate (); 00240 00248 virtual void handle_exception (const std::string&); 00249 //\} 00250 00251 public: 00258 static bool& debug (); 00259 00260 private: 00261 CGI cgi_; 00262 }; 00263 00264 }; // namespace ClearSilver 00265 00266 #endif
1.4.5