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

xst_storage_adaptor.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_storage_adaptor.h
00034 
00035 #ifndef _XST_STORAGE_ADAPTOR_H_INCLUDED_
00036 #define _XST_STORAGE_ADAPTOR_H_INCLUDED_
00037 
00038 namespace cttl_impl {
00039 
00047 template< typename ValueT >
00048 class xst_storage_adaptor
00049 {
00050 private:
00052     ValueT m_value;
00053 
00054 public:
00056     typedef ValueT value_type;
00057 
00059     typedef ValueT& reference;
00060 
00062     typedef ValueT const& const_reference;
00063 
00065     xst_storage_adaptor()
00066         :
00067     m_value( ValueT() )
00068     {
00069     }
00070 
00072     xst_storage_adaptor( ValueT const& value_ )
00073         :
00074     m_value( value_ )
00075     {
00076     }
00077 
00079     xst_storage_adaptor( xst_storage_adaptor< ValueT > const& other_ )
00080     :
00081     m_value( other_.m_value )
00082     {
00083     }
00084 
00086     void operator=( xst_storage_adaptor< ValueT > const& ) const
00087     {
00088     }
00089 
00091     const_reference const_value() const
00092     {
00093         return m_value;
00094     }
00095 
00097     reference value()
00098     {
00099         return m_value;
00100     }
00101 
00103     static char trace_char()
00104     {
00105         return '_';
00106     }
00107 
00108 }; // class xst_storage_adaptor
00109 
00110 
00118 template< typename ValueT >
00119 class xst_storage_adaptor< ValueT& >
00120 {
00121 private:
00123     ValueT& m_value;
00124 
00125 public:
00127     typedef ValueT value_type;
00128 
00130     typedef ValueT& reference;
00131 
00133     typedef ValueT const& const_reference;
00134 
00136     xst_storage_adaptor( ValueT& value_ )
00137         :
00138     m_value( value_ )
00139     {
00140     }
00141 
00143     void operator=( xst_storage_adaptor< ValueT& > const& ) const
00144     {
00145     }
00146 
00148     const_reference const_value() const
00149     {
00150         return m_value;
00151     }
00152 
00154     reference value() const
00155     {
00156         return m_value;
00157     }
00158 
00160     static char trace_char()
00161     {
00162         return ' ';
00163     }
00164 
00165 }; // class xst_storage_adaptor
00166 
00167 
00175 template< typename ValueT >
00176 class xst_storage_adaptor< ValueT const& >
00177 {
00178 private:
00180     ValueT const& m_value;
00181 
00182 public:
00184     typedef ValueT value_type;
00185 
00187     typedef ValueT& reference;
00188 
00190     typedef ValueT const& const_reference;
00191 
00193     xst_storage_adaptor( ValueT const& value_ )
00194         :
00195     m_value( value_ )
00196     {
00197     }
00198 
00200     void operator=( xst_storage_adaptor< ValueT const& > const& ) const
00201     {
00202     }
00203 
00205     const_reference const_value() const
00206     {
00207         return m_value;
00208     }
00209 
00211     const_reference value() const
00212     {
00213         return m_value;
00214     }
00215 
00217     static char trace_char()
00218     {
00219         return '&';
00220     }
00221 
00222 }; // class xst_storage_adaptor
00223 
00224 
00225 }   // namespace cttl_impl
00226 
00227 #endif // _XST_STORAGE_ADAPTOR_H_INCLUDED_

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