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

clause_body_string.hh

00001 /*
00002 *  Name:      clause_body_string.hh
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   Clause-body string
00005 *  Date:      $Date: 2003/04/14 00:18:32 $
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_TEXT_CODEGEN_CLAUSE_BODY_STRING__
00027 #define _MPCL_TEXT_CODEGEN_CLAUSE_BODY_STRING__
00028 
00029 #include "../../io/streamable.hh"
00030 #include "../../util/collection/string_to_string_map.hh"
00031 #include "../string.hh"
00032 #include "defs.hh"
00033 
00034 
00036 namespace mpcl
00037 {
00038 
00040   namespace text
00041   {
00042 
00044     namespace codegen
00045     {
00046 
00047       using io::IStreamable;
00048       using std::basic_istream;
00049       using std::basic_ostream;
00050       using util::collection::TStringToStringMap;
00051 
00053       class TClauseBodyString;
00054 
00059       template <typename TChar, typename TTraits>
00060       basic_istream<TChar, TTraits>&
00061       operator >> ( basic_istream<TChar, TTraits>& rtSOURCE_ISTREAM     ,
00062                     TClauseBodyString&             ryTARGET_CLAUSE_BODY );
00063 
00068       template <typename TChar, typename TTraits>
00069       basic_ostream<TChar, TTraits>&
00070       operator << ( basic_ostream<TChar, TTraits>& rtSOURCE_OSTREAM      ,
00071                     const TClauseBodyString&       rkySOURCE_CLAUSE_BODY );
00072 
00077       class TClauseBodyString :
00078         public TString        ,
00079         public IStreamable<>
00080       {
00081 
00082         public:
00083 
00085           typedef
00086             IStreamable<>::char_type
00087             char_type;
00088 
00090           typedef
00091             IStreamable<>::traits_type
00092             traits_type;
00093 
00094 
00095         protected:
00096 
00101           bool   gParameterExistenceSensitiveness;
00102 
00103 
00104         public:
00105 
00106           //
00107           //  C O N S T R U C T O R S
00108           //
00109 
00111           TClauseBodyString (void)                  :
00112             TString                          ()     ,
00113             IStreamable<>                    ()     ,
00114             gParameterExistenceSensitiveness (true) {}
00115 
00120           TClauseBodyString (const char* pkcSOURCE_CLAUSE_BODY)      :
00121             TString                          (pkcSOURCE_CLAUSE_BODY) ,
00122             IStreamable<>                    ()                      ,
00123             gParameterExistenceSensitiveness (true)                  {}
00124 
00129           TClauseBodyString (const TString& rkySOURCE_CLAUSE_BODY)   :
00130             TString                          (rkySOURCE_CLAUSE_BODY) ,
00131             IStreamable<>                    ()                      ,
00132             gParameterExistenceSensitiveness (true)                  {}
00133 
00139           TClauseBodyString& operator = (const TClauseBodyString& rkySOURCE_CLAUSE_BODY);
00140 
00145           void setParameterExistenceSensitiveness (bool gSENSITIVENESS)
00146           {
00147             gParameterExistenceSensitiveness = gSENSITIVENESS;
00148           }
00149 
00150 
00151         protected:
00152 
00153           //
00154           //  C O N S T R U C T O R S
00155           //
00156 
00158           void read (basic_istream<char_type, traits_type>& rtSOURCE_ISTREAM);
00159 
00160 
00161         public:
00162 
00163           //
00164           //  S E L E C T O R S
00165           //
00166 
00171           TString instantiate (void) const
00172           {
00173             return preprocess();
00174           }
00175 
00185           TString instantiate ( const char* pkcFIRST_PARAMETER_NAME     ,
00186                                 const char* pkcFIRST_PARAMETER_VALUE... ) const;
00187 
00195           TString instantiate (const TStringToVariableMap& rktSOURCE_VARIABLE_MAP) const
00196           {
00197             return instantiate (rktSOURCE_VARIABLE_MAP, gParameterExistenceSensitiveness);
00198           }
00199 
00207           TString instantiate (const TStringToStringMap& rktSOURCE_STRING_TO_STRING_MAP) const
00208           {
00209             return instantiate (rktSOURCE_STRING_TO_STRING_MAP, gParameterExistenceSensitiveness);
00210           }
00211 
00224           TString
00225           instantiate ( const TStringToVariableMap& rktSOURCE_VARIABLE_MAP             ,
00226                         bool                        gPARAMETER_EXISTENCE_SENSITIVENESS ) const;
00227 
00240           TString
00241           instantiate ( const TStringToStringMap& rktSOURCE_STRING_MAP               ,
00242                         bool                      gPARAMETER_EXISTENCE_SENSITIVENESS ) const;
00243 
00244 
00245         protected:
00246 
00247           //
00248           //  S E L E C T O R S
00249           //
00250 
00255           void write (basic_ostream<char_type, traits_type>& rtTARGET_OSTREAM) const;
00256 
00262           TString preprocess (void) const;
00263 
00264 
00265         public:
00266 
00267           //
00268           //  F R I E N D   F U N C T I O N S
00269           //
00270 
00271           friend basic_istream<value_type, traits_type>&
00272           operator >> <value_type, traits_type>
00273           (
00274             basic_istream<value_type, traits_type>& rtSOURCE_ISTREAM     ,
00275             TClauseBodyString&                      ryTARGET_CLAUSE_BODY
00276           );
00277 
00278           friend basic_ostream<value_type, traits_type>&
00279           operator << <value_type, traits_type>
00280           (
00281             basic_ostream<value_type, traits_type>& rtSOURCE_OSTREAM      ,
00282             const TClauseBodyString&                rkySOURCE_CLAUSE_BODY
00283           );
00284 
00285       };  // class TClauseBodyString
00286 
00287       //
00288       //  F R I E N D   F U N C T I O N S
00289       //
00290 
00291       template <typename TChar, typename TTraits>
00292       basic_istream<TChar, TTraits>&
00293       operator >> ( basic_istream<TChar, TTraits>& rtSOURCE_ISTREAM     ,
00294                     TClauseBodyString&             ryTARGET_CLAUSE_BODY )
00295       {
00296         ryTARGET_CLAUSE_BODY.read (rtSOURCE_ISTREAM);
00297         return rtSOURCE_ISTREAM;
00298       }
00299 
00300       template <typename TChar, typename TTraits>
00301       basic_ostream<TChar, TTraits>&
00302       operator << ( basic_ostream<TChar, TTraits>& rtSOURCE_OSTREAM      ,
00303                     const TClauseBodyString&       rkySOURCE_CLAUSE_BODY )
00304       {
00305         rkySOURCE_CLAUSE_BODY.write (rtSOURCE_OSTREAM);
00306         return rtSOURCE_OSTREAM;
00307       }
00308 
00309     }  // namespace codegen
00310 
00311   }  // namespace text
00312 
00313 }  // namespace mpcl
00314 
00315 
00316 #endif  // not _MPCL_TEXT_CODEGEN_CLAUSE_BODY_STRING__

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