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

edge_functors.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 // edge_functors.h
00036 
00037 #ifndef _CTTL_EDGE_FUNCTORS_H_INCLUDED_
00038 #define _CTTL_EDGE_FUNCTORS_H_INCLUDED_
00039 
00040 #include "edge.h"
00041 
00042 namespace cttl {
00043 
00060 template< typename PolicyT = policy_default, typename StringT = CTTL_STD_STRING >
00061 struct edge_replace : public std::unary_function< edge< PolicyT, StringT >, void >
00062 {
00064     edge_replace( StringT const& str_ )
00065         :
00066         m_str( str_ )
00067     {}
00068     
00074     void operator()( edge< PolicyT, StringT >& edge_ )
00075     {
00076         edge_.text( m_str );
00077     }
00078     
00080     StringT m_str;
00081 };
00082 
00100 template< typename PolicyT = policy_default, typename StringT = CTTL_STD_STRING >
00101 struct edge_first_insert_go : public std::unary_function< edge< PolicyT, StringT >, void >
00102 {
00104     edge_first_insert_go( StringT const& str_ )
00105         :
00106         m_str( str_ )
00107     {}
00108     
00120     void operator() ( edge< PolicyT, StringT >& edge_ )
00121     {
00122         edge_.first.insert_go( m_str );
00123     }
00124     
00126     StringT m_str;
00127 };
00128 
00146 template< typename PolicyT = policy_default, typename StringT = CTTL_STD_STRING >
00147 struct edge_first_insert_stay : public std::unary_function< edge< PolicyT, StringT >, void >
00148 {
00150     edge_first_insert_stay( StringT const& str_ )
00151         :
00152         m_str( str_ )
00153     {}
00154     
00165     void operator() ( edge< PolicyT, StringT >& edge_ )
00166     {
00167         edge_.first.insert_stay( m_str );
00168     }
00169     
00171     StringT m_str;
00172 };
00173 
00191 template< typename PolicyT = policy_default, typename StringT = CTTL_STD_STRING >
00192 struct edge_second_insert_go : public std::unary_function< edge< PolicyT, StringT >, void >
00193 {
00195     edge_second_insert_go( StringT const& str_ )
00196         :
00197         m_str( str_ )
00198     {}
00199     
00211     void operator() ( edge< PolicyT, StringT >& edge_ )
00212     {
00213         edge_.second.insert_go( m_str );
00214     }
00215     
00217     StringT m_str;
00218 };
00219 
00237 template< typename PolicyT = policy_default, typename StringT = CTTL_STD_STRING >
00238 struct edge_second_insert_stay : public std::unary_function< edge< PolicyT, StringT >, void >
00239 {
00241     edge_second_insert_stay( StringT const& str_ )
00242         :
00243         m_str( str_ )
00244     {}
00245     
00256     void operator() ( edge< PolicyT, StringT >& edge_ )
00257     {
00258         edge_.second.insert_stay( m_str );
00259     }
00260     
00262     StringT m_str;
00263 };
00264 
00265 }   // namespace cttl
00266 
00267 #endif // _CTTL_EDGE_FUNCTORS_H_INCLUDED_

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