Coverage Report

Created: 2020-02-15 09:57

/Users/buildslave/jenkins/workspace/coverage/llvm-project/libcxx/include/ios
Line
Count
Source (jump to first uncovered line)
1
// -*- C++ -*-
2
//===---------------------------- ios -------------------------------------===//
3
//
4
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5
// See https://llvm.org/LICENSE.txt for license information.
6
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7
//
8
//===----------------------------------------------------------------------===//
9
10
#ifndef _LIBCPP_IOS
11
#define _LIBCPP_IOS
12
13
/*
14
    ios synopsis
15
16
#include <iosfwd>
17
18
namespace std
19
{
20
21
typedef OFF_T streamoff;
22
typedef SZ_T streamsize;
23
template <class stateT> class fpos;
24
25
class ios_base
26
{
27
public:
28
    class failure;
29
30
    typedef T1 fmtflags;
31
    static constexpr fmtflags boolalpha;
32
    static constexpr fmtflags dec;
33
    static constexpr fmtflags fixed;
34
    static constexpr fmtflags hex;
35
    static constexpr fmtflags internal;
36
    static constexpr fmtflags left;
37
    static constexpr fmtflags oct;
38
    static constexpr fmtflags right;
39
    static constexpr fmtflags scientific;
40
    static constexpr fmtflags showbase;
41
    static constexpr fmtflags showpoint;
42
    static constexpr fmtflags showpos;
43
    static constexpr fmtflags skipws;
44
    static constexpr fmtflags unitbuf;
45
    static constexpr fmtflags uppercase;
46
    static constexpr fmtflags adjustfield;
47
    static constexpr fmtflags basefield;
48
    static constexpr fmtflags floatfield;
49
50
    typedef T2 iostate;
51
    static constexpr iostate badbit;
52
    static constexpr iostate eofbit;
53
    static constexpr iostate failbit;
54
    static constexpr iostate goodbit;
55
56
    typedef T3 openmode;
57
    static constexpr openmode app;
58
    static constexpr openmode ate;
59
    static constexpr openmode binary;
60
    static constexpr openmode in;
61
    static constexpr openmode out;
62
    static constexpr openmode trunc;
63
64
    typedef T4 seekdir;
65
    static constexpr seekdir beg;
66
    static constexpr seekdir cur;
67
    static constexpr seekdir end;
68
69
    class Init;
70
71
    // 27.5.2.2 fmtflags state:
72
    fmtflags flags() const;
73
    fmtflags flags(fmtflags fmtfl);
74
    fmtflags setf(fmtflags fmtfl);
75
    fmtflags setf(fmtflags fmtfl, fmtflags mask);
76
    void unsetf(fmtflags mask);
77
78
    streamsize precision() const;
79
    streamsize precision(streamsize prec);
80
    streamsize width() const;
81
    streamsize width(streamsize wide);
82
83
    // 27.5.2.3 locales:
84
    locale imbue(const locale& loc);
85
    locale getloc() const;
86
87
    // 27.5.2.5 storage:
88
    static int xalloc();
89
    long& iword(int index);
90
    void*& pword(int index);
91
92
    // destructor
93
    virtual ~ios_base();
94
95
    // 27.5.2.6 callbacks;
96
    enum event { erase_event, imbue_event, copyfmt_event };
97
    typedef void (*event_callback)(event, ios_base&, int index);
98
    void register_callback(event_callback fn, int index);
99
100
    ios_base(const ios_base&) = delete;
101
    ios_base& operator=(const ios_base&) = delete;
102
103
    static bool sync_with_stdio(bool sync = true);
104
105
protected:
106
    ios_base();
107
};
108
109
template <class charT, class traits = char_traits<charT> >
110
class basic_ios
111
    : public ios_base
112
{
113
public:
114
    // types:
115
    typedef charT char_type;
116
    typedef typename traits::int_type int_type;  // removed in C++17
117
    typedef typename traits::pos_type pos_type;  // removed in C++17
118
    typedef typename traits::off_type off_type;  // removed in C++17
119
    typedef traits traits_type;
120
121
    operator unspecified-bool-type() const;
122
    bool operator!() const;
123
    iostate rdstate() const;
124
    void clear(iostate state = goodbit);
125
    void setstate(iostate state);
126
    bool good() const;
127
    bool eof() const;
128
    bool fail() const;
129
    bool bad() const;
130
131
    iostate exceptions() const;
132
    void exceptions(iostate except);
133
134
    // 27.5.4.1 Constructor/destructor:
135
    explicit basic_ios(basic_streambuf<charT,traits>* sb);
136
    virtual ~basic_ios();
137
138
    // 27.5.4.2 Members:
139
    basic_ostream<charT,traits>* tie() const;
140
    basic_ostream<charT,traits>* tie(basic_ostream<charT,traits>* tiestr);
141
142
    basic_streambuf<charT,traits>* rdbuf() const;
143
    basic_streambuf<charT,traits>* rdbuf(basic_streambuf<charT,traits>* sb);
144
145
    basic_ios& copyfmt(const basic_ios& rhs);
146
147
    char_type fill() const;
148
    char_type fill(char_type ch);
149
150
    locale imbue(const locale& loc);
151
152
    char narrow(char_type c, char dfault) const;
153
    char_type widen(char c) const;
154
155
    basic_ios(const basic_ios& ) = delete;
156
    basic_ios& operator=(const basic_ios&) = delete;
157
158
protected:
159
    basic_ios();
160
    void init(basic_streambuf<charT,traits>* sb);
161
    void move(basic_ios& rhs);
162
    void swap(basic_ios& rhs) noexcept;
163
    void set_rdbuf(basic_streambuf<charT, traits>* sb);
164
};
165
166
// 27.5.5, manipulators:
167
ios_base& boolalpha (ios_base& str);
168
ios_base& noboolalpha(ios_base& str);
169
ios_base& showbase (ios_base& str);
170
ios_base& noshowbase (ios_base& str);
171
ios_base& showpoint (ios_base& str);
172
ios_base& noshowpoint(ios_base& str);
173
ios_base& showpos (ios_base& str);
174
ios_base& noshowpos (ios_base& str);
175
ios_base& skipws (ios_base& str);
176
ios_base& noskipws (ios_base& str);
177
ios_base& uppercase (ios_base& str);
178
ios_base& nouppercase(ios_base& str);
179
ios_base& unitbuf (ios_base& str);
180
ios_base& nounitbuf (ios_base& str);
181
182
// 27.5.5.2 adjustfield:
183
ios_base& internal (ios_base& str);
184
ios_base& left (ios_base& str);
185
ios_base& right (ios_base& str);
186
187
// 27.5.5.3 basefield:
188
ios_base& dec (ios_base& str);
189
ios_base& hex (ios_base& str);
190
ios_base& oct (ios_base& str);
191
192
// 27.5.5.4 floatfield:
193
ios_base& fixed (ios_base& str);
194
ios_base& scientific (ios_base& str);
195
ios_base& hexfloat (ios_base& str);
196
ios_base& defaultfloat(ios_base& str);
197
198
// 27.5.5.5 error reporting:
199
enum class io_errc
200
{
201
    stream = 1
202
};
203
204
concept_map ErrorCodeEnum<io_errc> { };
205
error_code make_error_code(io_errc e) noexcept;
206
error_condition make_error_condition(io_errc e) noexcept;
207
storage-class-specifier const error_category& iostream_category() noexcept;
208
209
}  // std
210
211
*/
212
213
#include <__config>
214
#include <iosfwd>
215
#include <__locale>
216
#include <system_error>
217
218
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
219
#include <atomic>     // for __xindex_
220
#endif
221
222
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
223
#pragma GCC system_header
224
#endif
225
226
_LIBCPP_BEGIN_NAMESPACE_STD
227
228
typedef ptrdiff_t streamsize;
229
230
class _LIBCPP_TYPE_VIS ios_base
231
{
232
public:
233
    class _LIBCPP_EXCEPTION_ABI failure;
234
235
    typedef unsigned int fmtflags;
236
    static const fmtflags boolalpha   = 0x0001;
237
    static const fmtflags dec         = 0x0002;
238
    static const fmtflags fixed       = 0x0004;
239
    static const fmtflags hex         = 0x0008;
240
    static const fmtflags internal    = 0x0010;
241
    static const fmtflags left        = 0x0020;
242
    static const fmtflags oct         = 0x0040;
243
    static const fmtflags right       = 0x0080;
244
    static const fmtflags scientific  = 0x0100;
245
    static const fmtflags showbase    = 0x0200;
246
    static const fmtflags showpoint   = 0x0400;
247
    static const fmtflags showpos     = 0x0800;
248
    static const fmtflags skipws      = 0x1000;
249
    static const fmtflags unitbuf     = 0x2000;
250
    static const fmtflags uppercase   = 0x4000;
251
    static const fmtflags adjustfield = left | right | internal;
252
    static const fmtflags basefield   = dec | oct | hex;
253
    static const fmtflags floatfield  = scientific | fixed;
254
255
    typedef unsigned int iostate;
256
    static const iostate badbit  = 0x1;
257
    static const iostate eofbit  = 0x2;
258
    static const iostate failbit = 0x4;
259
    static const iostate goodbit = 0x0;
260
261
    typedef unsigned int openmode;
262
    static const openmode app    = 0x01;
263
    static const openmode ate    = 0x02;
264
    static const openmode binary = 0x04;
265
    static const openmode in     = 0x08;
266
    static const openmode out    = 0x10;
267
    static const openmode trunc  = 0x20;
268
269
    enum seekdir {beg, cur, end};
270
271
#if _LIBCPP_STD_VER <= 14
272
    typedef iostate      io_state;
273
    typedef openmode     open_mode;
274
    typedef seekdir      seek_dir;
275
276
    typedef _VSTD::streamoff streamoff;
277
    typedef _VSTD::streampos streampos;
278
#endif
279
280
    class _LIBCPP_TYPE_VIS Init;
281
282
    // 27.5.2.2 fmtflags state:
283
    _LIBCPP_INLINE_VISIBILITY fmtflags flags() const;
284
    _LIBCPP_INLINE_VISIBILITY fmtflags flags(fmtflags __fmtfl);
285
    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl);
286
    _LIBCPP_INLINE_VISIBILITY fmtflags setf(fmtflags __fmtfl, fmtflags __mask);
287
    _LIBCPP_INLINE_VISIBILITY void unsetf(fmtflags __mask);
288
289
    _LIBCPP_INLINE_VISIBILITY streamsize precision() const;
290
    _LIBCPP_INLINE_VISIBILITY streamsize precision(streamsize __prec);
291
    _LIBCPP_INLINE_VISIBILITY streamsize width() const;
292
    _LIBCPP_INLINE_VISIBILITY streamsize width(streamsize __wide);
293
294
    // 27.5.2.3 locales:
295
    locale imbue(const locale& __loc);
296
    locale getloc() const;
297
298
    // 27.5.2.5 storage:
299
    static int xalloc();
300
    long& iword(int __index);
301
    void*& pword(int __index);
302
303
    // destructor
304
    virtual ~ios_base();
305
306
    // 27.5.2.6 callbacks;
307
    enum event { erase_event, imbue_event, copyfmt_event };
308
    typedef void (*event_callback)(event, ios_base&, int __index);
309
    void register_callback(event_callback __fn, int __index);
310
311
private:
312
    ios_base(const ios_base&); // = delete;
313
    ios_base& operator=(const ios_base&); // = delete;
314
315
public:
316
    static bool sync_with_stdio(bool __sync = true);
317
318
    _LIBCPP_INLINE_VISIBILITY iostate rdstate() const;
319
    void clear(iostate __state = goodbit);
320
    _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state);
321
322
    _LIBCPP_INLINE_VISIBILITY bool good() const;
323
    _LIBCPP_INLINE_VISIBILITY bool eof() const;
324
    _LIBCPP_INLINE_VISIBILITY bool fail() const;
325
    _LIBCPP_INLINE_VISIBILITY bool bad() const;
326
327
    _LIBCPP_INLINE_VISIBILITY iostate exceptions() const;
328
    _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate);
329
330
    void __set_badbit_and_consider_rethrow();
331
    void __set_failbit_and_consider_rethrow();
332
333
    _LIBCPP_INLINE_VISIBILITY
334
    void __setstate_nothrow(iostate __state)
335
0
    {
336
0
        if (__rdbuf_)
337
0
            __rdstate_ |= __state;
338
0
        else
339
0
            __rdstate_ |= __state | ios_base::badbit;
340
0
    }
341
342
protected:
343
    _LIBCPP_INLINE_VISIBILITY
344
17.9M
    ios_base() {// purposefully does no initialization
345
17.9M
               }
346
347
    void init(void* __sb);
348
480M
    _LIBCPP_INLINE_VISIBILITY void* rdbuf() const {return __rdbuf_;}
349
350
    _LIBCPP_INLINE_VISIBILITY
351
    void rdbuf(void* __sb)
352
0
    {
353
0
        __rdbuf_ = __sb;
354
0
        clear();
355
0
    }
356
357
    void __call_callbacks(event);
358
    void copyfmt(const ios_base&);
359
    void move(ios_base&);
360
    void swap(ios_base&) _NOEXCEPT;
361
362
    _LIBCPP_INLINE_VISIBILITY
363
    void set_rdbuf(void* __sb)
364
0
    {
365
0
        __rdbuf_ = __sb;
366
0
    }
367
368
private:
369
    // All data members must be scalars
370
    fmtflags        __fmtflags_;
371
    streamsize      __precision_;
372
    streamsize      __width_;
373
    iostate         __rdstate_;
374
    iostate         __exceptions_;
375
    void*           __rdbuf_;
376
    void*           __loc_;
377
    event_callback* __fn_;
378
    int*            __index_;
379
    size_t          __event_size_;
380
    size_t          __event_cap_;
381
// TODO(EricWF): Enable this for both Clang and GCC. Currently it is only
382
// enabled with clang.
383
#if defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_NO_THREADS)
384
    static atomic<int> __xindex_;
385
#else
386
    static int      __xindex_;
387
#endif
388
    long*           __iarray_;
389
    size_t          __iarray_size_;
390
    size_t          __iarray_cap_;
391
    void**          __parray_;
392
    size_t          __parray_size_;
393
    size_t          __parray_cap_;
394
};
395
396
//enum class io_errc
397
_LIBCPP_DECLARE_STRONG_ENUM(io_errc)
398
{
399
    stream = 1
400
};
401
_LIBCPP_DECLARE_STRONG_ENUM_EPILOG(io_errc)
402
403
template <>
404
struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc> : public true_type { };
405
406
#ifdef _LIBCPP_HAS_NO_STRONG_ENUMS
407
template <>
408
struct _LIBCPP_TEMPLATE_VIS is_error_code_enum<io_errc::__lx> : public true_type { };
409
#endif
410
411
_LIBCPP_FUNC_VIS
412
const error_category& iostream_category() _NOEXCEPT;
413
414
inline _LIBCPP_INLINE_VISIBILITY
415
error_code
416
make_error_code(io_errc __e) _NOEXCEPT
417
0
{
418
0
    return error_code(static_cast<int>(__e), iostream_category());
419
0
}
420
421
inline _LIBCPP_INLINE_VISIBILITY
422
error_condition
423
make_error_condition(io_errc __e) _NOEXCEPT
424
0
{
425
0
    return error_condition(static_cast<int>(__e), iostream_category());
426
0
}
427
428
class _LIBCPP_EXCEPTION_ABI ios_base::failure
429
    : public system_error
430
{
431
public:
432
    explicit failure(const string& __msg, const error_code& __ec = io_errc::stream);
433
    explicit failure(const char* __msg, const error_code& __ec = io_errc::stream);
434
    virtual ~failure() throw();
435
};
436
437
_LIBCPP_NORETURN inline _LIBCPP_INLINE_VISIBILITY
438
0
void __throw_failure(char const* __msg) {
439
0
#ifndef _LIBCPP_NO_EXCEPTIONS
440
0
    throw ios_base::failure(__msg);
441
#else
442
    ((void)__msg);
443
    _VSTD::abort();
444
#endif
445
}
446
447
class _LIBCPP_TYPE_VIS ios_base::Init
448
{
449
public:
450
    Init();
451
    ~Init();
452
};
453
454
// fmtflags
455
456
inline _LIBCPP_INLINE_VISIBILITY
457
ios_base::fmtflags
458
ios_base::flags() const
459
456M
{
460
456M
    return __fmtflags_;
461
456M
}
462
463
inline _LIBCPP_INLINE_VISIBILITY
464
ios_base::fmtflags
465
ios_base::flags(fmtflags __fmtfl)
466
0
{
467
0
    fmtflags __r = __fmtflags_;
468
0
    __fmtflags_ = __fmtfl;
469
0
    return __r;
470
0
}
471
472
inline _LIBCPP_INLINE_VISIBILITY
473
ios_base::fmtflags
474
ios_base::setf(fmtflags __fmtfl)
475
35.5k
{
476
35.5k
    fmtflags __r = __fmtflags_;
477
35.5k
    __fmtflags_ |= __fmtfl;
478
35.5k
    return __r;
479
35.5k
}
480
481
inline _LIBCPP_INLINE_VISIBILITY
482
void
483
ios_base::unsetf(fmtflags __mask)
484
{
485
    __fmtflags_ &= ~__mask;
486
}
487
488
inline _LIBCPP_INLINE_VISIBILITY
489
ios_base::fmtflags
490
ios_base::setf(fmtflags __fmtfl, fmtflags __mask)
491
{
492
    fmtflags __r = __fmtflags_;
493
    unsetf(__mask);
494
    __fmtflags_ |= __fmtfl & __mask;
495
    return __r;
496
}
497
498
// precision
499
500
inline _LIBCPP_INLINE_VISIBILITY
501
streamsize
502
ios_base::precision() const
503
0
{
504
0
    return __precision_;
505
0
}
506
507
inline _LIBCPP_INLINE_VISIBILITY
508
streamsize
509
ios_base::precision(streamsize __prec)
510
{
511
    streamsize __r = __precision_;
512
    __precision_ = __prec;
513
    return __r;
514
}
515
516
// width
517
518
inline _LIBCPP_INLINE_VISIBILITY
519
streamsize
520
ios_base::width() const
521
218M
{
522
218M
    return __width_;
523
218M
}
524
525
inline _LIBCPP_INLINE_VISIBILITY
526
streamsize
527
ios_base::width(streamsize __wide)
528
218M
{
529
218M
    streamsize __r = __width_;
530
218M
    __width_ = __wide;
531
218M
    return __r;
532
218M
}
533
534
// iostate
535
536
inline _LIBCPP_INLINE_VISIBILITY
537
ios_base::iostate
538
ios_base::rdstate() const
539
0
{
540
0
    return __rdstate_;
541
0
}
542
543
inline _LIBCPP_INLINE_VISIBILITY
544
void
545
ios_base::setstate(iostate __state)
546
51.6k
{
547
51.6k
    clear(__rdstate_ | __state);
548
51.6k
}
549
550
inline _LIBCPP_INLINE_VISIBILITY
551
bool
552
ios_base::good() const
553
476M
{
554
476M
    return __rdstate_ == 0;
555
476M
}
556
557
inline _LIBCPP_INLINE_VISIBILITY
558
bool
559
ios_base::eof() const
560
{
561
    return (__rdstate_ & eofbit) != 0;
562
}
563
564
inline _LIBCPP_INLINE_VISIBILITY
565
bool
566
ios_base::fail() const
567
47.6k
{
568
47.6k
    return (__rdstate_ & (failbit | badbit)) != 0;
569
47.6k
}
570
571
inline _LIBCPP_INLINE_VISIBILITY
572
bool
573
ios_base::bad() const
574
0
{
575
0
    return (__rdstate_ & badbit) != 0;
576
0
}
577
578
inline _LIBCPP_INLINE_VISIBILITY
579
ios_base::iostate
580
ios_base::exceptions() const
581
0
{
582
0
    return __exceptions_;
583
0
}
584
585
inline _LIBCPP_INLINE_VISIBILITY
586
void
587
ios_base::exceptions(iostate __iostate)
588
0
{
589
0
    __exceptions_ = __iostate;
590
0
    clear(__rdstate_);
591
0
}
592
593
#if defined(_LIBCPP_CXX03_LANG)
594
struct _LIBCPP_TYPE_VIS __cxx03_bool {
595
  typedef void (__cxx03_bool::*__bool_type)();
596
  void __true_value() {}
597
};
598
#endif
599
600
template <class _CharT, class _Traits>
601
class _LIBCPP_TEMPLATE_VIS basic_ios
602
    : public ios_base
603
{
604
public:
605
    // types:
606
    typedef _CharT char_type;
607
    typedef _Traits traits_type;
608
609
    typedef typename traits_type::int_type int_type;
610
    typedef typename traits_type::pos_type pos_type;
611
    typedef typename traits_type::off_type off_type;
612
613
    static_assert((is_same<_CharT, typename traits_type::char_type>::value),
614
                  "traits_type::char_type must be the same type as CharT");
615
616
  // __true_value will generate undefined references when linking unless
617
  // we give it internal linkage.
618
619
#if defined(_LIBCPP_CXX03_LANG)
620
    _LIBCPP_INLINE_VISIBILITY
621
    operator __cxx03_bool::__bool_type() const {
622
        return !fail() ? &__cxx03_bool::__true_value : nullptr;
623
    }
624
#else
625
    _LIBCPP_INLINE_VISIBILITY
626
    _LIBCPP_EXPLICIT operator bool() const {return !fail();}
627
#endif
628
629
    _LIBCPP_INLINE_VISIBILITY bool operator!() const    {return  fail();}
630
0
    _LIBCPP_INLINE_VISIBILITY iostate rdstate() const   {return ios_base::rdstate();}
Unexecuted instantiation: std::__1::basic_ios<char, std::__1::char_traits<char> >::rdstate() const
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::rdstate() const
631
0
    _LIBCPP_INLINE_VISIBILITY void clear(iostate __state = goodbit) {ios_base::clear(__state);}
Unexecuted instantiation: std::__1::basic_ios<char, std::__1::char_traits<char> >::clear(unsigned int)
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::clear(unsigned int)
632
51.6k
    _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state) {ios_base::setstate(__state);}
std::__1::basic_ios<char, std::__1::char_traits<char> >::setstate(unsigned int)
Line
Count
Source
632
51.6k
    _LIBCPP_INLINE_VISIBILITY void setstate(iostate __state) {ios_base::setstate(__state);}
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::setstate(unsigned int)
633
476M
    _LIBCPP_INLINE_VISIBILITY bool good() const {return ios_base::good();}
std::__1::basic_ios<char, std::__1::char_traits<char> >::good() const
Line
Count
Source
633
476M
    _LIBCPP_INLINE_VISIBILITY bool good() const {return ios_base::good();}
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::good() const
Line
Count
Source
633
20.0k
    _LIBCPP_INLINE_VISIBILITY bool good() const {return ios_base::good();}
634
    _LIBCPP_INLINE_VISIBILITY bool eof() const  {return ios_base::eof();}
635
47.6k
    _LIBCPP_INLINE_VISIBILITY bool fail() const {return ios_base::fail();}
std::__1::basic_ios<char, std::__1::char_traits<char> >::fail() const
Line
Count
Source
635
47.6k
    _LIBCPP_INLINE_VISIBILITY bool fail() const {return ios_base::fail();}
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::fail() const
636
    _LIBCPP_INLINE_VISIBILITY bool bad() const  {return ios_base::bad();}
637
638
0
    _LIBCPP_INLINE_VISIBILITY iostate exceptions() const {return ios_base::exceptions();}
Unexecuted instantiation: std::__1::basic_ios<char, std::__1::char_traits<char> >::exceptions() const
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::exceptions() const
639
0
    _LIBCPP_INLINE_VISIBILITY void exceptions(iostate __iostate) {ios_base::exceptions(__iostate);}
Unexecuted instantiation: std::__1::basic_ios<char, std::__1::char_traits<char> >::exceptions(unsigned int)
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::exceptions(unsigned int)
640
641
    // 27.5.4.1 Constructor/destructor:
642
    _LIBCPP_INLINE_VISIBILITY
643
    explicit basic_ios(basic_streambuf<char_type,traits_type>* __sb);
644
    virtual ~basic_ios();
645
646
    // 27.5.4.2 Members:
647
    _LIBCPP_INLINE_VISIBILITY
648
    basic_ostream<char_type, traits_type>* tie() const;
649
    _LIBCPP_INLINE_VISIBILITY
650
    basic_ostream<char_type, traits_type>* tie(basic_ostream<char_type, traits_type>* __tiestr);
651
652
    _LIBCPP_INLINE_VISIBILITY
653
    basic_streambuf<char_type, traits_type>* rdbuf() const;
654
    _LIBCPP_INLINE_VISIBILITY
655
    basic_streambuf<char_type, traits_type>* rdbuf(basic_streambuf<char_type, traits_type>* __sb);
656
657
    basic_ios& copyfmt(const basic_ios& __rhs);
658
659
    _LIBCPP_INLINE_VISIBILITY
660
    char_type fill() const;
661
    _LIBCPP_INLINE_VISIBILITY
662
    char_type fill(char_type __ch);
663
664
    _LIBCPP_INLINE_VISIBILITY
665
    locale imbue(const locale& __loc);
666
667
    _LIBCPP_INLINE_VISIBILITY
668
    char narrow(char_type __c, char __dfault) const;
669
    _LIBCPP_INLINE_VISIBILITY
670
    char_type widen(char __c) const;
671
672
protected:
673
    _LIBCPP_INLINE_VISIBILITY
674
17.9M
    basic_ios() {// purposefully does no initialization
675
17.9M
                }
std::__1::basic_ios<char, std::__1::char_traits<char> >::basic_ios()
Line
Count
Source
674
17.9M
    basic_ios() {// purposefully does no initialization
675
17.9M
                }
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::basic_ios()
Line
Count
Source
674
20.0k
    basic_ios() {// purposefully does no initialization
675
20.0k
                }
676
    _LIBCPP_INLINE_VISIBILITY
677
    void init(basic_streambuf<char_type, traits_type>* __sb);
678
679
    _LIBCPP_INLINE_VISIBILITY
680
    void move(basic_ios& __rhs);
681
#ifndef _LIBCPP_CXX03_LANG
682
    _LIBCPP_INLINE_VISIBILITY
683
    void move(basic_ios&& __rhs) {move(__rhs);}
684
#endif
685
    _LIBCPP_INLINE_VISIBILITY
686
    void swap(basic_ios& __rhs) _NOEXCEPT;
687
    _LIBCPP_INLINE_VISIBILITY
688
    void set_rdbuf(basic_streambuf<char_type, traits_type>* __sb);
689
private:
690
    basic_ostream<char_type, traits_type>* __tie_;
691
    mutable int_type __fill_;
692
};
693
694
template <class _CharT, class _Traits>
695
inline _LIBCPP_INLINE_VISIBILITY
696
basic_ios<_CharT, _Traits>::basic_ios(basic_streambuf<char_type,traits_type>* __sb)
697
{
698
    init(__sb);
699
}
700
701
template <class _CharT, class _Traits>
702
basic_ios<_CharT, _Traits>::~basic_ios()
703
15.2M
{
704
15.2M
}
std::__1::basic_ios<char, std::__1::char_traits<char> >::~basic_ios()
Line
Count
Source
703
15.2M
{
704
15.2M
}
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::~basic_ios()
705
706
template <class _CharT, class _Traits>
707
inline _LIBCPP_INLINE_VISIBILITY
708
void
709
basic_ios<_CharT, _Traits>::init(basic_streambuf<char_type, traits_type>* __sb)
710
17.9M
{
711
17.9M
    ios_base::init(__sb);
712
17.9M
    __tie_ = 0;
713
17.9M
    __fill_ = traits_type::eof();
714
17.9M
}
std::__1::basic_ios<char, std::__1::char_traits<char> >::init(std::__1::basic_streambuf<char, std::__1::char_traits<char> >*)
Line
Count
Source
710
17.9M
{
711
17.9M
    ios_base::init(__sb);
712
17.9M
    __tie_ = 0;
713
17.9M
    __fill_ = traits_type::eof();
714
17.9M
}
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::init(std::__1::basic_streambuf<wchar_t, std::__1::char_traits<wchar_t> >*)
Line
Count
Source
710
20.0k
{
711
20.0k
    ios_base::init(__sb);
712
20.0k
    __tie_ = 0;
713
20.0k
    __fill_ = traits_type::eof();
714
20.0k
}
715
716
template <class _CharT, class _Traits>
717
inline _LIBCPP_INLINE_VISIBILITY
718
basic_ostream<_CharT, _Traits>*
719
basic_ios<_CharT, _Traits>::tie() const
720
238M
{
721
238M
    return __tie_;
722
238M
}
std::__1::basic_ios<char, std::__1::char_traits<char> >::tie() const
Line
Count
Source
720
238M
{
721
238M
    return __tie_;
722
238M
}
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::tie() const
Line
Count
Source
720
10.0k
{
721
10.0k
    return __tie_;
722
10.0k
}
723
724
template <class _CharT, class _Traits>
725
inline _LIBCPP_INLINE_VISIBILITY
726
basic_ostream<_CharT, _Traits>*
727
basic_ios<_CharT, _Traits>::tie(basic_ostream<char_type, traits_type>* __tiestr)
728
20.0k
{
729
20.0k
    basic_ostream<char_type, traits_type>* __r = __tie_;
730
20.0k
    __tie_ = __tiestr;
731
20.0k
    return __r;
732
20.0k
}
std::__1::basic_ios<char, std::__1::char_traits<char> >::tie(std::__1::basic_ostream<char, std::__1::char_traits<char> >*)
Line
Count
Source
728
10.0k
{
729
10.0k
    basic_ostream<char_type, traits_type>* __r = __tie_;
730
10.0k
    __tie_ = __tiestr;
731
10.0k
    return __r;
732
10.0k
}
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::tie(std::__1::basic_ostream<wchar_t, std::__1::char_traits<wchar_t> >*)
Line
Count
Source
728
10.0k
{
729
10.0k
    basic_ostream<char_type, traits_type>* __r = __tie_;
730
10.0k
    __tie_ = __tiestr;
731
10.0k
    return __r;
732
10.0k
}
733
734
template <class _CharT, class _Traits>
735
inline _LIBCPP_INLINE_VISIBILITY
736
basic_streambuf<_CharT, _Traits>*
737
basic_ios<_CharT, _Traits>::rdbuf() const
738
480M
{
739
480M
    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
740
480M
}
std::__1::basic_ios<char, std::__1::char_traits<char> >::rdbuf() const
Line
Count
Source
738
480M
{
739
480M
    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
740
480M
}
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::rdbuf() const
Line
Count
Source
738
35.0k
{
739
35.0k
    return static_cast<basic_streambuf<char_type, traits_type>*>(ios_base::rdbuf());
740
35.0k
}
741
742
template <class _CharT, class _Traits>
743
inline _LIBCPP_INLINE_VISIBILITY
744
basic_streambuf<_CharT, _Traits>*
745
basic_ios<_CharT, _Traits>::rdbuf(basic_streambuf<char_type, traits_type>* __sb)
746
{
747
    basic_streambuf<char_type, traits_type>* __r = rdbuf();
748
    ios_base::rdbuf(__sb);
749
    return __r;
750
}
751
752
template <class _CharT, class _Traits>
753
inline _LIBCPP_INLINE_VISIBILITY
754
locale
755
basic_ios<_CharT, _Traits>::imbue(const locale& __loc)
756
{
757
    locale __r = getloc();
758
    ios_base::imbue(__loc);
759
    if (rdbuf())
760
        rdbuf()->pubimbue(__loc);
761
    return __r;
762
}
763
764
template <class _CharT, class _Traits>
765
inline _LIBCPP_INLINE_VISIBILITY
766
char
767
basic_ios<_CharT, _Traits>::narrow(char_type __c, char __dfault) const
768
{
769
    return use_facet<ctype<char_type> >(getloc()).narrow(__c, __dfault);
770
}
771
772
template <class _CharT, class _Traits>
773
inline _LIBCPP_INLINE_VISIBILITY
774
_CharT
775
basic_ios<_CharT, _Traits>::widen(char __c) const
776
5.30M
{
777
5.30M
    return use_facet<ctype<char_type> >(getloc()).widen(__c);
778
5.30M
}
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const
Line
Count
Source
776
5.30M
{
777
5.30M
    return use_facet<ctype<char_type> >(getloc()).widen(__c);
778
5.30M
}
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::widen(char) const
Line
Count
Source
776
8
{
777
8
    return use_facet<ctype<char_type> >(getloc()).widen(__c);
778
8
}
779
780
template <class _CharT, class _Traits>
781
inline _LIBCPP_INLINE_VISIBILITY
782
_CharT
783
basic_ios<_CharT, _Traits>::fill() const
784
218M
{
785
218M
    if (traits_type::eq_int_type(traits_type::eof(), __fill_))
786
5.25M
        __fill_ = widen(' ');
787
218M
    return __fill_;
788
218M
}
std::__1::basic_ios<char, std::__1::char_traits<char> >::fill() const
Line
Count
Source
784
218M
{
785
218M
    if (traits_type::eq_int_type(traits_type::eof(), __fill_))
786
5.25M
        __fill_ = widen(' ');
787
218M
    return __fill_;
788
218M
}
std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::fill() const
Line
Count
Source
784
12
{
785
12
    if (traits_type::eq_int_type(traits_type::eof(), __fill_))
786
2
        __fill_ = widen(' ');
787
12
    return __fill_;
788
12
}
789
790
template <class _CharT, class _Traits>
791
inline _LIBCPP_INLINE_VISIBILITY
792
_CharT
793
basic_ios<_CharT, _Traits>::fill(char_type __ch)
794
{
795
    char_type __r = __fill_;
796
    __fill_ = __ch;
797
    return __r;
798
}
799
800
template <class _CharT, class _Traits>
801
basic_ios<_CharT, _Traits>&
802
basic_ios<_CharT, _Traits>::copyfmt(const basic_ios& __rhs)
803
0
{
804
0
    if (this != &__rhs)
805
0
    {
806
0
        __call_callbacks(erase_event);
807
0
        ios_base::copyfmt(__rhs);
808
0
        __tie_ = __rhs.__tie_;
809
0
        __fill_ = __rhs.__fill_;
810
0
        __call_callbacks(copyfmt_event);
811
0
        exceptions(__rhs.exceptions());
812
0
    }
813
0
    return *this;
814
0
}
Unexecuted instantiation: std::__1::basic_ios<char, std::__1::char_traits<char> >::copyfmt(std::__1::basic_ios<char, std::__1::char_traits<char> > const&)
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::copyfmt(std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> > const&)
815
816
template <class _CharT, class _Traits>
817
inline _LIBCPP_INLINE_VISIBILITY
818
void
819
basic_ios<_CharT, _Traits>::move(basic_ios& __rhs)
820
0
{
821
0
    ios_base::move(__rhs);
822
0
    __tie_ = __rhs.__tie_;
823
0
    __rhs.__tie_ = 0;
824
0
    __fill_ = __rhs.__fill_;
825
0
}
826
827
template <class _CharT, class _Traits>
828
inline _LIBCPP_INLINE_VISIBILITY
829
void
830
basic_ios<_CharT, _Traits>::swap(basic_ios& __rhs) _NOEXCEPT
831
0
{
832
0
    ios_base::swap(__rhs);
833
0
    _VSTD::swap(__tie_, __rhs.__tie_);
834
0
    _VSTD::swap(__fill_, __rhs.__fill_);
835
0
}
Unexecuted instantiation: std::__1::basic_ios<char, std::__1::char_traits<char> >::swap(std::__1::basic_ios<char, std::__1::char_traits<char> >&)
Unexecuted instantiation: std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >::swap(std::__1::basic_ios<wchar_t, std::__1::char_traits<wchar_t> >&)
836
837
template <class _CharT, class _Traits>
838
inline _LIBCPP_INLINE_VISIBILITY
839
void
840
basic_ios<_CharT, _Traits>::set_rdbuf(basic_streambuf<char_type, traits_type>* __sb)
841
0
{
842
0
    ios_base::set_rdbuf(__sb);
843
0
}
844
845
inline _LIBCPP_INLINE_VISIBILITY
846
ios_base&
847
boolalpha(ios_base& __str)
848
0
{
849
0
    __str.setf(ios_base::boolalpha);
850
0
    return __str;
851
0
}
852
853
inline _LIBCPP_INLINE_VISIBILITY
854
ios_base&
855
noboolalpha(ios_base& __str)
856
0
{
857
0
    __str.unsetf(ios_base::boolalpha);
858
0
    return __str;
859
0
}
860
861
inline _LIBCPP_INLINE_VISIBILITY
862
ios_base&
863
showbase(ios_base& __str)
864
0
{
865
0
    __str.setf(ios_base::showbase);
866
0
    return __str;
867
0
}
868
869
inline _LIBCPP_INLINE_VISIBILITY
870
ios_base&
871
noshowbase(ios_base& __str)
872
0
{
873
0
    __str.unsetf(ios_base::showbase);
874
0
    return __str;
875
0
}
876
877
inline _LIBCPP_INLINE_VISIBILITY
878
ios_base&
879
showpoint(ios_base& __str)
880
0
{
881
0
    __str.setf(ios_base::showpoint);
882
0
    return __str;
883
0
}
884
885
inline _LIBCPP_INLINE_VISIBILITY
886
ios_base&
887
noshowpoint(ios_base& __str)
888
0
{
889
0
    __str.unsetf(ios_base::showpoint);
890
0
    return __str;
891
0
}
892
893
inline _LIBCPP_INLINE_VISIBILITY
894
ios_base&
895
showpos(ios_base& __str)
896
0
{
897
0
    __str.setf(ios_base::showpos);
898
0
    return __str;
899
0
}
900
901
inline _LIBCPP_INLINE_VISIBILITY
902
ios_base&
903
noshowpos(ios_base& __str)
904
0
{
905
0
    __str.unsetf(ios_base::showpos);
906
0
    return __str;
907
0
}
908
909
inline _LIBCPP_INLINE_VISIBILITY
910
ios_base&
911
skipws(ios_base& __str)
912
0
{
913
0
    __str.setf(ios_base::skipws);
914
0
    return __str;
915
0
}
916
917
inline _LIBCPP_INLINE_VISIBILITY
918
ios_base&
919
noskipws(ios_base& __str)
920
0
{
921
0
    __str.unsetf(ios_base::skipws);
922
0
    return __str;
923
0
}
924
925
inline _LIBCPP_INLINE_VISIBILITY
926
ios_base&
927
uppercase(ios_base& __str)
928
{
929
    __str.setf(ios_base::uppercase);
930
    return __str;
931
}
932
933
inline _LIBCPP_INLINE_VISIBILITY
934
ios_base&
935
nouppercase(ios_base& __str)
936
0
{
937
0
    __str.unsetf(ios_base::uppercase);
938
0
    return __str;
939
0
}
940
941
inline _LIBCPP_INLINE_VISIBILITY
942
ios_base&
943
unitbuf(ios_base& __str)
944
10.0k
{
945
10.0k
    __str.setf(ios_base::unitbuf);
946
10.0k
    return __str;
947
10.0k
}
948
949
inline _LIBCPP_INLINE_VISIBILITY
950
ios_base&
951
nounitbuf(ios_base& __str)
952
0
{
953
0
    __str.unsetf(ios_base::unitbuf);
954
0
    return __str;
955
0
}
956
957
inline _LIBCPP_INLINE_VISIBILITY
958
ios_base&
959
internal(ios_base& __str)
960
0
{
961
0
    __str.setf(ios_base::internal, ios_base::adjustfield);
962
0
    return __str;
963
0
}
964
965
inline _LIBCPP_INLINE_VISIBILITY
966
ios_base&
967
left(ios_base& __str)
968
0
{
969
0
    __str.setf(ios_base::left, ios_base::adjustfield);
970
0
    return __str;
971
0
}
972
973
inline _LIBCPP_INLINE_VISIBILITY
974
ios_base&
975
right(ios_base& __str)
976
0
{
977
0
    __str.setf(ios_base::right, ios_base::adjustfield);
978
0
    return __str;
979
0
}
980
981
inline _LIBCPP_INLINE_VISIBILITY
982
ios_base&
983
dec(ios_base& __str)
984
0
{
985
0
    __str.setf(ios_base::dec, ios_base::basefield);
986
0
    return __str;
987
0
}
988
989
inline _LIBCPP_INLINE_VISIBILITY
990
ios_base&
991
hex(ios_base& __str)
992
{
993
    __str.setf(ios_base::hex, ios_base::basefield);
994
    return __str;
995
}
996
997
inline _LIBCPP_INLINE_VISIBILITY
998
ios_base&
999
oct(ios_base& __str)
1000
0
{
1001
0
    __str.setf(ios_base::oct, ios_base::basefield);
1002
0
    return __str;
1003
0
}
1004
1005
inline _LIBCPP_INLINE_VISIBILITY
1006
ios_base&
1007
fixed(ios_base& __str)
1008
0
{
1009
0
    __str.setf(ios_base::fixed, ios_base::floatfield);
1010
0
    return __str;
1011
0
}
1012
1013
inline _LIBCPP_INLINE_VISIBILITY
1014
ios_base&
1015
scientific(ios_base& __str)
1016
0
{
1017
0
    __str.setf(ios_base::scientific, ios_base::floatfield);
1018
0
    return __str;
1019
0
}
1020
1021
inline _LIBCPP_INLINE_VISIBILITY
1022
ios_base&
1023
hexfloat(ios_base& __str)
1024
0
{
1025
0
    __str.setf(ios_base::fixed | ios_base::scientific, ios_base::floatfield);
1026
0
    return __str;
1027
0
}
1028
1029
inline _LIBCPP_INLINE_VISIBILITY
1030
ios_base&
1031
defaultfloat(ios_base& __str)
1032
0
{
1033
0
    __str.unsetf(ios_base::floatfield);
1034
0
    return __str;
1035
0
}
1036
1037
template <class _CharT, class _Traits>
1038
class __save_flags
1039
{
1040
    typedef basic_ios<_CharT, _Traits> __stream_type;
1041
    typedef typename __stream_type::fmtflags fmtflags;
1042
1043
    __stream_type& __stream_;
1044
    fmtflags       __fmtflags_;
1045
    _CharT         __fill_;
1046
1047
    __save_flags(const __save_flags&);
1048
    __save_flags& operator=(const __save_flags&);
1049
public:
1050
    _LIBCPP_INLINE_VISIBILITY
1051
    explicit __save_flags(__stream_type& __stream)
1052
        : __stream_(__stream),
1053
          __fmtflags_(__stream.flags()),
1054
          __fill_(__stream.fill())
1055
        {}
1056
    _LIBCPP_INLINE_VISIBILITY
1057
    ~__save_flags()
1058
    {
1059
        __stream_.flags(__fmtflags_);
1060
        __stream_.fill(__fill_);
1061
    }
1062
};
1063
1064
_LIBCPP_END_NAMESPACE_STD
1065
1066
#endif  // _LIBCPP_IOS