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

xst_traced_action_base.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 
00033 // xst_traced_action_base.h
00034 
00035 #ifndef _XST_TRACED_ACTION_BASE_H_INCLUDED_
00036 #define _XST_TRACED_ACTION_BASE_H_INCLUDED_
00037 
00038 namespace cttl_impl {
00039 
00044 class xst_traced_action_base {
00045 
00046 private:
00048     int m_line;
00049 
00051     char const* m_action_name;
00052 
00053 protected:
00055     xst_traced_action_base( int line_, char const* action_name_ )
00056         :
00057         m_line( line_ ),
00058         m_action_name( action_name_ )
00059     {
00060     }
00061 
00063     void trace_prolog() const
00064     {
00065         CTTL_TRACE_DEPOSIT_TEXT( std::endl );
00066         CTTL_TRACE_DEPOSIT_JUSTIFY();
00067         CTTL_TRACE_DEPOSIT_TEXT( m_line );
00068         CTTL_TRACE_DEPOSIT_TEXT( "=>" );
00069         CTTL_TRACE_DEPOSIT_TEXT( m_action_name );
00070         CTTL_TRACE_DEPOSIT_TEXT( std::endl );
00071         xtl_trace_grammar::depth( +1 );
00072         CTTL_TRACE_DEPOSIT_JUSTIFY();
00073     }
00074 
00076     template< typename ArgumentT >
00077     void trace_prolog( ArgumentT const& arg_ ) const
00078     {
00079         CTTL_TRACE_DEPOSIT_TEXT( std::endl );
00080         CTTL_TRACE_DEPOSIT_JUSTIFY();
00081         CTTL_TRACE_DEPOSIT_TEXT( m_line );
00082         CTTL_TRACE_DEPOSIT_TEXT( "=>" );
00083         CTTL_TRACE_DEPOSIT_TEXT( m_action_name );
00084         CTTL_TRACE_DEPOSIT_TEXT( '\'' );
00085         CTTL_TRACE_DEPOSIT_TEXT( xst_scalar_traits< ArgumentT >::identity( arg_ ) );
00086         CTTL_TRACE_DEPOSIT_TEXT( '\'' );
00087         CTTL_TRACE_DEPOSIT_TEXT( std::endl );
00088         xtl_trace_grammar::depth( +1 );
00089         CTTL_TRACE_DEPOSIT_JUSTIFY();
00090     }
00091 
00093     template< typename ResultT >
00094     void trace_epilog( ResultT const& result_ ) const
00095     {
00096         xtl_trace_grammar::depth( -1 );
00097         CTTL_TRACE_DEPOSIT_TEXT( std::endl );
00098         CTTL_TRACE_DEPOSIT_JUSTIFY();
00099         CTTL_TRACE_DEPOSIT_TEXT( m_line );
00100         CTTL_TRACE_DEPOSIT_TEXT( "<=" );
00101         CTTL_TRACE_DEPOSIT_TEXT( m_action_name );
00102         CTTL_TRACE_DEPOSIT_TEXT( ':' );
00103         CTTL_TRACE_DEPOSIT_TEXT( xst_non_scalar_traits< ResultT >::identity( result_ ) );
00104         CTTL_TRACE_DEPOSIT_TEXT( std::endl );
00105         CTTL_TRACE_DEPOSIT_JUSTIFY();
00106     }
00107 
00108 };  // class xst_traced_action_base
00109 
00110 
00111 }   // namespace cttl_impl
00112 
00113 
00114 #endif //_XST_TRACED_ACTION_BASE_H_INCLUDED_

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