diff -r e1b950c65cb4 -r 837f303aceeb epoc32/include/stdapis/stlportv5/stl/_strstream.h --- a/epoc32/include/stdapis/stlportv5/stl/_strstream.h Wed Mar 31 12:27:01 2010 +0100 +++ b/epoc32/include/stdapis/stlportv5/stl/_strstream.h Wed Mar 31 12:33:34 2010 +0100 @@ -1,61 +1,51 @@ /* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. - -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following disclaimer. -* Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* Neither the name of Nokia Corporation nor the names of its contributors -* may be used to endorse or promote products derived from this software -* without specific prior written permission. - -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -* Description: -* -*/ + * Portions Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + * + * Copyright (c) 1999 + * Silicon Graphics Computer Systems, Inc. + * + * Copyright (c) 1999 + * Boris Fomitchev + * + * This material is provided "as is", with absolutely no warranty expressed + * or implied. Any use is at your own risk. + * + * Permission to use or copy this software for any purpose is hereby granted + * without fee, provided the above notices are retained on all copies. + * Permission to modify the code and to distribute modified code is granted, + * provided the above notices are retained, and a notice that the code was + * modified is included with the above copyright notice. + * + */ +#ifndef _STLP_INTERNAL_STRSTREAM +#define _STLP_INTERNAL_STRSTREAM #ifndef _STLP_INTERNAL_STREAMBUF -#include +# include #endif -#ifndef _STLP_ISTREAM -#include // Includes , , + +#ifndef _STLP_INTERNAL_ISTREAM +# include // Includes , , #endif -#ifndef _STLP_STRING_H -#include + +#ifndef _STLP_INTERNAL_STRING_H +# include #endif _STLP_BEGIN_NAMESPACE #ifndef _STLP_USE_NAMESPACES -# define strstream _STLP_strstream -# define ostrstream _STLP_ostrstream -# define istrstream _STLP_istrstream -# define strstreambuf _STLP_strstreambuf +# define strstream _STLP_strstream +# define ostrstream _STLP_ostrstream +# define istrstream _STLP_istrstream +# define strstreambuf _STLP_strstreambuf #endif //---------------------------------------------------------------------- // Class strstreambuf, a streambuf class that manages an array of char. // Note that this class is not a template. -#ifdef __SYMBIAN32__ -class strstreambuf : public basic_streambuf > -#else -class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf > -#endif -{ + +class _STLP_CLASS_DECLSPEC strstreambuf : public basic_streambuf > { public: // Types. typedef char_traits _Traits; typedef basic_streambuf > _Base; @@ -63,7 +53,7 @@ typedef void (*__free_fn)(void*); public: // Constructor, destructor - explicit strstreambuf(streamsize _Initial_capacity = 0); + _STLP_DECLSPEC explicit strstreambuf(streamsize _Initial_capacity = 0); _STLP_DECLSPEC strstreambuf(__alloc_fn, __free_fn); @@ -75,7 +65,7 @@ _STLP_DECLSPEC strstreambuf(const signed char* __get, streamsize __n); _STLP_DECLSPEC strstreambuf(const unsigned char* __get, streamsize __n); - virtual ~strstreambuf(); + _STLP_DECLSPEC virtual ~strstreambuf(); public: // strstreambuf operations. _STLP_DECLSPEC void freeze(bool = true); @@ -83,20 +73,20 @@ _STLP_DECLSPEC int pcount() const; protected: // Overridden virtual member functions. - virtual int_type overflow(int_type __c = _Traits::eof()); - virtual int_type pbackfail(int_type __c = _Traits::eof()); - virtual int_type underflow(); - virtual _Base* setbuf(char* __buf, streamsize __n); - virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, - ios_base::openmode __mode + _STLP_DECLSPEC virtual int_type overflow(int_type __c = _Traits::eof()); + _STLP_DECLSPEC virtual int_type pbackfail(int_type __c = _Traits::eof()); + _STLP_DECLSPEC virtual int_type underflow(); + _STLP_DECLSPEC virtual _Base* setbuf(char* __buf, streamsize __n); + _STLP_DECLSPEC virtual pos_type seekoff(off_type __off, ios_base::seekdir __dir, + ios_base::openmode __mode = ios_base::in | ios_base::out); - virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode + _STLP_DECLSPEC virtual pos_type seekpos(pos_type __pos, ios_base::openmode __mode = ios_base::in | ios_base::out); private: // Helper functions. // Dynamic allocation, possibly using _M_alloc_fun and _M_free_fun. char* _M_alloc(size_t); - inline void _M_free(char*); + void _M_free(char*); // Helper function used in constructors. void _M_setup(char* __get, char* __put, streamsize __n); @@ -106,54 +96,19 @@ bool _M_dynamic : 1; bool _M_frozen : 1; bool _M_constant : 1; -#ifdef __SYMBIAN32__ - char* _pfrozenendsave; - char* _pgetfrozenendsave; -#endif }; -inline strstreambuf::~strstreambuf() -{ -#ifdef __SYMBIAN32__ - if (_M_dynamic && !_M_frozen) - { - if (_M_free_fun) - _M_free_fun(eback()); - else - _M_free(eback()); - } -#else - if (_M_dynamic && !_M_frozen) - _M_free(eback()); -#endif -} - -inline void strstreambuf::_M_free(char* p) -{ - if (p) - if (_M_free_fun) - _M_free_fun(p); - else - delete[] p; -} - - //---------------------------------------------------------------------- // Class istrstream, an istream that manages a strstreambuf. -#ifdef __SYMBIAN32__ -NONSHARABLE_CLASS (istrstream) : public basic_istream > -#else -class _STLP_CLASS_DECLSPEC istrstream : public basic_istream > -#endif -{ +class _STLP_CLASS_DECLSPEC istrstream : public basic_istream > { public: _STLP_DECLSPEC explicit istrstream(char*); _STLP_DECLSPEC explicit istrstream(const char*); _STLP_DECLSPEC istrstream(char* , streamsize); _STLP_DECLSPEC istrstream(const char*, streamsize); - virtual ~istrstream(); - + _STLP_DECLSPEC virtual ~istrstream(); + _STLP_DECLSPEC strstreambuf* rdbuf() const; _STLP_DECLSPEC char* str(); @@ -163,16 +118,13 @@ //---------------------------------------------------------------------- // Class ostrstream -#ifdef __SYMBIAN32__ -NONSHARABLE_CLASS (ostrstream) : public basic_ostream > -#else + class _STLP_CLASS_DECLSPEC ostrstream : public basic_ostream > -#endif { public: _STLP_DECLSPEC ostrstream(); _STLP_DECLSPEC ostrstream(char*, int, ios_base::openmode = ios_base::out); - virtual ~ostrstream(); + _STLP_DECLSPEC virtual ~ostrstream(); _STLP_DECLSPEC strstreambuf* rdbuf() const; _STLP_DECLSPEC void freeze(bool = true); @@ -185,12 +137,8 @@ //---------------------------------------------------------------------- // Class strstream -#ifdef __SYMBIAN32__ -NONSHARABLE_CLASS (strstream) : public basic_iostream > -#else -class _STLP_CLASS_DECLSPEC strstream : public basic_iostream > -#endif -{ + +class _STLP_CLASS_DECLSPEC strstream : public basic_iostream > { public: typedef char char_type; typedef char_traits::int_type int_type; @@ -199,7 +147,7 @@ _STLP_DECLSPEC strstream(); _STLP_DECLSPEC strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); - virtual ~strstream(); + _STLP_DECLSPEC virtual ~strstream(); _STLP_DECLSPEC strstreambuf* rdbuf() const; _STLP_DECLSPEC void freeze(bool = true); @@ -208,6 +156,12 @@ private: strstreambuf _M_buf; + + //explicitely defined as private to avoid warnings: + strstream(strstream const&); + strstream& operator = (strstream const&); }; _STLP_END_NAMESPACE + +#endif /* _STLP_INTERNAL_STRSTREAM */