list.hpp

См. документацию.
00001 /*
00002 
00003 oess_1: Object Entity Serialization & Stability
00004 Yauheni A. Akhotnikau (C) 2002-2006
00005 eao197@yahoo.com
00006 -------------------------------------------------
00007 
00008 Permission is granted to anyone to use this software for any purpose on any
00009 computer system, and to redistribute it freely, subject to the following
00010 restrictions:
00011 
00012 1. This software is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00015 
00016 2. The origin of this software must not be misrepresented, either by
00017    explicit claim or by omission.
00018 
00019 3. Altered versions must be plainly marked as such, and must not be
00020    misrepresented as being the original software.
00021 
00022 -------------------------------------------------
00023 
00024 */
00025 
00032 #if !defined( OESS_1__IO__CUSTOM__STL__LIST_HPP )
00033 #define OESS_1__IO__CUSTOM__STL__LIST_HPP
00034 
00035 #include <list>
00036 
00037 #include <oess_1/defs/h/quantity.hpp>
00038 
00039 #include <oess_1/io/h/stream.hpp>
00040 
00041 namespace oess_1
00042 {
00043 
00044 namespace io
00045 {
00046 
00051 template< class T >
00052 oess_1::io::istream_t &
00053 operator>>( oess_1::io::istream_t & s, std::list< T > & o )
00054   {
00055     oess_1::defs::quantity_t q;
00056     s >> q;
00057     std::list< T > tmp_list;
00058     for( oess_1::uint_t c = q.value(); c; --c )
00059       {
00060         T next;
00061         s >> next;
00062         tmp_list.push_back( next );
00063       }
00064 
00065     tmp_list.swap( o );
00066 
00067     return s;
00068   }
00069 
00074 template< class T >
00075 oess_1::io::ostream_t &
00076 operator<<( oess_1::io::ostream_t & s, const std::list< T > & o )
00077   {
00078     oess_1::defs::quantity_t q( o.size() );
00079     s << q;
00080     for( typename std::list< T >::const_iterator i = o.begin(), end = o.end();
00081         i != end; ++i )
00082       {
00083         s << *i;
00084       }
00085     return s;
00086   }
00087 
00088 } /* namespace io */
00089 
00090 } /* namespace oess_1 */
00091 
00092 #endif
00093 

Документация по ObjESSty. Последние изменения: Fri Oct 13 18:35:36 2006. Создано системой  doxygen 1.4.7
Hosted by uCoz