| 1 |
/* Copyright (C) 2015 Povilas Kanapickas <[email protected]> |
| 2 |
|
| 3 |
This file is part of cppreference-doc |
| 4 |
|
| 5 |
This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 |
| 6 |
Unported License. To view a copy of this license, visit |
| 7 |
http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative |
| 8 |
Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. |
| 9 |
|
| 10 |
Permission is granted to copy, distribute and/or modify this document |
| 11 |
under the terms of the GNU Free Documentation License, Version 1.3 or |
| 12 |
any later version published by the Free Software Foundation; with no |
| 13 |
Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. |
| 14 |
*/ |
| 15 |
|
| 16 |
#ifndef CPPREFERENCE_ISTREAM_H |
| 17 |
#define CPPREFERENCE_ISTREAM_H |
| 18 |
|
| 19 |
namespace std { |
| 20 |
|
| 21 |
template < |
| 22 |
class CharT, |
| 23 |
class Traits = std::char_traits<CharT> |
| 24 |
> class basic_istream : virtual public std::basic_ios<CharT, Traits> { |
| 25 |
public: |
| 26 |
explicit basic_istream(std::basic_streambuf<CharT, Traits>* sb); |
| 27 |
virtual ~basic_istream(); |
| 28 |
|
| 29 |
basic_istream& operator>>(short& value); |
| 30 |
basic_istream& operator>>(unsigned short& value); |
| 31 |
basic_istream& operator>>(int& value); |
| 32 |
basic_istream& operator>>(unsigned int& value); |
| 33 |
basic_istream& operator>>(long& value); |
| 34 |
basic_istream& operator>>(unsigned long& value); |
| 35 |
#if CPPREFERENCE_STDVER>= 2011 |
| 36 |
basic_istream& operator>>(long long& value); |
| 37 |
basic_istream& operator>>(unsigned long long& value); |
| 38 |
#endif |
| 39 |
basic_istream& operator>>(float& value); |
| 40 |
basic_istream& operator>>(double& value); |
| 41 |
basic_istream& operator>>(long double& value); |
| 42 |
basic_istream& operator>>(bool& value); |
| 43 |
basic_istream& operator>>(void*& value); |
| 44 |
basic_istream& operator>>(basic_istream& st, |
| 45 |
std::ios_base & (*func)(std::ios_base&)); |
| 46 |
basic_istream& operator>>(basic_istream& st, |
| 47 |
std::basic_ios<CharT, Traits>& (*func)(std::basic_ios<CharT, Traits>&)); |
| 48 |
basic_istream& operator>>(basic_istream& st, |
| 49 |
std::basic_istream & (*func)(std::basic_istream&)); |
| 50 |
basic_istream& operator>>(basic_istream& st, |
| 51 |
std::basic_streambuf<CharT, Traits>* sb); |
| 52 |
|
| 53 |
int_type get(); |
| 54 |
basic_istream& get(char_type& ch); |
| 55 |
basic_istream& get(char_type* s, std::streamsize count); |
| 56 |
basic_istream& get(char_type* s, std::streamsize count, char_type delim); |
| 57 |
basic_istream& get(basic_streambuf& strbuf); |
| 58 |
basic_istream& get(basic_streambuf& strbuf, char_type delim); |
| 59 |
|
| 60 |
int_type peek(); |
| 61 |
basic_istream& unget(); |
| 62 |
basic_istream& putback(char_type ch); |
| 63 |
basic_istream& getline(char_type* s, std::streamsize count); |
| 64 |
basic_istream& getline(char_type* s, std::streamsize count, char_type delim); |
| 65 |
basic_istream& ignore(std::streamsize count = 1, int_type delim = Traits::eof()); |
| 66 |
basic_istream& read(char_type* s, std::streamsize count); |
| 67 |
std::streamsize readsome(char_type* s, std::streamsize count); |
| 68 |
std::streamsize gcount() const; |
| 69 |
pos_type tellg(); |
| 70 |
basic_istream& seekg(pos_type pos); |
| 71 |
basic_istream& seekg(off_type off, std::ios_base::seekdir dir); |
| 72 |
int sync(); |
| 73 |
|
| 74 |
class sentry { |
| 75 |
public: |
| 76 |
typedef Traits traits_type; |
| 77 |
explicit sentry(std::basic_istream<CharT, Traits>& is, bool noskipws = false); |
| 78 |
~sentry(); |
| 79 |
explicit operator bool() const; |
| 80 |
}; |
| 81 |
|
| 82 |
protected: |
| 83 |
#if CPPREFERENCE_STDVER>= 2011 |
| 84 |
basic_istream(const basic_istream& rhs) = delete; |
| 85 |
basic_istream(basic_istream&& rhs); |
| 86 |
#endif |
| 87 |
|
| 88 |
basic_istream& operator=(const basic_istream& rhs) = delete; |
| 89 |
#if CPPREFERENCE_STDVER>= 2011 |
| 90 |
basic_istream& operator=(basic_istream&& rhs); |
| 91 |
void swap(basic_istream& rhs); |
| 92 |
#endif |
| 93 |
}; |
| 94 |
|
| 95 |
typedef basic_istream<char> istream; |
| 96 |
typedef basic_istream<wchar_t> wistream; |
| 97 |
|
| 98 |
extern istream cin; |
| 99 |
extern wistream wcin; |
| 100 |
|
| 101 |
template < |
| 102 |
class CharT, |
| 103 |
class Traits = std::char_traits<CharT> |
| 104 |
> class basic_iostream : public std::basic_istream<CharT, Traits>, |
| 105 |
public basic_ostream<CharT, Traits> { |
| 106 |
public: |
| 107 |
explicit basic_iostream(std::basic_streambuf<CharT, Traits>* sb); |
| 108 |
|
| 109 |
protected: |
| 110 |
#if CPPREFERENCE_STDVER>= 2011 |
| 111 |
basic_iostream(const basic_iostream& other) = delete; |
| 112 |
basic_iostream(basic_iostream&& other); |
| 113 |
#endif |
| 114 |
|
| 115 |
basic_iostream& operator=(const basic_iostream& rhs) = delete; |
| 116 |
#if CPPREFERENCE_STDVER>= 2011 |
| 117 |
basic_iostream& operator=(basic_iostream&& rhs); |
| 118 |
void swap(basic_iostream& rhs); |
| 119 |
#endif |
| 120 |
}; |
| 121 |
|
| 122 |
typedef basic_iostream<char> iostream; |
| 123 |
typedef basic_iostream<wchar_t> wiostream; |
| 124 |
|
| 125 |
template<class CharT, class Traits> |
| 126 |
basic_istream<CharT, Traits>& operator>>(basic_istream<CharT, Traits>& st, CharT& ch); |
| 127 |
|
| 128 |
template<class Traits> |
| 129 |
basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>& st, signed char& ch); |
| 130 |
|
| 131 |
template<class Traits> |
| 132 |
basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>& st, unsigned char& ch); |
| 133 |
|
| 134 |
template<class CharT, class Traits> |
| 135 |
basic_istream<CharT, Traits>& operator>>(basic_istream<CharT, Traits>& st, CharT* s); |
| 136 |
|
| 137 |
template<class Traits> |
| 138 |
basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>& st, signed char* s); |
| 139 |
|
| 140 |
template<class Traits> |
| 141 |
basic_istream<char, Traits>& operator>>(basic_istream<char, Traits>& st, unsigned char* s); |
| 142 |
|
| 143 |
template<class CharT, class Traits, class T> |
| 144 |
basic_istream<CharT, Traits>& operator>>(basic_istream<CharT, Traits>&& st, T& value); |
| 145 |
|
| 146 |
#if CPPREFERENCE_STDVER>= 2011 |
| 147 |
template<class CharT, class Traits> |
| 148 |
std::basic_istream<CharT, Traits>& ws(std::basic_istream<CharT, Traits>& is); |
| 149 |
#endif |
| 150 |
|
| 151 |
} // namespace std |
| 152 |
|
| 153 |
#endif // CPPREFERENCE_ISTREAM_H |