File: ostream

package info (click to toggle)
cppreference-doc 20170409-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 259,868 kB
  • sloc: xml: 570,184; python: 1,923; php: 520; makefile: 167; sh: 25; cpp: 9; ansic: 9
file content (146 lines) | stat: -rw-r--r-- 5,167 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/*  Copyright (C) 2015  Povilas Kanapickas <povilas@radix.lt>

    This file is part of cppreference-doc

    This work is licensed under the Creative Commons Attribution-ShareAlike 3.0
    Unported License. To view a copy of this license, visit
    http://creativecommons.org/licenses/by-sa/3.0/ or send a letter to Creative
    Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

    Permission is granted to copy, distribute and/or modify this document
    under the terms of the GNU Free Documentation License, Version 1.3 or
    any later version published by the Free Software Foundation; with no
    Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
*/

#ifndef CPPREFERENCE_OSTREAM_H
#define CPPREFERENCE_OSTREAM_H

namespace std {

template <
    class CharT,
    class Traits = std::char_traits<CharT>
    > class basic_ostream : virtual public std::basic_ios<CharT, Traits> {
public:
    explicit basic_ostream(std::basic_streambuf<CharT, Traits>* sb);
    virtual ~basic_ostream();

    basic_ostream& operator<<(short value);
    basic_ostream& operator<<(unsigned short value);
    basic_ostream& operator<<(int value);
    basic_ostream& operator<<(unsigned int value);
    basic_ostream& operator<<(long value);
    basic_ostream& operator<<(unsigned long value);
#if CPPREFERENCE_STDVER>= 2011
    basic_ostream& operator<<(long long value);
    basic_ostream& operator<<(unsigned long long value);
#endif
    basic_ostream& operator<<(float value);
    basic_ostream& operator<<(double value);
    basic_ostream& operator<<(long double value);
    basic_ostream& operator<<(bool value);
    basic_ostream& operator<<(const void* value);
    basic_ostream& operator<<(std::basic_streambuf<CharT, Traits>* sb);
    basic_ostream& operator<<(std::ios_base & (*func)(std::ios_base&));
    basic_ostream& operator<<(std::basic_ios<CharT, Traits>& (*func)(std::basic_ios<CharT, Traits>&));
    basic_ostream& operator<<(std::basic_ostream<CharT, Traits>& (*func)(std::basic_ostream<CharT, Traits>&));

    basic_ostream& put(char_type ch);
    basic_ostream& write(const char_type* s, std::streamsize count);
    pos_type tellp();
    basic_ostream& seekp(pos_type pos);
    basic_ostream& seekp(off_type off, std::ios_base::seekdir dir);
    basic_ostream& flush();

    class sentry {
    public:
        typedef Traits traits_type;
        explicit sentry(std::basic_ostream<CharT, Traits>& is, bool noskipws = false);
        ~sentry();
        explicit operator bool() const;
    };

protected:
#if CPPREFERENCE_STDVER>= 2011
    basic_ostream(const basic_ostream& rhs) = delete;
    basic_ostream(basic_ostream&& rhs);
#endif

#if CPPREFERENCE_STDVER>= 2011
    basic_ostream& operator=(const basic_ostream& rhs) = delete;
    basic_ostream& operator=(basic_ostream&& rhs);
    void swap(basic_ostream& rhs);
#endif
};

template<class CharT, class Traits>
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os,
        CharT ch);

template<class CharT, class Traits>
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os,
        char ch);

template<class Traits>
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
                                        char ch);

template<class Traits>
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
                                        signed char ch);

template<class Traits>

basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
                                        unsigned char ch);

template<class CharT, class Traits>
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os,
        const CharT* s);

template<class CharT, class Traits>
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os,
        const char* s);

template<class Traits>
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
                                        const char* s);

template<class Traits>
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
                                        const signed char* s);

template<class Traits>
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os,
                                        const unsigned char* s);

#if CPPREFERENCE_STDVER>= 2011
template<class CharT, class Traits, class T>
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>&& os,
        const T& value);
#endif

typedef basic_ostream<char> ostream;
typedef basic_ostream<wchar_t> wostream;

extern ostream cout;
extern wostream wcout;
extern ostream cerr;
extern wostream wcerr;
extern ostream clog;
extern wostream wclog;

// manipulators
template<class CharT, class Traits>
std::basic_ostream<CharT, Traits>& ends(std::basic_ostream<CharT, Traits>& os);

template<class CharT, class Traits>
std::basic_ostream<CharT, Traits>& flush(std::basic_ostream<CharT, Traits>& os);

template<class CharT, class Traits>
std::basic_ostream<CharT, Traits>& endl(std::basic_ostream<CharT, Traits>& os);

} // namespace std

#endif // CPPREFERENCE_OSTREAM_H