| 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_OSTREAM_H |
| 17 |
#define CPPREFERENCE_OSTREAM_H |
| 18 |
|
| 19 |
namespace std { |
| 20 |
|
| 21 |
template < |
| 22 |
class CharT, |
| 23 |
class Traits = std::char_traits<CharT> |
| 24 |
> class basic_ostream : virtual public std::basic_ios<CharT, Traits> { |
| 25 |
public: |
| 26 |
explicit basic_ostream(std::basic_streambuf<CharT, Traits>* sb); |
| 27 |
virtual ~basic_ostream(); |
| 28 |
|
| 29 |
basic_ostream& operator<<(short value); |
| 30 |
basic_ostream& operator<<(unsigned short value); |
| 31 |
basic_ostream& operator<<(int value); |
| 32 |
basic_ostream& operator<<(unsigned int value); |
| 33 |
basic_ostream& operator<<(long value); |
| 34 |
basic_ostream& operator<<(unsigned long value); |
| 35 |
#if CPPREFERENCE_STDVER>= 2011 |
| 36 |
basic_ostream& operator<<(long long value); |
| 37 |
basic_ostream& operator<<(unsigned long long value); |
| 38 |
#endif |
| 39 |
basic_ostream& operator<<(float value); |
| 40 |
basic_ostream& operator<<(double value); |
| 41 |
basic_ostream& operator<<(long double value); |
| 42 |
basic_ostream& operator<<(bool value); |
| 43 |
basic_ostream& operator<<(const void* value); |
| 44 |
basic_ostream& operator<<(std::basic_streambuf<CharT, Traits>* sb); |
| 45 |
basic_ostream& operator<<(std::ios_base & (*func)(std::ios_base&)); |
| 46 |
basic_ostream& operator<<(std::basic_ios<CharT, Traits>& (*func)(std::basic_ios<CharT, Traits>&)); |
| 47 |
basic_ostream& operator<<(std::basic_ostream<CharT, Traits>& (*func)(std::basic_ostream<CharT, Traits>&)); |
| 48 |
|
| 49 |
basic_ostream& put(char_type ch); |
| 50 |
basic_ostream& write(const char_type* s, std::streamsize count); |
| 51 |
pos_type tellp(); |
| 52 |
basic_ostream& seekp(pos_type pos); |
| 53 |
basic_ostream& seekp(off_type off, std::ios_base::seekdir dir); |
| 54 |
basic_ostream& flush(); |
| 55 |
|
| 56 |
class sentry { |
| 57 |
public: |
| 58 |
typedef Traits traits_type; |
| 59 |
explicit sentry(std::basic_ostream<CharT, Traits>& is, bool noskipws = false); |
| 60 |
~sentry(); |
| 61 |
explicit operator bool() const; |
| 62 |
}; |
| 63 |
|
| 64 |
protected: |
| 65 |
#if CPPREFERENCE_STDVER>= 2011 |
| 66 |
basic_ostream(const basic_ostream& rhs) = delete; |
| 67 |
basic_ostream(basic_ostream&& rhs); |
| 68 |
#endif |
| 69 |
|
| 70 |
#if CPPREFERENCE_STDVER>= 2011 |
| 71 |
basic_ostream& operator=(const basic_ostream& rhs) = delete; |
| 72 |
basic_ostream& operator=(basic_ostream&& rhs); |
| 73 |
void swap(basic_ostream& rhs); |
| 74 |
#endif |
| 75 |
}; |
| 76 |
|
| 77 |
template<class CharT, class Traits> |
| 78 |
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os, |
| 79 |
CharT ch); |
| 80 |
|
| 81 |
template<class CharT, class Traits> |
| 82 |
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os, |
| 83 |
char ch); |
| 84 |
|
| 85 |
template<class Traits> |
| 86 |
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os, |
| 87 |
char ch); |
| 88 |
|
| 89 |
template<class Traits> |
| 90 |
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os, |
| 91 |
signed char ch); |
| 92 |
|
| 93 |
template<class Traits> |
| 94 |
|
| 95 |
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os, |
| 96 |
unsigned char ch); |
| 97 |
|
| 98 |
template<class CharT, class Traits> |
| 99 |
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os, |
| 100 |
const CharT* s); |
| 101 |
|
| 102 |
template<class CharT, class Traits> |
| 103 |
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>& os, |
| 104 |
const char* s); |
| 105 |
|
| 106 |
template<class Traits> |
| 107 |
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os, |
| 108 |
const char* s); |
| 109 |
|
| 110 |
template<class Traits> |
| 111 |
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os, |
| 112 |
const signed char* s); |
| 113 |
|
| 114 |
template<class Traits> |
| 115 |
basic_ostream<char, Traits>& operator<<(basic_ostream<char, Traits>& os, |
| 116 |
const unsigned char* s); |
| 117 |
|
| 118 |
#if CPPREFERENCE_STDVER>= 2011 |
| 119 |
template<class CharT, class Traits, class T> |
| 120 |
basic_ostream<CharT, Traits>& operator<<(basic_ostream<CharT, Traits>&& os, |
| 121 |
const T& value); |
| 122 |
#endif |
| 123 |
|
| 124 |
typedef basic_ostream<char> ostream; |
| 125 |
typedef basic_ostream<wchar_t> wostream; |
| 126 |
|
| 127 |
extern ostream cout; |
| 128 |
extern wostream wcout; |
| 129 |
extern ostream cerr; |
| 130 |
extern wostream wcerr; |
| 131 |
extern ostream clog; |
| 132 |
extern wostream wclog; |
| 133 |
|
| 134 |
// manipulators |
| 135 |
template<class CharT, class Traits> |
| 136 |
std::basic_ostream<CharT, Traits>& ends(std::basic_ostream<CharT, Traits>& os); |
| 137 |
|
| 138 |
template<class CharT, class Traits> |
| 139 |
std::basic_ostream<CharT, Traits>& flush(std::basic_ostream<CharT, Traits>& os); |
| 140 |
|
| 141 |
template<class CharT, class Traits> |
| 142 |
std::basic_ostream<CharT, Traits>& endl(std::basic_ostream<CharT, Traits>& os); |
| 143 |
|
| 144 |
} // namespace std |
| 145 |
|
| 146 |
#endif // CPPREFERENCE_OSTREAM_H |