ximol/sstream.cpp

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 implementations.
00024         
00025         \author Tournois Florent
00026         \version 1.0
00027 
00028     $Id: sstream.cpp,v 1.5 2004/02/25 18:58:39 tournois Exp $
00029     $Log: sstream.cpp,v $
00030     Revision 1.5  2004/02/25 18:58:39  tournois
00031     imporve the gcc compatibility.
00032 
00033     Revision 1.4  2004/02/22 10:27:32  tournois
00034     Add some doc.
00035 
00036     Revision 1.3  2004/02/22 09:54:19  tournois
00037     Change years on the copyright.
00038 
00039     Revision 1.2  2003/10/25 13:53:39  hfp
00040     review and separation
00041 
00042     Revision 1.1  2003/10/24 15:53:13  hfp
00043     separation of each public class into one file
00044 
00045   */
00046 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00047 #include <ximol/sstream.hpp>
00048 #include <ximol/encoders/encoders.hpp>
00049 
00050 
00051 XIMOL_ENCODERS_USING_NAMESPACE;
00052 
00053 
00054 XIMOL_BEGIN_NAMESPACE
00055 
00056 
00057 //-----------------------------------------------------------------------------
00058 //
00059 //-----------------------------------------------------------------------------
00060 xostringstream::xostringstream(std::ios_base::openmode mode)
00061   :buf_(mode)
00062 {
00063         this->init(&buf_);
00064         prepare_ios(*this);
00065         encoding(XIMOL_DEFAULT_ENCODING);
00066 }
00067 
00068 //-----------------------------------------------------------------------------
00069 //
00070 //-----------------------------------------------------------------------------
00071 xostringstream::xostringstream(const ::std::basic_string<xchar_t>& str, std::ios_base::openmode mode)
00072   :buf_(mode)
00073 {
00074         this->init(&buf_);
00075         prepare_ios(*this);
00076         encoding(XIMOL_DEFAULT_ENCODING);
00077         this->str(str);
00078 }
00079 
00080 //-----------------------------------------------------------------------------
00081 //
00082 //-----------------------------------------------------------------------------
00083 xostringstream::~xostringstream()
00084 {
00085 }
00086 
00087 //-----------------------------------------------------------------------------
00088 //
00089 //-----------------------------------------------------------------------------
00090 ::std::basic_stringbuf<xchar_t>* xostringstream::rdbuf()
00091 {
00092         return &buf_;
00093 }
00094 
00095 //-----------------------------------------------------------------------------
00096 //
00097 //-----------------------------------------------------------------------------
00098 ::std::basic_string<xchar_t> xostringstream::str() const
00099 {
00100         return buf_.str();
00101 }
00102 
00103 //-----------------------------------------------------------------------------
00104 //
00105 //-----------------------------------------------------------------------------
00106 void xostringstream::str(const ::std::basic_string<xchar_t>& s)
00107 {
00108         buf_.str(s);
00109 }
00110 
00111 //-----------------------------------------------------------------------------
00112 //
00113 //-----------------------------------------------------------------------------
00114 xistringstream::xistringstream(std::ios_base::openmode mode)
00115   :buf_(mode)
00116 {
00117         this->init(&buf_);
00118         prepare_ios(*this);
00119         encoding(XIMOL_DEFAULT_ENCODING);
00120 }
00121 
00122 //-----------------------------------------------------------------------------
00123 //
00124 //-----------------------------------------------------------------------------
00125 xistringstream::xistringstream(const ::std::basic_string<xchar_t>& str, std::ios_base::openmode mode)
00126   :buf_(mode)
00127 {
00128         this->init(&buf_);
00129         prepare_ios(*this);
00130         encoding(XIMOL_DEFAULT_ENCODING);
00131         this->str(str);
00132 }
00133 
00134 //-----------------------------------------------------------------------------
00135 //
00136 //-----------------------------------------------------------------------------
00137 xistringstream::~xistringstream()
00138 {
00139 }
00140 
00141 //-----------------------------------------------------------------------------
00142 //
00143 //-----------------------------------------------------------------------------
00144 ::std::basic_stringbuf<xchar_t>* xistringstream::rdbuf()
00145 {
00146         return &buf_;
00147 }
00148 
00149 //-----------------------------------------------------------------------------
00150 //
00151 //-----------------------------------------------------------------------------
00152 ::std::basic_string<xchar_t> xistringstream::str() const
00153 {
00154         return buf_.str();
00155 }
00156 
00157 //-----------------------------------------------------------------------------
00158 //
00159 //-----------------------------------------------------------------------------
00160 void xistringstream::str(const ::std::basic_string<xchar_t>& s)
00161 {
00162         buf_.str(s);
00163 }
00164 
00165 //-----------------------------------------------------------------------------
00166 //
00167 //-----------------------------------------------------------------------------
00168 xstringstream::xstringstream(std::ios_base::openmode mode)
00169   :xiostream()
00170   ,buf_(mode)
00171 {
00172         this->init(&buf_);
00173         prepare_ios(*this);
00174         xostream::encoding(XIMOL_DEFAULT_ENCODING);
00175         xistream::encoding(XIMOL_DEFAULT_ENCODING);
00176 }
00177 
00178 //-----------------------------------------------------------------------------
00179 //
00180 //-----------------------------------------------------------------------------
00181 xstringstream::xstringstream(const ::std::basic_string<xchar_t>& str, std::ios_base::openmode mode)
00182   :buf_(mode)
00183 {
00184         this->init(&buf_);
00185         prepare_ios(*this);
00186         xostream::encoding(XIMOL_DEFAULT_ENCODING);
00187         xistream::encoding(XIMOL_DEFAULT_ENCODING);
00188         this->str(str);
00189 }
00190 
00191 //-----------------------------------------------------------------------------
00192 //
00193 //-----------------------------------------------------------------------------
00194 xstringstream::~xstringstream()
00195 {
00196 }
00197 
00198 //-----------------------------------------------------------------------------
00199 //
00200 //-----------------------------------------------------------------------------
00201 ::std::basic_stringbuf<xchar_t>* xstringstream::rdbuf()
00202 {
00203         return &buf_;
00204 }
00205 
00206 //-----------------------------------------------------------------------------
00207 //
00208 //-----------------------------------------------------------------------------
00209 ::std::basic_string<xchar_t> xstringstream::str() const
00210 {
00211         return buf_.str();
00212 }
00213 
00214 //-----------------------------------------------------------------------------
00215 //
00216 //-----------------------------------------------------------------------------
00217 void xstringstream::str(const ::std::basic_string<xchar_t>& s)
00218 {
00219         buf_.str(s);
00220 }
00221 
00222 
00223 XIMOL_END_NAMESPACE


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