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

xst_edge_translator.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 
00034 // xst_edge_translator.h
00035 
00036 #ifndef _XST_EDGE_TRANSLATOR_H_INCLUDED_
00037 #define _XST_EDGE_TRANSLATOR_H_INCLUDED_
00038 
00039 namespace cttl_impl {
00040 
00055 template< typename PolicyT, typename StringT >
00056 class xst_edge_translator
00057 {
00058 public:
00060     typedef typename StringT::value_type char_T;
00061 
00062 private:
00064     cttl::const_edge< PolicyT, StringT > const& m_edge;
00065 
00067     StringT m_value;
00068 
00069 public:
00071     xst_edge_translator( cttl::const_edge< PolicyT, StringT > const& edge_ )
00072         :
00073     m_edge( edge_ )
00074     {
00075     }
00076 
00078     xst_edge_translator( xst_edge_translator< PolicyT, StringT > const& other_ )
00079         :
00080     m_edge( other_.m_edge )
00081     {
00082     }
00083 
00085     void operator=( xst_edge_translator< PolicyT, StringT > const& ) const
00086     {
00087     }
00088 
00095     template< typename InputValueT >
00096     char_T const* operator() ( InputValueT const& )
00097     {
00098         trace_deposit();
00099         m_value = m_edge.text();
00100         return m_value.c_str();
00101     }
00102 
00103 private:
00105     void trace_deposit()
00106     {
00107         CTTL_TRACE_DEPOSIT_TEXT( "edge(" );
00108         CTTL_TRACE_DEPOSIT_TEXT( m_edge.first.identity() );
00109         CTTL_TRACE_DEPOSIT_TEXT( ',' );
00110         CTTL_TRACE_DEPOSIT_TEXT( m_edge.second.identity() );
00111         CTTL_TRACE_DEPOSIT_TEXT( ")@" );
00112         CTTL_TRACE_DEPOSIT_TEXT( m_edge.first.offset() );
00113         CTTL_TRACE_DEPOSIT_TEXT( '-' );
00114         CTTL_TRACE_DEPOSIT_TEXT( m_edge.second.offset() );
00115         CTTL_TRACE_DEPOSIT_TEXT( " \"" );
00116         CTTL_TRACE_DEPOSIT_MONOSPACE_TEXT( m_edge.text().c_str() );
00117         CTTL_TRACE_DEPOSIT_TEXT( "\" " );
00118     }
00119 
00120 }; // class xst_edge_translator
00121 
00122 }   // namespace cttl_impl
00123 
00124 
00125 #endif //_XST_EDGE_TRANSLATOR_H_INCLUDED_

Generated on Thu Nov 2 17:48:22 2006 for CTTL Lambda Expression by  doxygen 1.3.9.1