CGI.h

Go to the documentation of this file.
00001 /* -*- c++ -*-
00002  * $Id: CGI.h,v 1.33 2006/05/16 20:06:34 brook Exp $
00003  */
00004 
00005 /*
00006  * ClearSilver++ Software License.
00007  *
00008  * Copyright (c) 2005,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 CGI_h_
00044 #define CGI_h_ 1
00045 
00046 #include <iosfwd>
00047 #include <string>
00048 #include <stdio.h>
00049 #include <boost/shared_ptr.hpp>
00050 #include "ConstHDF.h"
00051 #include "Cookie.h"
00052 #include "HDF.h"
00053 #include "TraceObject.h"
00054 
00055 class _cgi;
00056 
00057 namespace ClearSilver
00058 {
00059 
00060   class URL;                    // forward declaration
00061 
00080 class CGI : TraceObject
00081 {
00082 public:
00084   //\{
00085                                 // constructors ClearSilver
00087   CGI ();
00089   explicit CGI (const HDF&);
00091   CGI (const CGI&);
00093   ~CGI () throw();
00095   CGI& operator = (const CGI&);
00096 
00098   void swap (CGI&) throw();
00099   //\}
00100 
00102   //\{
00104   operator bool () const;
00105   //\}
00106 
00108   //\{
00110   ConstHDF hdf () const;
00112   HDF hdf ();
00114   std::string DocumentRoot () const;
00116   std::string ScriptFilename () const;
00118   std::string ScriptDirectory () const;
00126   std::string ScriptBasename () const;
00135   std::string ScriptBasename (const char * suffix) const;
00144  std::string ScriptBasename (const std::string& suffix) const;
00145   //\}
00146 
00153   //\{
00154   void display (const char* cs_file) const;
00155   void display (const std::string& cs_file) const;
00156   //\}
00157 
00159   //\{
00161   void redirect (const URL&);
00163   void redirect_path (const URL&);
00164   //\}
00165 
00167   //\{
00174   void set (const Cookie&);
00176   void clear (const Cookie&);
00178   Cookie::Authority cookie_authority (const char * host) const;
00180   Cookie::Authority cookie_authority (const std::string& host) const;
00181   //\}
00182 
00199   //\{
00200   std::FILE* upload () const;
00201   std::FILE* upload (const char *) const;
00202   std::FILE* upload (const std::string&) const;
00203   //\}
00204 
00211   static bool& debug ();
00212 
00213 private:
00214   typedef boost::shared_ptr<_cgi> Ptr;
00215 
00216 private:
00217   Ptr cgi_;
00218   HDF hdf_;
00219 };
00220 
00221 };                              // namespace ClearSilver
00222 
00223 #endif

Generated on Tue May 16 14:50:52 2006 for ClearSilver C++ Library by  doxygen 1.4.5