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

config_processor.hh

00001 /*
00002 *  Name:      config_processor.hh
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   CGI config processor
00005 *  Date:      $Date: 2003/04/14 00:18:31 $
00006 *  Revision:  $Revision: 1.1 $
00007 *
00008 *  Copyright (C) 1994-2002  Rafael Jesus Alcantara Perez <rafa@dedalo-ing.com>
00009 *
00010 *  This program is free software; you can redistribute it and/or modify
00011 *  it under the terms of the GNU General Public License as published by
00012 *  the Free Software Foundation; either version 2 of the License, or
00013 *  (at your option) any later version.
00014 *
00015 *  This program is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 *  GNU General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public License
00021 *  along with this program; if not, write to the Free Software
00022 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023 *  MA 02111-1307, USA.
00024 */
00025 
00026 #ifndef _MPCL_NET_CGI_CONFIG_PROCESSOR__
00027 #define _MPCL_NET_CGI_CONFIG_PROCESSOR__
00028 
00029 #include "../../text/html/form.hh"
00030 #include "../../text/string.hh"
00031 #include "../../util/prefs/config_processor.hh"
00032 
00033 
00035 namespace mpcl
00036 {
00037   
00039   namespace net
00040   {
00041 
00043     namespace cgi
00044     {
00045 
00046       using text::TString;
00047       using util::prefs::TOption;
00048 
00075       class TConfigProcessor : protected util::prefs::TConfigProcessor
00076       {
00077 
00078         private:
00079 
00081           using util::prefs::TConfigProcessor::TOptionVector;
00082 
00087           bool   gHasInput;
00088 
00090           mutable TOptionVector   tFormOptionVector;
00091 
00092 
00093         public:
00094 
00095           //
00096           //  C O N S T R U C T O R S
00097           //
00098 
00105           TConfigProcessor (int iPARAMETER_COUNT, const char** ppkcPARAMETERS);
00106 
00111           void processOptions (void);
00112 
00114           using util::prefs::TConfigProcessor::setCommandLineParameters;
00115 
00117           using util::prefs::TConfigProcessor::setConfigFileName;
00118 
00120           using util::prefs::TConfigProcessor::setCurrentNameSpace;
00121 
00123           using util::prefs::TConfigProcessor::addOption;
00124 
00125 
00126         protected:
00127 
00128           //
00129           //  C O N S T R U C T O R S
00130           //
00131 
00133           void processCommandLine (void);
00134 
00136           using util::prefs::TConfigProcessor::processConfigFile;
00137 
00141           void readFormData (std::basic_istream<char_type, traits_type>& rtSOURCE_ISTREAM);
00142 
00151           TOption& updateFormOption (const TString& rkyNAME, const TString& rkyVALUE);
00152 
00153           TOption& updateOptionWithName ( const TString& rkyNAME  ,
00154                                           const TString& rkyVALUE );
00155 
00156         public:
00157 
00158           //
00159           //  S E L E C T O R S
00160           //
00161 
00163           using util::prefs::TConfigProcessor::environmentValue;
00164 
00170           const TString& getFormValue (const char* pkcNAME) const;
00171 
00177           const TString& getFormValue (const std::string& rkyNAME) const
00178           {
00179             return getFormValue (rkyNAME.c_str());
00180           }
00181 
00185           bool hasFormOption (const TString& rkyNAME) const;
00186 
00191           bool hasInput (void) const
00192           {
00193             return gHasInput;
00194           }
00195 
00199           bool hasOption (const TString& rkyNAME) const;
00200 
00202           using util::prefs::TConfigProcessor::operator [];
00203 
00205           using util::prefs::TConfigProcessor::programFileName;
00206 
00211           void updateForm (text::html::TForm& rtTARGET_FORM) const;
00212 
00213       };  // class TConfigProcessor
00214 
00215     }  // namespace cgi
00216 
00217   }  // namespace net
00218 
00219 }  // namespace mpcl
00220 
00221 
00222 #endif  // not _MPCL_NET_CGI_CONFIG_PROCESSOR__

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