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

xtl_sym.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 
00035 // xtl_sym.h
00036 
00037 #ifndef _CTTL_XTL_SYM_H_INCLUDED_
00038 #define _CTTL_XTL_SYM_H_INCLUDED_
00039 
00040 namespace cttl {
00041 
00042 using namespace cttl_impl;
00043 
00065 template< typename Static_predicateT >
00066 inline xtl_wrap< xtl_predicate< Static_predicateT > >
00067 rule( const Static_predicateT pred_ )
00068 {
00069     return xtl_wrap< xtl_predicate< Static_predicateT > >( pred_ );
00070 }
00071 
00072 
00098 template< typename ObjectT, typename PredicateT >
00099 inline xtl_wrap< xtl_member_predicate< ObjectT, PredicateT > >
00100 rule( ObjectT& object_ref_, PredicateT pred_ )
00101 {
00102     return xtl_wrap< xtl_member_predicate< ObjectT, PredicateT > >( xtl_member_predicate< ObjectT, PredicateT >( object_ref_, pred_ ) );
00103 }
00104 
00113 inline xtl_wrap< xtl_char_symbol >
00114 symbol()
00115 {
00116     return xtl_wrap< xtl_char_symbol >();
00117 }
00118 
00127 inline xtl_wrap< xtl_position_bof >
00128 begin()
00129 {
00130     return xtl_wrap< xtl_position_bof >();
00131 }
00132 
00145 inline xtl_wrap< xtl_bool< false > >
00146 symbol( bool bool_ )
00147 {
00148     // fails on empty universe
00149     return xtl_wrap< xtl_bool< false > >( bool_ );
00150 }
00151 
00164 inline xtl_wrap< xtl_bool< true > >
00165 begin( bool bool_ )
00166 {
00167     // succeeds on empty universe
00168     return xtl_wrap< xtl_bool< true > >( bool_ );
00169 }
00170 
00182 inline xtl_wrap< xtl_char< CTTL_STD_CHAR > >
00183 symbol( CTTL_STD_CHAR char_ )
00184 {
00185     return xtl_wrap< xtl_char< CTTL_STD_CHAR > >( char_ );
00186 }
00187 
00199 inline xtl_wrap< xtl_char< CTTL_STD_WCHAR > >
00200 symbol( CTTL_STD_WCHAR char_ )
00201 {
00202     return xtl_wrap< xtl_char< CTTL_STD_WCHAR > >( char_ );
00203 }
00204 
00217 inline xtl_wrap< xtl_char< CTTL_STD_CHAR > >
00218 symbol( int char_ )
00219 {
00220     // allows symbol( 0x0a ) notation for individual characters
00221     return xtl_wrap< xtl_char< CTTL_STD_CHAR > >( CTTL_STD_CHAR( char_ ) );
00222 }
00223 
00236 inline xtl_wrap< xtl_char_begin< CTTL_STD_CHAR > >
00237 begin( CTTL_STD_CHAR char_ )
00238 {
00239     return xtl_wrap< xtl_char_begin< CTTL_STD_CHAR > >( char_ );
00240 }
00241 
00254 inline xtl_wrap< xtl_char_begin< CTTL_STD_WCHAR > >
00255 begin( CTTL_STD_WCHAR char_ )
00256 {
00257     return xtl_wrap< xtl_char_begin< CTTL_STD_WCHAR > >( char_ );
00258 }
00259 
00272 inline xtl_wrap< xtl_char_begin< CTTL_STD_CHAR > >
00273 begin( int char_ )
00274 {
00275     // allows begin( 0x0a ) notation for individual characters
00276     return xtl_wrap< xtl_char_begin< CTTL_STD_CHAR > >( CTTL_STD_CHAR( char_ ) );
00277 }
00278 
00291 inline xtl_wrap< xtl_char_end< CTTL_STD_CHAR > >
00292 end( CTTL_STD_CHAR char_ )
00293 {
00294     return xtl_wrap< xtl_char_end< CTTL_STD_CHAR > >( char_ );
00295 }
00296 
00309 inline xtl_wrap< xtl_char_end< CTTL_STD_WCHAR > >
00310 end( CTTL_STD_WCHAR char_ )
00311 {
00312     return xtl_wrap< xtl_char_end< CTTL_STD_WCHAR > >( char_ );
00313 }
00314 
00327 inline xtl_wrap< xtl_char_end< CTTL_STD_CHAR > >
00328 end( int char_ )
00329 {
00330     // allows end( 0x0a ) notation for individual characters
00331     return xtl_wrap< xtl_char_end< CTTL_STD_CHAR > >( CTTL_STD_CHAR( char_ ) );
00332 }
00333 
00346 inline xtl_wrap< xtl_keyword< CTTL_STD_STRING > >
00347 begin( std::set< CTTL_STD_STRING > const& keywords_ )
00348 {
00349     return xtl_wrap< xtl_keyword< CTTL_STD_STRING > >( keywords_ );
00350 }
00351 
00364 inline xtl_wrap< xtl_keyword< CTTL_STD_WSTRING > >
00365 begin( std::set< CTTL_STD_WSTRING > const& keywords_ )
00366 {
00367     return xtl_wrap< xtl_keyword< CTTL_STD_WSTRING > >( keywords_ );
00368 }
00369 
00371 
00384 inline xtl_wrap< xtl_iswhat_begin >
00385 begin( iswhat_T iswhat_ )
00386 {
00387     return xtl_wrap< xtl_iswhat_begin >( iswhat_ );
00388 }
00389 
00390 
00403 inline xtl_wrap< xtl_iswhat_end >
00404 end( iswhat_T iswhat_ )
00405 {
00406     return xtl_wrap< xtl_iswhat_end >( iswhat_ );
00407 }
00408 
00409 
00422 inline xtl_wrap< xtl_iswhat_first >
00423 first( iswhat_T iswhat_ )
00424 {
00425     return xtl_wrap< xtl_iswhat_first >( iswhat_ );
00426 }
00427 
00428 
00441 inline xtl_wrap< xtl_iswhat_entity >
00442 entity( iswhat_T iswhat_ )
00443 {
00444     return xtl_wrap< xtl_iswhat_entity >( iswhat_ );
00445 }
00446 
00448 
00449 
00462 inline xtl_wrap< xtl_iswwhat_begin >
00463 begin( iswwhat_T iswwhat_ )
00464 {
00465     return xtl_wrap< xtl_iswwhat_begin >( iswwhat_ );
00466 }
00467 
00468 
00481 inline xtl_wrap< xtl_iswwhat_end >
00482 end( iswwhat_T iswwhat_ )
00483 {
00484     return xtl_wrap< xtl_iswwhat_end >( iswwhat_ );
00485 }
00486 
00487 
00500 inline xtl_wrap< xtl_iswwhat_first >
00501 first( iswwhat_T iswwhat_ )
00502 {
00503     return xtl_wrap< xtl_iswwhat_first >( iswwhat_ );
00504 }
00505 
00506 
00519 inline xtl_wrap< xtl_iswwhat_entity >
00520 entity( iswwhat_T iswwhat_ )
00521 {
00522     return xtl_wrap< xtl_iswwhat_entity >( iswwhat_ );
00523 }
00524 
00526 
00527 
00540 inline xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >
00541 begin( CTTL_STD_CHAR const* any_text_ )
00542 {
00543     return xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >( any_text_ );
00544 }
00545 
00546 
00559 inline xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >
00560 begin( CTTL_STD_WCHAR const* any_text_ )
00561 {
00562     return xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >( any_text_ );
00563 }
00564 
00565 
00578 inline xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >
00579 begin( CTTL_STD_STRING const& any_text_ )
00580 {
00581     return xtl_wrap< xtl_text_begin< CTTL_STD_STRING > >( any_text_ );
00582 }
00583 
00584 
00597 inline xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >
00598 begin( CTTL_STD_WSTRING const& any_text_ )
00599 {
00600     return xtl_wrap< xtl_text_begin< CTTL_STD_WSTRING > >( any_text_ );
00601 }
00602 
00603 
00616 inline xtl_wrap< xtl_text_ref_begin< CTTL_STD_STRING > >
00617 begin( CTTL_STD_STRING const* any_text_ )
00618 {
00619     return xtl_wrap< xtl_text_ref_begin< CTTL_STD_STRING > >( any_text_ );
00620 }
00621 
00622 
00635 inline xtl_wrap< xtl_text_ref_begin< CTTL_STD_WSTRING > >
00636 begin( CTTL_STD_WSTRING const* any_text_ )
00637 {
00638     return xtl_wrap< xtl_text_ref_begin< CTTL_STD_WSTRING > >( any_text_ );
00639 }
00640 
00642 
00643 
00656 inline xtl_wrap< xtl_text_end< CTTL_STD_STRING > >
00657 end( CTTL_STD_CHAR const* any_text_ )
00658 {
00659     return xtl_wrap< xtl_text_end< CTTL_STD_STRING > >( any_text_ );
00660 }
00661 
00662 
00675 inline xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > >
00676 end( CTTL_STD_WCHAR const* any_text_ )
00677 {
00678     return xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > >( any_text_ );
00679 }
00680 
00681 
00694 inline xtl_wrap< xtl_text_end< CTTL_STD_STRING > >
00695 end( CTTL_STD_STRING const& any_text_ )
00696 {
00697     return xtl_wrap< xtl_text_end< CTTL_STD_STRING > >( any_text_ );
00698 }
00699 
00700 
00713 inline xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > >
00714 end( CTTL_STD_WSTRING const& any_text_ )
00715 {
00716     return xtl_wrap< xtl_text_end< CTTL_STD_WSTRING > >( any_text_ );
00717 }
00718 
00719 
00732 inline xtl_wrap< xtl_text_ref_end< CTTL_STD_STRING > >
00733 end( CTTL_STD_STRING const* any_text_ )
00734 {
00735     return xtl_wrap< xtl_text_ref_end< CTTL_STD_STRING > >( any_text_ );
00736 }
00737 
00738 
00751 inline xtl_wrap< xtl_text_ref_end< CTTL_STD_WSTRING > >
00752 end( CTTL_STD_WSTRING const* any_text_ )
00753 {
00754     return xtl_wrap< xtl_text_ref_end< CTTL_STD_WSTRING > >( any_text_ );
00755 }
00756 
00758 
00771 inline xtl_wrap< xtl_text_first< CTTL_STD_STRING > >
00772 first( CTTL_STD_CHAR const* any_text_ )
00773 {
00774     return xtl_wrap< xtl_text_first< CTTL_STD_STRING > >( any_text_ );
00775 }
00776 
00777 
00790 inline xtl_wrap< xtl_text_first< CTTL_STD_WSTRING > >
00791 first( CTTL_STD_WCHAR const* any_text_ )
00792 {
00793     return xtl_wrap< xtl_text_first< CTTL_STD_WSTRING > >( any_text_ );
00794 }
00795 
00796 
00809 inline xtl_wrap< xtl_text_first< CTTL_STD_STRING > >
00810 first( CTTL_STD_STRING const& any_text_ )
00811 {
00812     return xtl_wrap< xtl_text_first< CTTL_STD_STRING > >( any_text_ );
00813 }
00814 
00815 
00828 inline xtl_wrap< xtl_text_first< CTTL_STD_WSTRING > >
00829 first( CTTL_STD_WSTRING const& any_text_ )
00830 {
00831     return xtl_wrap< xtl_text_first< CTTL_STD_WSTRING > >( any_text_ );
00832 }
00833 
00834 
00847 inline xtl_wrap< xtl_text_ref_first< CTTL_STD_STRING > >
00848 first( CTTL_STD_STRING const* any_text_ )
00849 {
00850     return xtl_wrap< xtl_text_ref_first< CTTL_STD_STRING > >( any_text_ );
00851 }
00852 
00853 
00866 inline xtl_wrap< xtl_text_ref_first< CTTL_STD_WSTRING > >
00867 first( CTTL_STD_WSTRING const* any_text_ )
00868 {
00869     return xtl_wrap< xtl_text_ref_first< CTTL_STD_WSTRING > >( any_text_ );
00870 }
00871 
00873 
00874 
00887 inline xtl_wrap< xtl_char< CTTL_STD_CHAR > >
00888 entity( CTTL_STD_CHAR char_ )
00889 {
00890     return xtl_wrap< xtl_char< CTTL_STD_CHAR > >( char_ );
00891 }
00892 
00893 
00906 inline xtl_wrap< xtl_char< CTTL_STD_WCHAR > >
00907 entity( CTTL_STD_WCHAR char_ )
00908 {
00909     return xtl_wrap< xtl_char< CTTL_STD_WCHAR > >( char_ );
00910 }
00911 
00912 
00925 inline xtl_wrap< xtl_char< CTTL_STD_CHAR > >
00926 entity( int char_ )
00927 {
00928     // allows entity( 0x0a ) notation for individual characters
00929     return xtl_wrap< xtl_char< CTTL_STD_CHAR > >( CTTL_STD_CHAR( char_ ) );
00930 }
00931 
00932 
00945 inline xtl_wrap< xtl_text_entity< CTTL_STD_STRING > >
00946 entity( CTTL_STD_CHAR const* any_text_ )
00947 {
00948     return xtl_wrap< xtl_text_entity< CTTL_STD_STRING > >( any_text_ );
00949 }
00950 
00951 
00964 inline xtl_wrap< xtl_text_entity< CTTL_STD_WSTRING > >
00965 entity( CTTL_STD_WCHAR const* any_text_ )
00966 {
00967     return xtl_wrap< xtl_text_entity< CTTL_STD_WSTRING > >( any_text_ );
00968 }
00969 
00970 
00983 inline xtl_wrap< xtl_text_entity< CTTL_STD_STRING > >
00984 entity( CTTL_STD_STRING const& any_text_ )
00985 {
00986     return xtl_wrap< xtl_text_entity< CTTL_STD_STRING > >( any_text_ );
00987 }
00988 
00989 
01002 inline xtl_wrap< xtl_text_entity< CTTL_STD_WSTRING > >
01003 entity( CTTL_STD_WSTRING const& any_text_ )
01004 {
01005     return xtl_wrap< xtl_text_entity< CTTL_STD_WSTRING > >( any_text_ );
01006 }
01007 
01008 
01021 inline xtl_wrap< xtl_text_ref_entity< CTTL_STD_STRING > >
01022 entity( CTTL_STD_STRING const* any_text_ )
01023 {
01024     return xtl_wrap< xtl_text_ref_entity< CTTL_STD_STRING > >( any_text_ );
01025 }
01026 
01027 
01040 inline xtl_wrap< xtl_text_ref_entity< CTTL_STD_WSTRING > >
01041 entity( CTTL_STD_WSTRING const* any_text_ )
01042 {
01043     return xtl_wrap< xtl_text_ref_entity< CTTL_STD_WSTRING > >( any_text_ );
01044 }
01045 
01047 
01048 
01061 inline xtl_wrap< xtl_text_symbol< CTTL_STD_STRING > >
01062 symbol( CTTL_STD_CHAR const* any_text_ )
01063 {
01064     return xtl_wrap< xtl_text_symbol< CTTL_STD_STRING > >( any_text_ );
01065 }
01066 
01067 
01080 inline xtl_wrap< xtl_text_symbol< CTTL_STD_WSTRING > >
01081 symbol( CTTL_STD_WCHAR const* any_text_ )
01082 {
01083     return xtl_wrap< xtl_text_symbol< CTTL_STD_WSTRING > >( any_text_ );
01084 }
01085 
01098 inline xtl_wrap< xtl_text_symbol< CTTL_STD_STRING > >
01099 symbol( CTTL_STD_STRING const& any_text_ )
01100 {
01101     return xtl_wrap< xtl_text_symbol< CTTL_STD_STRING > >( any_text_ );
01102 }
01103 
01104 
01117 inline xtl_wrap< xtl_text_symbol< CTTL_STD_WSTRING > >
01118 symbol( CTTL_STD_WSTRING const& any_text_ )
01119 {
01120     return xtl_wrap< xtl_text_symbol< CTTL_STD_WSTRING > >( any_text_ );
01121 }
01122 
01123 
01136 inline xtl_wrap< xtl_text_ref_symbol< CTTL_STD_STRING > >
01137 symbol( CTTL_STD_STRING const* any_text_ )
01138 {
01139     return xtl_wrap< xtl_text_ref_symbol< CTTL_STD_STRING > >( any_text_ );
01140 }
01141 
01142 
01155 inline xtl_wrap< xtl_text_ref_symbol< CTTL_STD_WSTRING > >
01156 symbol( CTTL_STD_WSTRING const* any_text_ )
01157 {
01158     return xtl_wrap< xtl_text_ref_symbol< CTTL_STD_WSTRING > >( any_text_ );
01159 }
01160 
01161 
01163 
01164 
01174 inline xtl_wrap< xtl_position_eof >
01175 end()
01176 {
01177     return xtl_wrap< xtl_position_eof >();
01178 }
01179 
01180 }   // namespace cttl
01181 
01182 #endif // _CTTL_XTL_SYM_H_INCLUDED_

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