// Input streams -*- C++ -*-
// Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
-// 2006, 2007
+// 2006, 2007, 2008, 2009
// 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)
+// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// 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, 51 Franklin Street, Fifth Floor,
-// Boston, MA 02110-1301, USA.
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
-// 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.
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+// <http://www.gnu.org/licenses/>.
//
// ISO C++ 14882: 27.6.1 Input streams
#pragma GCC system_header
#include <ios>
-#include <locale>
#include <ostream>
-#include <limits> // For numeric_limits
_GLIBCXX_BEGIN_NAMESPACE(std)
// [27.6.1.1] Template class basic_istream
/**
* @brief Controlling input.
+ * @ingroup io
*
* This is the base class for all input streams. It provides text
* formatting of all builtin types, and communicates with any class
__num_get_type;
typedef ctype<_CharT> __ctype_type;
- template<typename _CharT2, typename _Traits2>
- friend basic_istream<_CharT2, _Traits2>&
- operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2&);
-
- template<typename _CharT2, typename _Traits2>
- friend basic_istream<_CharT2, _Traits2>&
- operator>>(basic_istream<_CharT2, _Traits2>&, _CharT2*);
-
protected:
// Data Members:
/**
- * @if maint
* The number of characters extracted in the previous unformatted
* function; see gcount().
- * @endif
*/
streamsize _M_gcount;
* derived classes' initialization lists, which pass a pointer to
* their own stream buffer.
*/
- explicit
- basic_istream(__streambuf_type* __sb): _M_gcount(streamsize(0))
+ explicit
+ basic_istream(__streambuf_type* __sb)
+ : _M_gcount(streamsize(0))
{ this->init(__sb); }
/**
/**
* @brief Interface for manipulators.
*
- * Manuipulators such as @c std::ws and @c std::dec use these
+ * Manipulators such as @c std::ws and @c std::dec use these
* functions in constructs like "std::cin >> std::ws". For more
* information, see the iomanip header.
*/
//@}
protected:
- explicit
- basic_istream(): _M_gcount(streamsize(0)) { }
+ basic_istream()
+ : _M_gcount(streamsize(0))
+ { this->init(0); }
template<typename _ValueT>
__istream_type&
* Objects of this class are created before all of the standard
* extractors are run. It is responsible for "exception-safe prefix and
* suffix operations," although only prefix actions are currently required
- * by the standard. Additional actions may be added by the
- * implementation, and we list them in
- * http://gcc.gnu.org/onlinedocs/libstdc++/17_intro/howto.html#5
- * under [27.6] notes.
+ * by the standard.
*/
template<typename _CharT, typename _Traits>
class basic_istream<_CharT, _Traits>::sentry
{
+ // Data Members.
+ bool _M_ok;
+
public:
/// Easy access to dependant types.
typedef _Traits traits_type;
* If the stream state is still good, then the sentry state becomes
* true ("okay").
*/
- explicit
+ explicit
sentry(basic_istream<_CharT, _Traits>& __is, bool __noskipws = false);
/**
* For ease of use, sentries may be converted to booleans. The
* return value is that of the sentry state (true == okay).
*/
+#ifdef __GXX_EXPERIMENTAL_CXX0X__
+ explicit
+#endif
operator bool() const
{ return _M_ok; }
-
- private:
- bool _M_ok;
};
// [27.6.1.2.3] character extraction templates
// 27.6.1.5 Template class basic_iostream
/**
* @brief Merging istream and ostream capabilities.
+ * @ingroup io
*
* This class multiply inherits from the input and output stream classes
* simply to provide a single interface.
* Both of the parent classes are initialized with the same
* streambuf pointer passed to this constructor.
*/
- explicit
+ explicit
basic_iostream(basic_streambuf<_CharT, _Traits>* __sb)
- : __istream_type(), __ostream_type()
- { this->init(__sb); }
+ : __istream_type(__sb), __ostream_type(__sb) { }
/**
* @brief Destructor does nothing.
~basic_iostream() { }
protected:
- explicit
- basic_iostream() : __istream_type(), __ostream_type()
- { }
+ basic_iostream()
+ : __istream_type(), __ostream_type() { }
};
// [27.6.1.4] standard basic_istream manipulators