[f7aaffe0] | 1 | /*
|
---|
| 2 | * Copyright (c) 2017 Jaroslav Jindrak
|
---|
| 3 | * All rights reserved.
|
---|
| 4 | *
|
---|
| 5 | * Redistribution and use in source and binary forms, with or without
|
---|
| 6 | * modification, are permitted provided that the following conditions
|
---|
| 7 | * are met:
|
---|
| 8 | *
|
---|
| 9 | * - Redistributions of source code must retain the above copyright
|
---|
| 10 | * notice, this list of conditions and the following disclaimer.
|
---|
| 11 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 12 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 13 | * documentation and/or other materials provided with the distribution.
|
---|
| 14 | * - The name of the author may not be used to endorse or promote products
|
---|
| 15 | * derived from this software without specific prior written permission.
|
---|
| 16 | *
|
---|
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 27 | */
|
---|
| 28 |
|
---|
| 29 | #ifndef LIBCPP_ISTREAM
|
---|
| 30 | #define LIBCPP_ISTREAM
|
---|
| 31 |
|
---|
| 32 | #include <iosfwd>
|
---|
| 33 |
|
---|
| 34 | namespace std
|
---|
| 35 | {
|
---|
[b0d6e2a] | 36 |
|
---|
| 37 | /**
|
---|
| 38 | * 27.7.2.1, class template basic_stream:
|
---|
| 39 | */
|
---|
| 40 |
|
---|
[f7aaffe0] | 41 | template<class Char, class Traits = char_traits<Char>>
|
---|
[b0d6e2a] | 42 | class basic_istream: virtual public basic_ios<Char, Traits>
|
---|
| 43 | {
|
---|
| 44 | public:
|
---|
| 45 | using traits_type = Traits;
|
---|
| 46 | using char_type = Char;
|
---|
| 47 | using int_type = typename traits_type::int_type;
|
---|
| 48 | using pos_type = typename traits_type::pos_type;
|
---|
| 49 | using off_type = typename traits_type::off_type;
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * 27.7.2.1.1, constructor/destructor:
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | explicit basic_istream(basic_streambuf<Char, Traits>* sb)
|
---|
| 56 | {
|
---|
| 57 | // TODO: implement
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | virtual ~basic_stream()
|
---|
| 61 | {
|
---|
| 62 | // TODO: implement
|
---|
| 63 | }
|
---|
| 64 |
|
---|
| 65 | /**
|
---|
| 66 | * 27.7.2.1.3, prefix/suffix:
|
---|
| 67 | */
|
---|
| 68 |
|
---|
| 69 | class sentry;
|
---|
| 70 |
|
---|
| 71 | /**
|
---|
| 72 | * 27.7.2.2, formatted input:
|
---|
| 73 | */
|
---|
| 74 |
|
---|
| 75 | basic_istream<Char, Traits> operator>>(
|
---|
| 76 | basic_istream<Char, Traits>& (*pf)(basic_istream<Char, Traits>&)
|
---|
| 77 | )
|
---|
| 78 | {
|
---|
| 79 | // TODO: implement
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | basic_istream<Char, Traits> operator>>(
|
---|
| 83 | basic_ios<Char, Traits>& (*pf)(basic_ios<Char, Traits>&)
|
---|
| 84 | )
|
---|
| 85 | {
|
---|
| 86 | // TODO: implement
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | basic_istream<Char, Traits> operator>>(
|
---|
| 90 | ios_base& (*pf)(ios_base&)
|
---|
| 91 | )
|
---|
| 92 | {
|
---|
| 93 | // TODO: implement
|
---|
| 94 | }
|
---|
| 95 |
|
---|
| 96 | basic_istream<Char, Traits> operator>>(bool& x)
|
---|
| 97 | {
|
---|
| 98 | // TODO: implement
|
---|
| 99 | }
|
---|
| 100 |
|
---|
| 101 | basic_istream<Char, Traits> operator>>(short& x)
|
---|
| 102 | {
|
---|
| 103 | // TODO: implement
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | basic_istream<Char, Traits> operator>>(unsigned short& x)
|
---|
| 107 | {
|
---|
| 108 | // TODO: implement
|
---|
| 109 | }
|
---|
| 110 |
|
---|
| 111 | basic_istream<Char, Traits> operator>>(int& x)
|
---|
| 112 | {
|
---|
| 113 | // TODO: implement
|
---|
| 114 | }
|
---|
| 115 |
|
---|
| 116 | basic_istream<Char, Traits> operator>>(unsigned int& x)
|
---|
| 117 | {
|
---|
| 118 | // TODO: implement
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | basic_istream<Char, Traits> operator>>(long& x)
|
---|
| 122 | {
|
---|
| 123 | // TODO: implement
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 | basic_istream<Char, Traits> operator>>(unsigned long& x)
|
---|
| 127 | {
|
---|
| 128 | // TODO: implement
|
---|
| 129 | }
|
---|
| 130 |
|
---|
| 131 | basic_istream<Char, Traits> operator>>(long long& x)
|
---|
| 132 | {
|
---|
| 133 | // TODO: implement
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 | basic_istream<Char, Traits> operator>>(unsigned long long& x)
|
---|
| 137 | {
|
---|
| 138 | // TODO: implement
|
---|
| 139 | }
|
---|
| 140 |
|
---|
| 141 | basic_istream<Char, Traits> operator>>(float& x)
|
---|
| 142 | {
|
---|
| 143 | // TODO: implement
|
---|
| 144 | }
|
---|
| 145 |
|
---|
| 146 | basic_istream<Char, Traits> operator>>(double& x)
|
---|
| 147 | {
|
---|
| 148 | // TODO: implement
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | basic_istream<Char, Traits> operator>>(long double& x)
|
---|
| 152 | {
|
---|
| 153 | // TODO: implement
|
---|
| 154 | }
|
---|
| 155 |
|
---|
| 156 | basic_istream<Char, Traits> operator>>(void*& p)
|
---|
| 157 | {
|
---|
| 158 | // TODO: implement
|
---|
| 159 | }
|
---|
| 160 |
|
---|
| 161 | basic_istream<Char, Traits> operator>>(basic_streambuf<Char, Traits>* sb)
|
---|
| 162 | {
|
---|
| 163 | // TODO: implement
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | /**
|
---|
| 167 | * 27.7.2.3, unformatted input:
|
---|
| 168 | */
|
---|
| 169 |
|
---|
| 170 | streamsize gcount() const
|
---|
| 171 | {
|
---|
| 172 | // TODO: implement
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | int_type get()
|
---|
| 176 | {
|
---|
| 177 | // TODO: implement
|
---|
| 178 | }
|
---|
| 179 |
|
---|
| 180 | basic_istream<Char, Traits>& get(char_type& c)
|
---|
| 181 | {
|
---|
| 182 | // TODO: implement
|
---|
| 183 | }
|
---|
| 184 |
|
---|
| 185 | basic_istream<Char, Traits>& get(char_type* s, streamsize n)
|
---|
| 186 | {
|
---|
| 187 | // TODO: implement
|
---|
| 188 | }
|
---|
| 189 |
|
---|
| 190 | basic_istream<Char, Traits>& get(char_type* s, streamsize n, char_type delim)
|
---|
| 191 | {
|
---|
| 192 | // TODO: implement
|
---|
| 193 | }
|
---|
| 194 |
|
---|
| 195 | basic_istream<Char, Traits>& get(basic_streambuf<Char, Traits>& sb)
|
---|
| 196 | {
|
---|
| 197 | // TODO: implement
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | basic_istream<Char, Traits>& get(basic_streambuf<Char, Traits>& sb, char_type delim)
|
---|
| 201 | {
|
---|
| 202 | // TODO: implement
|
---|
| 203 | }
|
---|
| 204 |
|
---|
| 205 | basic_istream<Char, Traits>& getline(char_type* s, streamsize n)
|
---|
| 206 | {
|
---|
| 207 | // TODO: implement
|
---|
| 208 | }
|
---|
| 209 |
|
---|
| 210 | basic_istream<Char, Traits>& getline(char_type* s, streamsize n, char_type delim)
|
---|
| 211 | {
|
---|
| 212 | // TODO: implement
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | basic_istream<Char, Traits>& ignore(streamsize n = 1, int_type delim = traits_type::eof())
|
---|
| 216 | {
|
---|
| 217 | // TODO: implement
|
---|
| 218 | }
|
---|
| 219 |
|
---|
| 220 | int_type peek()
|
---|
| 221 | {
|
---|
| 222 | // TODO: implement
|
---|
| 223 | }
|
---|
| 224 |
|
---|
| 225 | basic_istream<Char, Traits>& read(char_type* s, streamsize n)
|
---|
| 226 | {
|
---|
| 227 | // TODO: implement
|
---|
| 228 | }
|
---|
| 229 |
|
---|
| 230 | streamsize readsome(char_type* s, streamsize n)
|
---|
| 231 | {
|
---|
| 232 | // TODO: implement
|
---|
| 233 | }
|
---|
| 234 |
|
---|
| 235 | basic_istream<Char, Traits>& putback(char_type c)
|
---|
| 236 | {
|
---|
| 237 | // TODO: implement
|
---|
| 238 | }
|
---|
| 239 |
|
---|
| 240 | basic_istream<Char, Traits>& unget()
|
---|
| 241 | {
|
---|
| 242 | // TODO: implement
|
---|
| 243 | }
|
---|
| 244 |
|
---|
| 245 | int sync()
|
---|
| 246 | {
|
---|
| 247 | // TODO: implement
|
---|
| 248 | }
|
---|
| 249 |
|
---|
| 250 | pos_type tellg()
|
---|
| 251 | {
|
---|
| 252 | // TODO: implement
|
---|
| 253 | }
|
---|
| 254 |
|
---|
| 255 | basic_istream<Char, Traits>& seekg(pos_type pos)
|
---|
| 256 | {
|
---|
| 257 | // TODO: implement
|
---|
| 258 | }
|
---|
| 259 |
|
---|
| 260 | basic_istream<Char, Traits>& seekg(off_type off, ios_base::seekdir way)
|
---|
| 261 | {
|
---|
| 262 | // TODO: implement
|
---|
| 263 | }
|
---|
| 264 |
|
---|
| 265 | protected:
|
---|
| 266 | basic_istream(const basic_istream&) = delete;
|
---|
| 267 |
|
---|
| 268 | basic_istream(basic_istream&& rhs)
|
---|
| 269 | {
|
---|
| 270 | // TODO: implement
|
---|
| 271 | }
|
---|
| 272 |
|
---|
| 273 | /**
|
---|
| 274 | * 27.7.2.1.2, assign/swap:
|
---|
| 275 | */
|
---|
| 276 |
|
---|
| 277 | basic_istream& operator=(const basic_istream& rhs) = delete;
|
---|
| 278 |
|
---|
| 279 | basic_istream& operator=(basic_istream&& rhs)
|
---|
| 280 | {
|
---|
| 281 | // TODO: implement
|
---|
| 282 | }
|
---|
| 283 |
|
---|
| 284 | void swap(basic_stream& rhs)
|
---|
| 285 | {
|
---|
| 286 | // TODO: implement
|
---|
| 287 | }
|
---|
| 288 | };
|
---|
| 289 |
|
---|
| 290 | /**
|
---|
| 291 | * 27.7.2.2.3, character extraction templates:
|
---|
| 292 | */
|
---|
| 293 |
|
---|
| 294 | template<class Char, class Traits>
|
---|
| 295 | basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
|
---|
| 296 | Char& c)
|
---|
| 297 | {
|
---|
| 298 | // TODO: implement
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | template<class Char, class Traits>
|
---|
| 302 | basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
|
---|
| 303 | unsigned char& c)
|
---|
| 304 | {
|
---|
| 305 | // TODO: implement
|
---|
| 306 | }
|
---|
| 307 |
|
---|
| 308 | template<class Char, class Traits>
|
---|
| 309 | basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
|
---|
| 310 | signed char& c)
|
---|
| 311 | {
|
---|
| 312 | // TODO: implement
|
---|
| 313 | }
|
---|
| 314 |
|
---|
| 315 | template<class Char, class Traits>
|
---|
| 316 | basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
|
---|
| 317 | Char* c)
|
---|
| 318 | {
|
---|
| 319 | // TODO: implement
|
---|
| 320 | }
|
---|
| 321 |
|
---|
| 322 | template<class Char, class Traits>
|
---|
| 323 | basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
|
---|
| 324 | unsigned char* c)
|
---|
| 325 | {
|
---|
| 326 | // TODO: implement
|
---|
| 327 | }
|
---|
| 328 |
|
---|
| 329 | template<class Char, class Traits>
|
---|
| 330 | basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is,
|
---|
| 331 | signed char* c)
|
---|
| 332 | {
|
---|
| 333 | // TODO: implement
|
---|
| 334 | }
|
---|
[f7aaffe0] | 335 |
|
---|
| 336 | using istream = basic_istream<char>;
|
---|
| 337 | using wistream = basic_istream<wchar_t>;
|
---|
| 338 |
|
---|
| 339 | template<class Char, class Traits = char_traits<Char>>
|
---|
| 340 | class basic_iostream;
|
---|
| 341 |
|
---|
| 342 | using iostream = basic_iostream<char>;
|
---|
| 343 | using wiostream = basic_iostream<wchar_t>;
|
---|
| 344 |
|
---|
| 345 | template<class Char, class Traits = char_traits<Char>>
|
---|
| 346 | basic_istream<Char, Traits>& ws(basic_istream<Char, Traits>& is);
|
---|
| 347 |
|
---|
| 348 | template<class Char, class Tratis = char_traits<Char>>
|
---|
| 349 | basic_istream<Char, Traits>& operator>>(basic_istream<Char, Traits>& is, T& x);
|
---|
| 350 | }
|
---|
| 351 |
|
---|
| 352 | #endif
|
---|