diff options
author | Benjamin Kosnik <bkoz@purist.soma.redhat.com> | 2000-11-21 23:44:50 +0000 |
---|---|---|
committer | Benjamin Kosnik <bkoz@gcc.gnu.org> | 2000-11-21 23:44:50 +0000 |
commit | 63e749a813fed4a7aff6ff5aa6811855deb2bc2c (patch) | |
tree | 66540c35133775ef91c8eb993f863bb3e193f95d /libstdc++-v3/include/backward | |
parent | f45d23308a29f90253329b100d4952fe99adb993 (diff) | |
download | gcc-63e749a813fed4a7aff6ff5aa6811855deb2bc2c.zip gcc-63e749a813fed4a7aff6ff5aa6811855deb2bc2c.tar.gz gcc-63e749a813fed4a7aff6ff5aa6811855deb2bc2c.tar.bz2 |
strstream.h: Replace with...
2000-11-21 Benjamin Kosnik <bkoz@purist.soma.redhat.com>
* include/backward/strstream.h: Replace with...
* include/bits/std_strstream.h: ...this. Move.
* include/backward/complex.h: Remove SGIisms.
* include/backward/streambuf.h: Same.
* include/backward/stream.h: Same.
* include/backward/ostream.h: Same.
* include/backward/istream.h: Same.
* include/backward/iostream.h: Same.
* include/backward/iomanip.h: Same.
* include/backward/fstream.h: Same.
* libsupc++/new.h: Add using declarations for bad_alloc,
nothrow_t, and nothrow, move to ...
* include/backward/new.h: ...here.
From-SVN: r37631
Diffstat (limited to 'libstdc++-v3/include/backward')
-rw-r--r-- | libstdc++-v3/include/backward/complex.h | 15 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/fstream.h | 17 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/iomanip.h | 17 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/iostream.h | 37 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/istream.h | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/new.h | 49 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/ostream.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/stream.h | 2 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/streambuf.h | 7 | ||||
-rw-r--r-- | libstdc++-v3/include/backward/strstream.h | 197 |
10 files changed, 225 insertions, 125 deletions
diff --git a/libstdc++-v3/include/backward/complex.h b/libstdc++-v3/include/backward/complex.h index 97e0852..055eef9 100644 --- a/libstdc++-v3/include/backward/complex.h +++ b/libstdc++-v3/include/backward/complex.h @@ -1,4 +1,3 @@ - // Copyright (C) 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -29,18 +28,14 @@ #ifndef _CPP_BACKWARD_COMPLEX_H #define _CPP_BACKWARD_COMPLEX_H 1 -#include <bits/stl_config.h> #include <bits/std_complex.h> -#ifdef __STL_USE_NAMESPACES -using __STD::complex; -#endif /* __STL_USE_NAMESPACES */ - -typedef complex<float> float_complex; -typedef complex<double> double_complex; -typedef complex<long double> long_double_complex; +using std::complex; +typedef complex<float> float_complex; +typedef complex<double> double_complex; +typedef complex<long double> long_double_complex; -#endif /* _CPP_BACKWARD_COMPLEX_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/fstream.h b/libstdc++-v3/include/backward/fstream.h index a346faf..b98ee3c 100644 --- a/libstdc++-v3/include/backward/fstream.h +++ b/libstdc++-v3/include/backward/fstream.h @@ -30,20 +30,17 @@ #include <bits/std_fstream.h> -#ifdef __STL_USE_NAMESPACES -using __STD::ifstream; -using __STD::ofstream; -using __STD::fstream; +using std::ifstream; +using std::ofstream; +using std::fstream; #ifdef _GLIBCPP_USE_WCHAR_T -using __STD::wifstream; -using __STD::wofstream; -using __STD::wfstream; +using std::wifstream; +using std::wofstream; +using std::wfstream; #endif -#endif /* __STL_USE_NAMESPACES */ - -#endif /* _CPP_BACKWARD_FSTREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/iomanip.h b/libstdc++-v3/include/backward/iomanip.h index 206a388..76b209c 100644 --- a/libstdc++-v3/include/backward/iomanip.h +++ b/libstdc++-v3/include/backward/iomanip.h @@ -1,4 +1,3 @@ - // Copyright (C) 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -32,16 +31,14 @@ #include <backward/iostream.h> #include <bits/std_iomanip.h> -#ifdef __STL_USE_NAMESPACES -using __STD::resetiosflags; -using __STD::setiosflags; -using __STD::setbase; -using __STD::setfill; -using __STD::setprecision; -using __STD::setw; -#endif /* __STL_USE_NAMESPACES */ +using std::resetiosflags; +using std::setiosflags; +using std::setbase; +using std::setfill; +using std::setprecision; +using std::setw; -#endif /* _CPP_BACKWARD_IOMANIP_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/iostream.h b/libstdc++-v3/include/backward/iostream.h index 2caee39..7656bce 100644 --- a/libstdc++-v3/include/backward/iostream.h +++ b/libstdc++-v3/include/backward/iostream.h @@ -1,4 +1,3 @@ - // Copyright (C) 1997-1999, 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -31,29 +30,27 @@ #include <bits/std_iostream.h> -#ifdef __STL_USE_NAMESPACES -using __STD::iostream; -using __STD::ostream; -using __STD::istream; -using __STD::ios; -using __STD::streambuf; - -using __STD::cout; -using __STD::cin; -using __STD::cerr; -using __STD::clog; +using std::iostream; +using std::ostream; +using std::istream; +using std::ios; +using std::streambuf; + +using std::cout; +using std::cin; +using std::cerr; +using std::clog; #ifdef _GLIBCPP_USE_WCHAR_T -using __STD::wcout; -using __STD::wcin; -using __STD::wcerr; -using __STD::wclog; +using std::wcout; +using std::wcin; +using std::wcerr; +using std::wclog; #endif -using __STD::endl; -using __STD::ends; -#endif /* __STL_USE_NAMESPACES */ +using std::endl; +using std::ends; -#endif /* _CPP_BACKWARD_IOSTREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/istream.h b/libstdc++-v3/include/backward/istream.h index f457092..c80c474 100644 --- a/libstdc++-v3/include/backward/istream.h +++ b/libstdc++-v3/include/backward/istream.h @@ -30,8 +30,13 @@ #include <backward/iostream.h> -#endif /* _CPP_BACKWARD_ISTREAM_H */ +#endif // Local Variables: // mode:C++ // End: + + + + + diff --git a/libstdc++-v3/include/backward/new.h b/libstdc++-v3/include/backward/new.h index 20e57de..f04e358 100644 --- a/libstdc++-v3/include/backward/new.h +++ b/libstdc++-v3/include/backward/new.h @@ -1,21 +1,22 @@ +// -*- C++ -*- forwarding header. +// Copyright (C) 2000 Free Software Foundation -// Copyright (C) 1997-1999 Free Software Foundation, Inc. +// This file is part of GNU CC. // -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) +// GNU CC is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2, or (at your option) // any later version. - -// This library is distributed in the hope that it will be useful, +// +// GNU CC is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. +// +// You should have received a copy of the GNU General Public License +// along with GNU CC; see the file COPYING. If not, write to +// the Free Software Foundation, 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. // As a special exception, you may use this file as part of a free software // library without restriction. Specifically, if other files instantiate @@ -26,21 +27,15 @@ // invalidate any other reasons why the executable file might be covered by // the GNU General Public License. -#ifndef _CPP_BACKWARD_NEW_H -#define _CPP_BACKWARD_NEW_H 1 - -#include <bits/std_new.h> +#ifndef __NEW_H__ +#define __NEW_H__ -#ifdef __STL_USE_NAMESPACES -using __STD::bad_alloc; -using __STD::nothrow_t; -using __STD::nothrow; -using __STD::new_handler; -using __STD::set_new_handler; -#endif /* __STL_USE_NAMESPACES */ +#include <new> -#endif /* _CPP_BACKWARD_NEW_H */ +using std::bad_alloc; +using std::nothrow_t; +using std::nothrow; +using std::new_handler; +using std::set_new_handler; -// Local Variables: -// mode:C++ -// End: +#endif // __NEW_H__ diff --git a/libstdc++-v3/include/backward/ostream.h b/libstdc++-v3/include/backward/ostream.h index 740588a..aa129b5 100644 --- a/libstdc++-v3/include/backward/ostream.h +++ b/libstdc++-v3/include/backward/ostream.h @@ -30,7 +30,7 @@ #include <backward/iostream.h> -#endif /* _CPP_BACKWARD_OSTREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/stream.h b/libstdc++-v3/include/backward/stream.h index f829b0d..0207f69 100644 --- a/libstdc++-v3/include/backward/stream.h +++ b/libstdc++-v3/include/backward/stream.h @@ -30,7 +30,7 @@ #include <backward/iostream.h> -#endif /* _CPP_BACKWARD_STREAM_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/streambuf.h b/libstdc++-v3/include/backward/streambuf.h index 9bb7646..a0df9f6 100644 --- a/libstdc++-v3/include/backward/streambuf.h +++ b/libstdc++-v3/include/backward/streambuf.h @@ -1,4 +1,3 @@ - // Copyright (C) 2000 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free @@ -31,11 +30,9 @@ #include <bits/std_streambuf.h> -#ifdef __STL_USE_NAMESPACES -using __STD::streambuf; -#endif /* __STL_USE_NAMESPACES */ +using std::streambuf; -#endif /* _CPP_BACKWARD_STREAMBUF_H */ +#endif // Local Variables: // mode:C++ diff --git a/libstdc++-v3/include/backward/strstream.h b/libstdc++-v3/include/backward/strstream.h index f693fcd..0a6a129 100644 --- a/libstdc++-v3/include/backward/strstream.h +++ b/libstdc++-v3/include/backward/strstream.h @@ -1,44 +1,161 @@ -// Copyright (C) 2000 Free Software Foundation, Inc. -// -// This file is part of the GNU ISO C++ Library. This library is free -// software; you can redistribute it and/or modify it under the -// terms of the GNU General Public License as published by the -// Free Software Foundation; either version 2, or (at your option) -// any later version. - -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License along -// with this library; see the file COPYING. If not, write to the Free -// Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, -// USA. - -// As a special exception, you may use this file as part of a free software -// library without restriction. Specifically, if other files instantiate -// templates or use macros or inline functions from this file, or you compile -// this file and link it with other files to produce an executable, this -// file does not by itself cause the resulting executable to be covered by -// the GNU General Public License. This exception does not however -// invalidate any other reasons why the executable file might be covered by -// the GNU General Public License. - -#ifndef _CPP_BACKWARD_STRSTREAM_H -#define _CPP_BACKWARD_STRSTREAM_H 1 - -#include <bits/std_strstream.h> - -#ifdef __STL_USE_NAMESPACES -using __STD::strstreambuf; -using __STD::istrstream; -using __STD::ostrstream; -using __STD::strstream; -#endif /* __STL_USE_NAMESPACES */ - -#endif /* _CPP_BACKWARD_STRSTREAM_H */ +/* + * Copyright (c) 1998 + * Silicon Graphics Computer Systems, Inc. + * + * Permission to use, copy, modify, distribute and sell this software + * and its documentation for any purpose is hereby granted without fee, + * provided that the above copyright notice appear in all copies and + * that both that copyright notice and this permission notice appear + * in supporting documentation. Silicon Graphics makes no + * representations about the suitability of this software for any + * purpose. It is provided "as is" without express or implied warranty. + */ + +// WARNING: The classes defined in this header are DEPRECATED. This +// header is defined in section D.7.1 of the C++ standard, and it +// MAY BE REMOVED in a future standard revision. You should use the +// header <sstream> instead. + +#ifndef __SGI_STL_STRSTREAM +#define __SGI_STL_STRSTREAM + +#if defined(__sgi) && !defined(__GNUC__) && !defined(_STANDARD_C_PLUS_PLUS) +#error This header file requires the -LANG:std option +#endif + +#include <bits/std_iosfwd.h> +#include <bits/std_ios.h> +#include <bits/std_istream.h> +#include <bits/std_ostream.h> +#include <bits/std_string.h> + +__STL_BEGIN_NAMESPACE + +//---------------------------------------------------------------------- +// Class strstreambuf, a streambuf class that manages an array of char. +// Note that this class is not a template. + +class strstreambuf : public basic_streambuf<char, char_traits<char> > +{ +public: // Types. + typedef char_traits<char> _Traits; + typedef basic_streambuf<char, _Traits> _Base; + +public: // Constructor, destructor + explicit strstreambuf(streamsize __initial_capacity = 0); + strstreambuf(void* (*__alloc)(size_t), void (*__free)(void*)); + + strstreambuf(char* __get, streamsize __n, char* __put = 0); + strstreambuf(signed char* __get, streamsize __n, signed char* __put = 0); + strstreambuf(unsigned char* __get, streamsize __n, unsigned char* __put=0); + + strstreambuf(const char* __get, streamsize __n); + strstreambuf(const signed char* __get, streamsize __n); + strstreambuf(const unsigned char* __get, streamsize __n); + + virtual ~strstreambuf(); + +public: // strstreambuf operations. + void freeze(bool = true); + char* str(); + 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 + = ios_base::in | ios_base::out); + 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); + void _M_free(char*); + + // Helper function used in constructors. + void _M_setup(char* __get, char* __put, streamsize __n); + +private: // Data members. + void* (*_M_alloc_fun)(size_t); + void (*_M_free_fun)(void*); + + bool _M_dynamic : 1; + bool _M_frozen : 1; + bool _M_constant : 1; +}; + +//---------------------------------------------------------------------- +// Class istrstream, an istream that manages a strstreambuf. + +class istrstream : public basic_istream<char> +{ +public: + explicit istrstream(char*); + explicit istrstream(const char*); + istrstream(char* , streamsize); + istrstream(const char*, streamsize); + virtual ~istrstream(); + + strstreambuf* rdbuf() const; + char* str(); + +private: + strstreambuf _M_buf; +}; + +//---------------------------------------------------------------------- +// Class ostrstream + +class ostrstream : public basic_ostream<char> +{ +public: + ostrstream(); + ostrstream(char*, int, ios_base::openmode = ios_base::out); + virtual ~ostrstream(); + + strstreambuf* rdbuf() const; + void freeze(bool = true); + char* str(); + int pcount() const; + +private: + strstreambuf _M_buf; +}; + +//---------------------------------------------------------------------- +// Class strstream + +class strstream : public basic_iostream<char> +{ +public: + typedef char char_type; + typedef char_traits<char>::int_type int_type; + typedef char_traits<char>::pos_type pos_type; + typedef char_traits<char>::off_type off_type; + + strstream(); + strstream(char*, int, ios_base::openmode = ios_base::in | ios_base::out); + virtual ~strstream(); + + strstreambuf* rdbuf() const; + void freeze(bool = true); + int pcount() const; + char* str(); + +private: + strstreambuf _M_buf; +}; + +__STL_END_NAMESPACE + +#endif /* __SGI_STL_STRSTREAM */ // Local Variables: // mode:C++ // End: + + |