ximol/sstream.hpp

Go to the documentation of this file.
00001 /*****************************************************************************\
00002  *                                                                           *
00003  * library XiMoL                                                             *
00004  * Copyright (C) 2002, 2003, 2004 Florent Tournois                           *
00005  *                                                                           *
00006  * This library is free software; you can redistribute it and/or             *
00007  * modify it under the terms of the GNU Lesser General Public                *
00008  * License as published by the Free Software Foundation; either              *
00009  * version 2.1 of the License, or (at your option) any later version.        *
00010  *                                                                           *
00011  * This library is distributed in the hope that it will be useful,           *
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of            *
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU         *
00014  * Lesser General Public License for more details.                           *
00015  *                                                                           *
00016  * You should have received a copy of the GNU Lesser General Public          *
00017  * License along with this library; if not, write to the Free Software       *
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA   *
00019  *                                                                           *
00020 \*****************************************************************************/
00021 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00022 /** \file 
00023         \brief XML streams declarations.
00024         
00025         \author Tournois Florent
00026         \version 1.0
00027 
00028     $Id: sstream.hpp,v 1.6 2004/02/25 18:58:39 tournois Exp $
00029     $Log: sstream.hpp,v $
00030     Revision 1.6  2004/02/25 18:58:39  tournois
00031     imporve the gcc compatibility.
00032 
00033     Revision 1.5  2004/02/22 10:27:32  tournois
00034     Add some doc.
00035 
00036     Revision 1.4  2004/02/22 09:54:19  tournois
00037     Change years on the copyright.
00038 
00039     Revision 1.3  2003/11/17 22:06:01  tournois
00040     Add traits for relation stream--object.
00041     Change cast.
00042 
00043     Revision 1.2  2003/10/25 13:53:39  hfp
00044     review and separation
00045 
00046     Revision 1.1  2003/10/24 15:53:13  hfp
00047     separation of each public class into one file
00048 
00049   */
00050 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00051 #ifndef XIMOL_SSTREAM_HPP_
00052 #define XIMOL_SSTREAM_HPP_
00053 
00054 #include <ximol/stream.hpp>
00055 
00056 #include <sstream>
00057 
00058 XIMOL_BEGIN_NAMESPACE
00059 
00060 //=============================================================================
00061 /// class xostringstream 
00062 //=============================================================================
00063 class XIMOL_EXPORT xostringstream
00064         : public xostream
00065 {
00066 public: // constructor(s) & destructor
00067         explicit xostringstream(std::ios_base::openmode mode = std::ios_base::out);
00068 
00069         explicit xostringstream(const ::std::basic_string<xchar_t>& str,
00070                                     std::ios_base::openmode mode = std::ios_base::out);
00071 
00072         ~xostringstream();
00073         
00074 public: // methods
00075         ::std::basic_stringbuf<xchar_t>* rdbuf();
00076         ::std::basic_string<xchar_t> str() const;
00077         void str(const ::std::basic_string<xchar_t>& s);
00078         
00079         inline xostream& operator<<(xchar_t c)  { return xostream::operator<<(c); }
00080         inline xostream& operator<<(char c)             { return xostream::operator<<(c); }
00081 
00082 private: // data members
00083         ::std::basic_stringbuf<xchar_t> buf_;
00084 };
00085 
00086 
00087 //=============================================================================
00088 /// class xistringstream 
00089 //=============================================================================
00090 class XIMOL_EXPORT xistringstream
00091         : public xistream
00092 {
00093 public: // constructor(s) & destructor
00094         explicit xistringstream(std::ios_base::openmode mode = std::ios_base::in);
00095 
00096         explicit xistringstream(const ::std::basic_string<xchar_t>& str,
00097                                     std::ios_base::openmode mode = std::ios_base::in);
00098 
00099         ~xistringstream();
00100         
00101 public: // methods
00102         ::std::basic_stringbuf<xchar_t>* rdbuf();
00103         ::std::basic_string<xchar_t> str() const;
00104         void str(const ::std::basic_string<xchar_t>& s);
00105         
00106         inline xistream& operator>>(xchar_t& c) { return xistream::operator>>(c); }
00107         inline xistream& operator>>(char& c)    { return xistream::operator>>(c); }
00108 
00109 private: // data members
00110         ::std::basic_stringbuf<xchar_t> buf_;
00111 };
00112 
00113 
00114 //=============================================================================
00115 /// class xstringstream
00116 //=============================================================================
00117 class XIMOL_EXPORT xstringstream
00118         : public xiostream
00119 {
00120 public: // constructor(s) & destructor
00121         explicit xstringstream(std::ios_base::openmode mode = std::ios_base::in | out);
00122 
00123         explicit xstringstream(const ::std::basic_string<xchar_t>& str,
00124                                    std::ios_base::openmode mode = std::ios_base::in | out);
00125 
00126         ~xstringstream();
00127         
00128 public: // methods
00129         ::std::basic_stringbuf<xchar_t>* rdbuf();
00130         ::std::basic_string<xchar_t> str() const;
00131         void str(const ::std::basic_string<xchar_t>& s);
00132         
00133         inline xostream& operator<<(xchar_t c)  { return xostream::operator<<(c); }
00134         inline xostream& operator<<(char c)             { return xostream::operator<<(c); }
00135         inline xistream& operator>>(xchar_t& c) { return xistream::operator>>(c); }
00136         inline xistream& operator>>(char& c)    { return xistream::operator>>(c); }
00137 
00138 private: // data members
00139         ::std::basic_stringbuf<xchar_t> buf_;
00140 };
00141 
00142 
00143 XIMOL_END_NAMESPACE 
00144 
00145 #endif // #ifndef XIMOL_SSTREAM_HPP_


Donate to the XiMoL project SourceForge.net Logo If you have any questions about XiMoL, you could write to tournois@users.sourceforge.net.