epoc32/include/stdapis/stlport/stl/_sstream.h
branchSymbian2
changeset 3 e1b950c65cb4
parent 2 2fe1408b6811
child 4 837f303aceeb
     1.1 --- a/epoc32/include/stdapis/stlport/stl/_sstream.h	Tue Mar 16 16:12:26 2010 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,273 +0,0 @@
     1.4 -/*
     1.5 - * © Portions copyright (c) 2006-2007 Nokia Corporation.  All rights reserved.
     1.6 - * Copyright (c) 1999
     1.7 - * Silicon Graphics Computer Systems, Inc.
     1.8 - *
     1.9 - * Copyright (c) 1999 
    1.10 - * Boris Fomitchev
    1.11 - *
    1.12 - * This material is provided "as is", with absolutely no warranty expressed
    1.13 - * or implied. Any use is at your own risk.
    1.14 - *
    1.15 - * Permission to use or copy this software for any purpose is hereby granted 
    1.16 - * without fee, provided the above notices are retained on all copies.
    1.17 - * Permission to modify the code and to distribute modified code is granted,
    1.18 - * provided the above notices are retained, and a notice that the code was
    1.19 - * modified is included with the above copyright notice.
    1.20 - *
    1.21 - */ 
    1.22 -
    1.23 -
    1.24 -// This header defines classes basic_stringbuf, basic_istringstream,
    1.25 -// basic_ostringstream, and basic_stringstream.  These classes 
    1.26 -// represent streamsbufs and streams whose sources or destinations are
    1.27 -// C++ strings.
    1.28 -
    1.29 -#ifndef _STLP_SSTREAM_H
    1.30 -#define _STLP_SSTREAM_H
    1.31 -
    1.32 -#ifndef _STLP_INTERNAL_STREAMBUF
    1.33 -# include <stl/_streambuf.h>
    1.34 -#endif
    1.35 -
    1.36 -#ifndef _STLP_INTERNAL_ISTREAM_H
    1.37 -# include <stl/_istream.h> // Includes <ostream>, <ios>, <iosfwd>
    1.38 -#endif
    1.39 -
    1.40 -#ifndef _STLP_STRING_H
    1.41 -# include <stl/_string.h>
    1.42 -#endif
    1.43 -
    1.44 -_STLP_BEGIN_NAMESPACE
    1.45 -
    1.46 -//----------------------------------------------------------------------
    1.47 -// This version of basic_stringbuf relies on the internal details of
    1.48 -// basic_string.  It relies on the fact that, in this implementation,
    1.49 -// basic_string's iterators are pointers.  It also assumes (as allowed
    1.50 -// by the standard) that _CharT is a POD type.
    1.51 -
    1.52 -// We have a very small buffer for the put area, just so that we don't
    1.53 -// have to use append() for every sputc.  Conceptually, the buffer
    1.54 -// immediately follows the end of the underlying string.  We use this
    1.55 -// buffer when appending to write-only streambufs, but we don't use it
    1.56 -// for read-write streambufs.
    1.57 -
    1.58 -template <class _CharT, class _Traits, class _Alloc>
    1.59 -#ifdef __SYMBIAN32__
    1.60 -NONSHARABLE_CLASS ( basic_stringbuf ) : public basic_streambuf<_CharT, _Traits>
    1.61 -#else
    1.62 -class basic_stringbuf : public basic_streambuf<_CharT, _Traits>
    1.63 -#endif
    1.64 -{
    1.65 -public:                         // Typedefs.
    1.66 -  typedef _CharT                     char_type;
    1.67 -  typedef typename _Traits::int_type int_type;
    1.68 -  typedef typename _Traits::pos_type pos_type;
    1.69 -  typedef typename _Traits::off_type off_type;
    1.70 -  typedef _Traits                    traits_type;
    1.71 -
    1.72 -  typedef basic_streambuf<_CharT, _Traits>          _Base;
    1.73 -  typedef basic_stringbuf<_CharT, _Traits, _Alloc>  _Self;
    1.74 -  typedef basic_string<_CharT, _Traits, _Alloc>     _String;
    1.75 -
    1.76 -public:                         // Constructors, destructor.
    1.77 -  _STLP_DECLSPEC explicit basic_stringbuf(ios_base::openmode __mode
    1.78 -                                      = ios_base::in | ios_base::out);
    1.79 -  _STLP_DECLSPEC explicit basic_stringbuf(const _String& __s, ios_base::openmode __mode
    1.80 -                                      = ios_base::in | ios_base::out);
    1.81 -  _STLP_DECLSPEC virtual ~basic_stringbuf();
    1.82 -
    1.83 -public:                         // Get or set the string.
    1.84 -  _String str() const { 
    1.85 -      if ( _M_mode & ios_base::out )
    1.86 -           _M_append_buffer();
    1.87 -      return _M_str; 
    1.88 -   }
    1.89 -  _STLP_DECLSPEC void str(const _String& __s);
    1.90 -
    1.91 -protected:                      // Overridden virtual member functions.
    1.92 -  virtual int_type underflow();
    1.93 -  virtual int_type uflow();
    1.94 -  virtual int_type pbackfail(int_type __c);
    1.95 -  virtual int_type overflow(int_type __c);
    1.96 -  int_type pbackfail() {return pbackfail(_Traits::eof());}
    1.97 -  int_type overflow() {return overflow(_Traits::eof());}
    1.98 -
    1.99 -  virtual streamsize xsputn(const char_type* __s, streamsize __n);
   1.100 -  virtual streamsize _M_xsputnc(char_type __c, streamsize __n);
   1.101 -
   1.102 -  virtual _Base* setbuf(_CharT* __buf, streamsize __n);
   1.103 -  virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
   1.104 -                           ios_base::openmode __mode 
   1.105 -                                      = ios_base::in | ios_base::out);
   1.106 -  virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode 
   1.107 -                                      = ios_base::in | ios_base::out);
   1.108 -  ios_base::openmode _M_mode;
   1.109 -
   1.110 -private:                        // Helper functions.
   1.111 -  // Append the internal buffer to the string if necessary.
   1.112 -  void _M_append_buffer() const;
   1.113 -  void _M_set_ptrs();
   1.114 -
   1.115 -private:
   1.116 -  mutable basic_string<_CharT, _Traits, _Alloc> _M_str;
   1.117 -
   1.118 -  enum _JustName { _S_BufSiz = 8 };
   1.119 -  _CharT _M_Buf[ 8 /* _S_BufSiz */];
   1.120 -};
   1.121 -
   1.122 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.123 -_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<char, char_traits<char>, allocator<char> >;
   1.124 -#  if !defined (_STLP_NO_WCHAR_T)
   1.125 -_STLP_EXPORT_TEMPLATE_CLASS basic_stringbuf<wchar_t, char_traits<wchar_t>, allocator<wchar_t>  >;
   1.126 -#  endif
   1.127 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.128 -
   1.129 -//----------------------------------------------------------------------
   1.130 -// Class basic_istringstream, an input stream that uses a stringbuf.
   1.131 -
   1.132 -template <class _CharT, class _Traits, class _Alloc>
   1.133 -#ifdef __SYMBIAN32__
   1.134 -NONSHARABLE_CLASS ( basic_istringstream ) : public basic_istream<_CharT, _Traits>
   1.135 -#else
   1.136 -class basic_istringstream : public basic_istream<_CharT, _Traits>
   1.137 -#endif
   1.138 -{
   1.139 -public:                         // Typedefs
   1.140 -  typedef typename _Traits::char_type   char_type;
   1.141 -  typedef typename _Traits::int_type    int_type;
   1.142 -  typedef typename _Traits::pos_type    pos_type;
   1.143 -  typedef typename _Traits::off_type    off_type;
   1.144 -  typedef _Traits traits_type;
   1.145 -
   1.146 -  typedef basic_ios<_CharT, _Traits>                _Basic_ios;
   1.147 -  typedef basic_istream<_CharT, _Traits>            _Base;
   1.148 -  typedef basic_string<_CharT, _Traits, _Alloc>     _String;
   1.149 -  typedef basic_stringbuf<_CharT, _Traits, _Alloc>  _Buf;
   1.150 -
   1.151 -public:                         // Constructors, destructor.
   1.152 -  basic_istringstream(ios_base::openmode __mode = ios_base::in);
   1.153 -  basic_istringstream(const _String& __str,
   1.154 -                      ios_base::openmode __mode = ios_base::in);
   1.155 -  ~basic_istringstream();
   1.156 -
   1.157 -public:                         // Member functions
   1.158 -
   1.159 -  basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
   1.160 -    { return __CONST_CAST(_Buf*,&_M_buf); }
   1.161 -
   1.162 -  _String str() const { return _M_buf.str(); }
   1.163 -  void str(const _String& __s) { _M_buf.str(__s); }
   1.164 -  
   1.165 -private:
   1.166 -  basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
   1.167 -};
   1.168 -
   1.169 -
   1.170 -//----------------------------------------------------------------------
   1.171 -// Class basic_ostringstream, an output stream that uses a stringbuf.
   1.172 -
   1.173 -template <class _CharT, class _Traits, class _Alloc>
   1.174 -#ifdef __SYMBIAN32__
   1.175 -NONSHARABLE_CLASS ( basic_ostringstream ) : public basic_ostream<_CharT, _Traits>
   1.176 -#else
   1.177 -class basic_ostringstream : public basic_ostream<_CharT, _Traits>
   1.178 -#endif
   1.179 -{
   1.180 -public:                         // Typedefs
   1.181 -  typedef typename _Traits::char_type   char_type;
   1.182 -  typedef typename _Traits::int_type    int_type;
   1.183 -  typedef typename _Traits::pos_type    pos_type;
   1.184 -  typedef typename _Traits::off_type    off_type;
   1.185 -  typedef _Traits traits_type;
   1.186 -
   1.187 -  typedef basic_ios<_CharT, _Traits>                _Basic_ios;
   1.188 -  typedef basic_ostream<_CharT, _Traits>            _Base;
   1.189 -  typedef basic_string<_CharT, _Traits, _Alloc>     _String;
   1.190 -  typedef basic_stringbuf<_CharT, _Traits, _Alloc>  _Buf;
   1.191 -
   1.192 -public:                         // Constructors, destructor.
   1.193 -  basic_ostringstream(ios_base::openmode __mode = ios_base::out);
   1.194 -  basic_ostringstream(const _String& __str,
   1.195 -                      ios_base::openmode __mode = ios_base::out);
   1.196 -  ~basic_ostringstream();
   1.197 -
   1.198 -public:                         // Member functions.
   1.199 -
   1.200 -  basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
   1.201 -    { return __CONST_CAST(_Buf*,&_M_buf); }
   1.202 -
   1.203 -  _String str() const { return _M_buf.str(); }
   1.204 -    void str(const _String& __s) { _M_buf.str(__s); } // dwa 02/07/00 - BUG STOMPER DAVE
   1.205 -
   1.206 -
   1.207 -private:
   1.208 -  basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
   1.209 -};
   1.210 -
   1.211 -
   1.212 -//----------------------------------------------------------------------
   1.213 -// Class basic_stringstream, a bidirectional stream that uses a stringbuf.
   1.214 -
   1.215 -template <class _CharT, class _Traits, class _Alloc>
   1.216 -#ifdef __SYMBIAN32__
   1.217 -NONSHARABLE_CLASS ( basic_stringstream ) : public basic_iostream<_CharT, _Traits>
   1.218 -#else
   1.219 -class basic_stringstream : public basic_iostream<_CharT, _Traits>
   1.220 -#endif
   1.221 -{
   1.222 -public:                         // Typedefs
   1.223 -  typedef typename _Traits::char_type char_type;
   1.224 -  typedef typename _Traits::int_type  int_type;
   1.225 -  typedef typename _Traits::pos_type  pos_type;
   1.226 -  typedef typename _Traits::off_type  off_type;
   1.227 -  typedef _Traits  traits_type;
   1.228 -
   1.229 -  typedef basic_ios<_CharT, _Traits>                 _Basic_ios;
   1.230 -  typedef basic_iostream<_CharT, _Traits>            _Base;
   1.231 -  typedef basic_string<_CharT, _Traits, _Alloc>      _String;
   1.232 -  typedef basic_stringbuf<_CharT, _Traits, _Alloc>  _Buf;
   1.233 -  
   1.234 -  typedef ios_base::openmode openmode;
   1.235 -
   1.236 -public:                         // Constructors, destructor.
   1.237 -  _STLP_DECLSPEC basic_stringstream(openmode __mod = ios_base::in | ios_base::out);
   1.238 -  _STLP_DECLSPEC basic_stringstream(const _String& __str,
   1.239 -                     openmode __mod = ios_base::in | ios_base::out);
   1.240 -  ~basic_stringstream();
   1.241 -
   1.242 -public:                         // Member functions.
   1.243 -
   1.244 -  basic_stringbuf<_CharT, _Traits, _Alloc>* rdbuf() const
   1.245 -    { return __CONST_CAST(_Buf*,&_M_buf); }
   1.246 -
   1.247 -  _String str() const { return _M_buf.str(); }
   1.248 -    void str(const _String& __s) { _M_buf.str(__s); }
   1.249 -
   1.250 -private:
   1.251 -  basic_stringbuf<_CharT, _Traits, _Alloc> _M_buf;
   1.252 -};
   1.253 -
   1.254 -
   1.255 -# if defined (_STLP_USE_TEMPLATE_EXPORT)
   1.256 -_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<char, char_traits<char>, allocator<char> >;
   1.257 -_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<char, char_traits<char>, allocator<char> >;
   1.258 -_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<char, char_traits<char>, allocator<char> >;
   1.259 -#  if !defined (_STLP_NO_WCHAR_T)
   1.260 -_STLP_EXPORT_TEMPLATE_CLASS basic_istringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>  >;
   1.261 -_STLP_EXPORT_TEMPLATE_CLASS basic_ostringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>  >;
   1.262 -_STLP_EXPORT_TEMPLATE_CLASS basic_stringstream<wchar_t, char_traits<wchar_t>, allocator<wchar_t>  >;
   1.263 -#  endif
   1.264 -# endif /* _STLP_USE_TEMPLATE_EXPORT */
   1.265 -
   1.266 -_STLP_END_NAMESPACE
   1.267 -
   1.268 -# if  defined (_STLP_EXPOSE_STREAM_IMPLEMENTATION) && !defined (_STLP_LINK_TIME_INSTANTIATION)
   1.269 -#  include <stl/_sstream.c>
   1.270 -# endif
   1.271 -
   1.272 -#endif /* _STLP_SSTREAM_H */
   1.273 -
   1.274 -// Local Variables:
   1.275 -// mode:C++
   1.276 -// End: