Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

xtl_metaphor.h

Go to the documentation of this file.
00001 
00002 // Common Text Transformation Library
00003 // Copyright (C) 1997-2006 by Igor Kholodov. 
00004 //
00005 // This library is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU Lesser General Public
00007 // License as published by the Free Software Foundation; either
00008 // version 2.1 of the License, or (at your option) any later version.
00009 //
00010 // This library is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // Lesser General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU Lesser General Public
00016 // License along with this library; if not, write to the
00017 // Free Software Foundation, Inc.,
00018 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00019 //
00020 // mailto:cttl@users.sourceforge.net
00021 // http://sourceforge.net/projects/cttl/
00023 
00037 // xtl_metaphor.h
00038 
00039 #ifndef _CTTL_XTL_METAPHOR_H_INCLUDED_
00040 #define _CTTL_XTL_METAPHOR_H_INCLUDED_
00041 
00046 #define CTTL_QWERTY_ "QWERTYUIOPASDFGHJKLZXCVBNM_qwertyuiopasdfghjklzxcvbnm"
00047 
00052 #define CTTL_QWERTY_123_ "QWERTYUIOPASDFGHJKLZXCVBNM_qwertyuiopasdfghjklzxcvbnm1234567890"
00053 
00058 #define CTTL_WCHAR_QWERTY_ L"QWERTYUIOPASDFGHJKLZXCVBNM_qwertyuiopasdfghjklzxcvbnm"
00059 
00064 #define CTTL_WCHAR_QWERTY_123_ L"QWERTYUIOPASDFGHJKLZXCVBNM_qwertyuiopasdfghjklzxcvbnm1234567890"
00065 
00066 
00067 namespace cttl {
00068 
00069 using namespace cttl_impl;
00070 
00083 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_end< CTTL_STD_STRING > > > >
00084 literal()
00085 {
00086     const CTTL_STD_CHAR CTTL_QWERTY_CONST[] = CTTL_QWERTY_;
00087     const CTTL_STD_CHAR CTTL_QWERTY_123_CONST[] = CTTL_QWERTY_123_;
00088     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_end< CTTL_STD_STRING > > > >(
00089         //begin( CTTL_STD_STRING( CTTL_QWERTY_ ) ) ^ end( CTTL_STD_STRING( CTTL_QWERTY_123_ ) )
00090         begin( CTTL_STD_STRING( CTTL_QWERTY_CONST ) )
00091         ^
00092         end( CTTL_STD_STRING( CTTL_QWERTY_123_CONST ) )
00093         );
00094 }
00095 
00114 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_end< CTTL_STD_STRING > > > >
00115 literal( CTTL_STD_CHAR const* text_begin_, CTTL_STD_CHAR const* text_end_ )
00116 {
00117     // compile time function
00118     // literal() is example of a function returning complex expression of type "expr ^ expr"
00119     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_end< CTTL_STD_STRING > > > >(
00120         begin( text_begin_ ) ^ end( text_end_ )
00121         );
00122 }
00123 
00142 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_end< CTTL_STD_STRING > > > >
00143 literal( CTTL_STD_STRING const& text_begin_, CTTL_STD_STRING const& text_end_ )
00144 {
00145     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_end< CTTL_STD_STRING > > > >(
00146         begin( text_begin_ ) ^ end( text_end_ )
00147         );
00148 }
00149 
00173 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_ref_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_ref_end< CTTL_STD_STRING > > > >
00174 literal( CTTL_STD_STRING const* text_begin_, CTTL_STD_STRING const* text_end_ )
00175 {
00176     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_ref_begin< CTTL_STD_STRING > >, xtl_wrap< xtl_text_ref_end< CTTL_STD_STRING > > > >(
00177         begin( text_begin_ ) ^ end( text_end_ )
00178         );
00179 }
00180 
00193 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > > > >
00194 wchar_literal()
00195 {
00196     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > > > >(
00197         begin( CTTL_STD_WSTRING( CTTL_WCHAR_QWERTY_ ) ) ^ end( CTTL_STD_WSTRING( CTTL_WCHAR_QWERTY_123_ ) )
00198         );
00199 }
00200 
00201 
00220 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > > > >
00221 wchar_literal( CTTL_STD_WCHAR const* text_begin_, CTTL_STD_WCHAR const* text_end_ )
00222 {
00223     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > > > >(
00224         begin( text_begin_ ) ^ end( text_end_ )
00225         );
00226 }
00227 
00228 
00247 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > > > >
00248 wchar_literal( CTTL_STD_WSTRING const& text_begin_, CTTL_STD_WSTRING const& text_end_ )
00249 {
00250     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > > > >(
00251         begin( text_begin_ ) ^ end( text_end_ )
00252         );
00253 }
00254 
00255 
00279 inline xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_ref_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_ref_end< CTTL_STD_WSTRING > > > >
00280 wchar_literal( CTTL_STD_WSTRING const* text_begin_, CTTL_STD_WSTRING const* text_end_ )
00281 {
00282     return xtl_wrap< xtl_opbinconcat< xtl_wrap< xtl_text_ref_begin< CTTL_STD_WSTRING > >, xtl_wrap< xtl_text_ref_end< CTTL_STD_WSTRING > > > >(
00283         begin( text_begin_ ) ^ end( text_end_ )
00284         );
00285 }
00286 
00287 
00307 template< typename ExprT >
00308 xtl_wrap<
00309     xtl_entity<
00310         xtl_wrap< ExprT >
00311     >
00312 >
00313 entity( xtl_wrap< ExprT > const& expr_ )
00314 {
00315     typedef
00316         xtl_entity<
00317             xtl_wrap< ExprT >
00318         > xtl_entity_T;
00319 
00320     return xtl_wrap< xtl_entity_T >( xtl_entity_T( expr_ ) );
00321 }
00322 
00323 
00333 inline universe_T
00334 entity()
00335 {
00336     return universe_T(
00337         relaxed_bool_T( true ) + !end()
00338         );
00339 }
00340 
00341 
00342 }   // namespace cttl
00343 
00344 #endif // _CTTL_XTL_METAPHOR_H_INCLUDED_

Generated on Thu Nov 2 17:44:06 2006 for Common Text Transformation Library by  doxygen 1.3.9.1