epoc32/include/stdapis/stlportv5/stl/_strstream.h
branchSymbian3
changeset 4 837f303aceeb
parent 3 e1b950c65cb4
     1.1 --- a/epoc32/include/stdapis/stlportv5/stl/_strstream.h	Wed Mar 31 12:27:01 2010 +0100
     1.2 +++ b/epoc32/include/stdapis/stlportv5/stl/_strstream.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -1,61 +1,51 @@
     1.4  /*
     1.5 -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
     1.6 -
     1.7 -* Redistribution and use in source and binary forms, with or without 
     1.8 -* modification, are permitted provided that the following conditions are met:
     1.9 -
    1.10 -* Redistributions of source code must retain the above copyright notice, this 
    1.11 -* list of conditions and the following disclaimer.
    1.12 -* Redistributions in binary form must reproduce the above copyright notice, 
    1.13 -* this list of conditions and the following disclaimer in the documentation 
    1.14 -* and/or other materials provided with the distribution.
    1.15 -* Neither the name of Nokia Corporation nor the names of its contributors 
    1.16 -* may be used to endorse or promote products derived from this software 
    1.17 -* without specific prior written permission.
    1.18 -
    1.19 -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
    1.20 -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
    1.21 -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
    1.22 -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
    1.23 -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
    1.24 -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
    1.25 -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
    1.26 -* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
    1.27 -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
    1.28 -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.29 -*
    1.30 -* Description:
    1.31 -*
    1.32 -*/
    1.33 + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
    1.34 + *
    1.35 + * Copyright (c) 1999
    1.36 + * Silicon Graphics Computer Systems, Inc.
    1.37 + *
    1.38 + * Copyright (c) 1999
    1.39 + * Boris Fomitchev
    1.40 + *
    1.41 + * This material is provided "as is", with absolutely no warranty expressed
    1.42 + * or implied. Any use is at your own risk.
    1.43 + *
    1.44 + * Permission to use or copy this software for any purpose is hereby granted
    1.45 + * without fee, provided the above notices are retained on all copies.
    1.46 + * Permission to modify the code and to distribute modified code is granted,
    1.47 + * provided the above notices are retained, and a notice that the code was
    1.48 + * modified is included with the above copyright notice.
    1.49 + *
    1.50 + */
    1.51 +#ifndef _STLP_INTERNAL_STRSTREAM
    1.52 +#define _STLP_INTERNAL_STRSTREAM
    1.53  
    1.54  #ifndef _STLP_INTERNAL_STREAMBUF
    1.55 -#include <stl/_streambuf.h>
    1.56 +#  include <stl/_streambuf.h>
    1.57  #endif
    1.58 -#ifndef _STLP_ISTREAM
    1.59 -#include <istream>              // Includes <ostream>, <ios>, <iosfwd>
    1.60 +
    1.61 +#ifndef _STLP_INTERNAL_ISTREAM
    1.62 +#  include <stl/_istream.h>              // Includes <ostream>, <ios>, <iosfwd>
    1.63  #endif
    1.64 -#ifndef _STLP_STRING_H
    1.65 -#include <stl/_string.h>
    1.66 +
    1.67 +#ifndef _STLP_INTERNAL_STRING_H
    1.68 +#  include <stl/_string.h>
    1.69  #endif
    1.70  
    1.71  _STLP_BEGIN_NAMESPACE
    1.72  
    1.73  #ifndef _STLP_USE_NAMESPACES
    1.74 -# define strstream _STLP_strstream 
    1.75 -# define ostrstream _STLP_ostrstream
    1.76 -# define istrstream _STLP_istrstream
    1.77 -# define strstreambuf _STLP_strstreambuf
    1.78 +#  define strstream _STLP_strstream
    1.79 +#  define ostrstream _STLP_ostrstream
    1.80 +#  define istrstream _STLP_istrstream
    1.81 +#  define strstreambuf _STLP_strstreambuf
    1.82  #endif
    1.83  
    1.84  //----------------------------------------------------------------------
    1.85  // Class strstreambuf, a streambuf class that manages an array of char.
    1.86  // Note that this class is not a template.
    1.87 -#ifdef __SYMBIAN32__
    1.88 -class strstreambuf : public basic_streambuf<char, char_traits<char> > 
    1.89 -#else
    1.90 -class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf<char, char_traits<char> >
    1.91 -#endif
    1.92 -{
    1.93 +
    1.94 +class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf<char, char_traits<char> > {
    1.95  public:                         // Types.
    1.96    typedef char_traits<char>              _Traits;
    1.97    typedef basic_streambuf<char, char_traits<char> > _Base;
    1.98 @@ -63,7 +53,7 @@
    1.99    typedef void (*__free_fn)(void*);
   1.100  public:                         // Constructor, destructor
   1.101  
   1.102 -  explicit strstreambuf(streamsize _Initial_capacity = 0);
   1.103 +  _STLP_DECLSPEC explicit strstreambuf(streamsize _Initial_capacity = 0);
   1.104  
   1.105    _STLP_DECLSPEC strstreambuf(__alloc_fn, __free_fn);
   1.106  
   1.107 @@ -75,7 +65,7 @@
   1.108    _STLP_DECLSPEC strstreambuf(const signed char* __get, streamsize __n);
   1.109    _STLP_DECLSPEC strstreambuf(const unsigned char* __get, streamsize __n);
   1.110  
   1.111 -  virtual ~strstreambuf();
   1.112 +  _STLP_DECLSPEC virtual ~strstreambuf();
   1.113  
   1.114  public:                         // strstreambuf operations.
   1.115    _STLP_DECLSPEC void freeze(bool = true);
   1.116 @@ -83,20 +73,20 @@
   1.117    _STLP_DECLSPEC int pcount() const;
   1.118  
   1.119  protected:                      // Overridden virtual member functions.
   1.120 -  virtual int_type overflow(int_type __c  = _Traits::eof());
   1.121 -  virtual int_type pbackfail(int_type __c = _Traits::eof());
   1.122 -  virtual int_type underflow();
   1.123 -  virtual _Base* setbuf(char* __buf, streamsize __n);
   1.124 -  virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
   1.125 -                           ios_base::openmode __mode 
   1.126 +  _STLP_DECLSPEC virtual int_type overflow(int_type __c  = _Traits::eof());
   1.127 +  _STLP_DECLSPEC virtual int_type pbackfail(int_type __c = _Traits::eof());
   1.128 +  _STLP_DECLSPEC virtual int_type underflow();
   1.129 +  _STLP_DECLSPEC virtual _Base* setbuf(char* __buf, streamsize __n);
   1.130 +  _STLP_DECLSPEC virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir,
   1.131 +                           ios_base::openmode __mode
   1.132                                        = ios_base::in | ios_base::out);
   1.133 -  virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode 
   1.134 +  _STLP_DECLSPEC virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode
   1.135                                        = ios_base::in | ios_base::out);
   1.136  
   1.137  private:                        // Helper functions.
   1.138    // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun.
   1.139    char* _M_alloc(size_t);
   1.140 -  inline void  _M_free(char*);
   1.141 +  void  _M_free(char*);
   1.142  
   1.143    // Helper function used in constructors.
   1.144    void _M_setup(char* __get, char* __put, streamsize __n);
   1.145 @@ -106,54 +96,19 @@
   1.146    bool _M_dynamic  : 1;
   1.147    bool _M_frozen   : 1;
   1.148    bool _M_constant : 1;
   1.149 -#ifdef __SYMBIAN32__
   1.150 -  char* _pfrozenendsave;
   1.151 -  char* _pgetfrozenendsave;
   1.152 -#endif
   1.153  };
   1.154  
   1.155 -inline strstreambuf::~strstreambuf()
   1.156 -{
   1.157 -#ifdef __SYMBIAN32__
   1.158 -  if (_M_dynamic && !_M_frozen)
   1.159 -  {
   1.160 -  	if (_M_free_fun)
   1.161 -  		_M_free_fun(eback());
   1.162 -  	else
   1.163 -  		_M_free(eback());
   1.164 -  }
   1.165 -#else  
   1.166 -	if (_M_dynamic && !_M_frozen)
   1.167 -        _M_free(eback());
   1.168 -#endif	
   1.169 -}
   1.170 -
   1.171 -inline void strstreambuf::_M_free(char* p)
   1.172 -{
   1.173 -  if (p)
   1.174 -    if (_M_free_fun)
   1.175 -      _M_free_fun(p);
   1.176 -    else
   1.177 -      delete[] p;
   1.178 -}
   1.179 -
   1.180 -
   1.181  //----------------------------------------------------------------------
   1.182  // Class istrstream, an istream that manages a strstreambuf.
   1.183  
   1.184 -#ifdef __SYMBIAN32__
   1.185 -NONSHARABLE_CLASS (istrstream) : public basic_istream<char, char_traits<char> >
   1.186 -#else
   1.187 -class _STLP_CLASS_DECLSPEC istrstream : public basic_istream<char, char_traits<char> >
   1.188 -#endif
   1.189 -{
   1.190 +class _STLP_CLASS_DECLSPEC istrstream : public basic_istream<char, char_traits<char> > {
   1.191  public:
   1.192    _STLP_DECLSPEC explicit istrstream(char*);
   1.193    _STLP_DECLSPEC explicit istrstream(const char*);
   1.194    _STLP_DECLSPEC istrstream(char* , streamsize);
   1.195    _STLP_DECLSPEC istrstream(const char*, streamsize);
   1.196 -  virtual ~istrstream();
   1.197 -  
   1.198 +  _STLP_DECLSPEC virtual ~istrstream();
   1.199 +
   1.200    _STLP_DECLSPEC strstreambuf* rdbuf() const;
   1.201    _STLP_DECLSPEC char* str();
   1.202  
   1.203 @@ -163,16 +118,13 @@
   1.204  
   1.205  //----------------------------------------------------------------------
   1.206  // Class ostrstream
   1.207 -#ifdef __SYMBIAN32__
   1.208 -NONSHARABLE_CLASS (ostrstream) : public basic_ostream<char, char_traits<char> >
   1.209 -#else
   1.210 +
   1.211  class _STLP_CLASS_DECLSPEC ostrstream : public basic_ostream<char, char_traits<char> >
   1.212 -#endif
   1.213  {
   1.214  public:
   1.215    _STLP_DECLSPEC ostrstream();
   1.216    _STLP_DECLSPEC ostrstream(char*, int, ios_base::openmode = ios_base::out);
   1.217 -  virtual ~ostrstream();
   1.218 +  _STLP_DECLSPEC virtual ~ostrstream();
   1.219  
   1.220    _STLP_DECLSPEC strstreambuf* rdbuf() const;
   1.221    _STLP_DECLSPEC void freeze(bool = true);
   1.222 @@ -185,12 +137,8 @@
   1.223  
   1.224  //----------------------------------------------------------------------
   1.225  // Class strstream
   1.226 -#ifdef __SYMBIAN32__
   1.227 -NONSHARABLE_CLASS (strstream) : public basic_iostream<char, char_traits<char> >
   1.228 -#else
   1.229 -class _STLP_CLASS_DECLSPEC strstream : public basic_iostream<char, char_traits<char> >
   1.230 -#endif
   1.231 -{
   1.232 +
   1.233 +class _STLP_CLASS_DECLSPEC strstream : public basic_iostream<char, char_traits<char> > {
   1.234  public:
   1.235    typedef char                        char_type;
   1.236    typedef char_traits<char>::int_type int_type;
   1.237 @@ -199,7 +147,7 @@
   1.238  
   1.239    _STLP_DECLSPEC strstream();
   1.240    _STLP_DECLSPEC strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out);
   1.241 -  virtual ~strstream();
   1.242 +  _STLP_DECLSPEC virtual ~strstream();
   1.243  
   1.244    _STLP_DECLSPEC strstreambuf* rdbuf() const;
   1.245    _STLP_DECLSPEC void freeze(bool = true);
   1.246 @@ -208,6 +156,12 @@
   1.247  
   1.248  private:
   1.249    strstreambuf _M_buf;
   1.250 +
   1.251 +  //explicitely defined as private to avoid warnings:
   1.252 +  strstream(strstream const&);
   1.253 +  strstream& operator = (strstream const&);
   1.254  };
   1.255  
   1.256  _STLP_END_NAMESPACE
   1.257 +
   1.258 +#endif /* _STLP_INTERNAL_STRSTREAM */