# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

string_stream.h

Go to the documentation of this file.
00001 
00007 /* Copyright, 2001 Nevrax Ltd.
00008  *
00009  * This file is part of NEVRAX NEL.
00010  * NEVRAX NEL is free software; you can redistribute it and/or modify
00011  * it under the terms of the GNU General Public License as published by
00012  * the Free Software Foundation; either version 2, or (at your option)
00013  * any later version.
00014 
00015  * NEVRAX NEL is distributed in the hope that it will be useful, but
00016  * WITHOUT ANY WARRANTY; without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00018  * General Public License for more details.
00019 
00020  * You should have received a copy of the GNU General Public License
00021  * along with NEVRAX NEL; see the file COPYING. If not, write to the
00022  * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00023  * MA 02111-1307, USA.
00024  */
00025 
00026 #ifndef NL_STRING_STREAM_H
00027 #define NL_STRING_STREAM_H
00028 
00029 #include "nel/misc/types_nl.h"
00030 #include "nel/misc/mem_stream.h"
00031 
00032 
00033 namespace NLMISC {
00034 
00035 
00042 class CStringStream : public CMemStream
00043 {
00044 public:
00045 
00047         CStringStream( bool inputStream=false, uint32 defaultcapacity=0 ) : CMemStream( inputStream, defaultcapacity ) {}
00048 
00050         CStringStream( const CStringStream& other ) : CMemStream( other ) {}
00051 
00053         CStringStream&          operator=( const CStringStream& other ) { CMemStream::operator=( other ); return *this; }
00054 
00056         uint                    serialSeparatedBufferIn( uint8 *buf, uint len );
00057 
00059         void                    serialSeparatedBufferOut( uint8 *buf, uint len );
00060 
00062         virtual void    serialBit(bool &bit);
00063 
00065     template<class T>
00066         void                    serial(T &obj)                                                  { obj.serial(*this); }
00067 
00068         template<class T>
00069         void                    serialCont(std::vector<T> &cont)                {CMemStream::serialCont(cont);}
00070         template<class T>
00071         void                    serialCont(std::list<T> &cont)                  {CMemStream::serialCont(cont);}
00072         template<class T>
00073         void                    serialCont(std::deque<T> &cont)                 {CMemStream::serialCont(cont);}
00074         template<class T>
00075         void                    serialCont(std::set<T> &cont)                   {CMemStream::serialCont(cont);}
00076         template<class T>
00077         void                    serialCont(std::multiset<T> &cont)              {CMemStream::serialCont(cont);}
00078         template<class K, class T>
00079         void                    serialCont(std::map<K, T> &cont)                {CMemStream::serialCont(cont);}
00080         template<class K, class T>
00081         void                    serialCont(std::multimap<K, T> &cont)   {CMemStream::serialCont(cont);}
00082 
00083         template<class T0,class T1>
00084         void                    serial(T0 &a, T1 &b) 
00085         { serial(a); serial(b);}
00086         template<class T0,class T1,class T2>
00087         void                    serial(T0 &a, T1 &b, T2 &c) 
00088         { serial(a); serial(b); serial(c);}
00089         template<class T0,class T1,class T2,class T3>
00090         void                    serial(T0 &a, T1 &b, T2 &c, T3 &d) 
00091         { serial(a); serial(b); serial(c); serial(d);}
00092         template<class T0,class T1,class T2,class T3,class T4>
00093         void                    serial(T0 &a, T1 &b, T2 &c, T3 &d, T4 &e) 
00094         { serial(a); serial(b); serial(c); serial(d); serial(e);}
00095         template<class T0,class T1,class T2,class T3,class T4,class T5>
00096         void                    serial(T0 &a, T1 &b, T2 &c, T3 &d, T4 &e, T5 &f) 
00097         { serial(a); serial(b); serial(c); serial(d); serial(e); serial(f);}
00098 
00103 
00104         virtual void    serial(uint8 &b) ;
00105         virtual void    serial(sint8 &b) ;
00106         virtual void    serial(uint16 &b) ;
00107         virtual void    serial(sint16 &b) ;
00108         virtual void    serial(uint32 &b) ;
00109         virtual void    serial(sint32 &b) ;
00110         virtual void    serial(uint64 &b) ;
00111         virtual void    serial(sint64 &b) ;
00112         virtual void    serial(float &b) ;
00113         virtual void    serial(double &b) ;
00114         virtual void    serial(bool &b) ;
00115 #ifndef NL_OS_CYGWIN
00116         virtual void    serial(char &b) ;
00117 #endif
00118         virtual void    serial(std::string &b) ;
00119         virtual void    serial(ucstring &b) ;
00121 
00123         virtual void                    serialCont(std::vector<uint8> &cont) { serialVector(cont); }
00125         virtual void                    serialCont(std::vector<sint8> &cont) { serialVector(cont); }
00127         virtual void                    serialCont(std::vector<bool> &cont);
00128 
00130         virtual void    serialHex(uint32 &b);
00131 };
00132 
00133 
00134 } // NLMISC
00135 
00136 
00137 #endif // NL_STRING_STREAM_H
00138 
00139 /* End of string_stream.h */