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

clause_tag_string.hh

00001 /*
00002 *  Name:      clause_tag_string.hh
00003 *  Author:    Rafael Jesus Alcantara Perez
00004 *  Summary:   Clause tag 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_TAG_STRING__
00027 #define _MPCL_TEXT_CODEGEN_CLAUSE_TAG_STRING__
00028 
00029 #include "../../io/streamable.hh"
00030 #include "../string.hh"
00031 
00032 
00034 namespace mpcl
00035 {
00036 
00038   namespace text
00039   {
00040 
00042     namespace codegen
00043     {
00044 
00045       using io::IStreamable;
00046 
00048       class TClauseTagString;
00049 
00054       template <typename TChar, typename TTraits>
00055       std::basic_istream<TChar, TTraits>&
00056       operator >> ( std::basic_istream<TChar, TTraits>& rtSOURCE_ISTREAM    ,
00057                     TClauseTagString&                   ryTARGET_CLAUSE_TAG );
00058 
00063       template <typename TChar, typename TTraits>
00064       std::basic_ostream<TChar, TTraits>&
00065       operator << ( std::basic_ostream<TChar, TTraits>& rtSOURCE_OSTREAM     ,
00066                     const TClauseTagString&             rkySOURCE_CLAUSE_TAG );
00067 
00072       class TClauseTagString :
00073         public TString       ,
00074         public IStreamable<>
00075       {
00076 
00077         public:
00078 
00080           typedef
00081             IStreamable<>::char_type
00082             char_type;
00083 
00085           typedef
00086             IStreamable<>::traits_type
00087             traits_type;
00088 
00089 
00090         private:
00091 
00096           TString   yTarget;
00097 
00099           bool      gCheckParameters;
00100 
00101 
00102         public:
00103 
00104           //
00105           //  C O N S T R U C T O R S
00106           //
00107 
00109           TClauseTagString (void)   :
00110             TString          ()     ,
00111             IStreamable<>    ()     ,
00112             yTarget          ()     ,
00113             gCheckParameters (true) {}
00114 
00119           TClauseTagString (const char* pkcSOURCE_TEXT) :
00120             TString          (pkcSOURCE_TEXT)           ,
00121             IStreamable<>    ()                         ,
00122             yTarget          ()                         ,
00123             gCheckParameters (true)                     {}
00124 
00129           TClauseTagString (const TClauseTagString& rkySOURCE_CLAUSE_TAG) :
00130             TString          (rkySOURCE_CLAUSE_TAG)                       ,
00131             IStreamable<>    ()                                           ,
00132             yTarget          (rkySOURCE_CLAUSE_TAG.yTarget)               ,
00133             gCheckParameters (rkySOURCE_CLAUSE_TAG.gCheckParameters)      {}
00134 
00139           void overloadFrom (const TClauseTagString& rkySOURCE_CLAUSE_TAG);
00140 
00142           void read (std::basic_istream<char_type, traits_type>& rtSOURCE_ISTREAM);
00143 
00144 
00145         public:
00146 
00147           //
00148           //  S E L E C T O R S
00149           //
00150 
00155           bool hasTarget (void) const
00156           {
00157             return !target().empty();
00158           }
00159 
00160           bool mustCheckParameters (void) const;
00161 
00162           const TString& name (void) const;
00163 
00164           const TString& target (void) const;
00165 
00167           void write (std::basic_ostream<char_type, traits_type>& rtTARGET_OSTREAM) const;
00168 
00169 
00170         public:
00171 
00172           //
00173           //  F R I E N D   F U N C T I O N S
00174           //
00175 
00176           friend std::basic_istream<value_type, traits_type>&
00177           operator >> <value_type, traits_type>
00178           (
00179             std::basic_istream<value_type, traits_type>& rtSOURCE_ISTREAM    ,
00180             TClauseTagString&                            ryTARGET_CLAUSE_TAG
00181           );
00182 
00183           friend std::basic_ostream<value_type, traits_type>&
00184           operator << <value_type, traits_type>
00185           (
00186             std::basic_ostream<value_type, traits_type>& rtSOURCE_OSTREAM     ,
00187             const TClauseTagString&                      rkySOURCE_CLAUSE_TAG
00188           );
00189 
00190       };  // class TClauseTagString
00191 
00192       //
00193       //  F R I E N D   F U N C T I O N S
00194       //
00195 
00196       template <typename TChar, typename TTraits>
00197       std::basic_istream<TChar, TTraits>&
00198       operator >> ( std::basic_istream<TChar, TTraits>& rtSOURCE_ISTREAM    ,
00199                     TClauseTagString&                   ryTARGET_CLAUSE_TAG )
00200       {
00201         ryTARGET_CLAUSE_TAG.read (rtSOURCE_ISTREAM);
00202         return rtSOURCE_ISTREAM;
00203       }
00204 
00205       template <typename TChar, typename TTraits>
00206       std::basic_ostream<TChar, TTraits>&
00207       operator << ( std::basic_ostream<TChar, TTraits>& rtSOURCE_OSTREAM     ,
00208                     const TClauseTagString&             rkySOURCE_CLAUSE_TAG )
00209       {
00210         rkySOURCE_CLAUSE_TAG.write (rtSOURCE_OSTREAM);
00211         return rtSOURCE_OSTREAM;
00212       }
00213 
00214     }  // namespace codegen
00215 
00216   }  // namespace text
00217 
00218 }  // namespace mpcl
00219 
00220 
00221 #endif  // not _MPCL_TEXT_CODEGEN_CLAUSE_TAG_STRING__

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