00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
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
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
00155
00156
00158 void read (basic_istream<char_type, traits_type>& rtSOURCE_ISTREAM);
00159
00160
00161 public:
00162
00163
00164
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
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
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 };
00286
00287
00288
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 }
00310
00311 }
00312
00313 }
00314
00315
00316 #endif // not _MPCL_TEXT_CODEGEN_CLAUSE_BODY_STRING__