SimpleKernel  0.0.1
ostream Class Reference

#include <ostream.hpp>

Collaboration diagram for ostream:
Collaboration graph

Public Member Functions

 ostream ()=default
 
 ~ostream ()=default
 
auto operator<< (ostream &(*_ostream)(ostream &)) -> ostream &
 
不使用的构造函数
 ostream (const ostream &)=delete
 
 ostream (ostream &&)=delete
 
auto operator= (const ostream &) -> ostream &=delete
 
auto operator= (ostream &&) -> ostream &=delete
 
输出流特化
template<class _t >
auto operator<< (_t _val) -> ostream &
 
template<>
auto operator<< (int32_t _val) -> ostream &
 
template<>
auto operator<< (uint32_t _val) -> ostream &
 
template<>
auto operator<< (int64_t _val) -> ostream &
 
template<>
auto operator<< (uint64_t _val) -> ostream &
 
template<>
auto operator<< (wchar_t _val) -> ostream &
 
template<>
auto operator<< (const wchar_t *_val) -> ostream &
 
template<>
auto operator<< (void *_val) -> ostream &
 
template<>
auto operator<< (const void *_val) -> ostream &
 

Static Public Member Functions

static auto hex_x (ostream &_ostream) -> ostream &
 
static auto hex_X (ostream &_ostream) -> ostream &
 
static auto endl (ostream &_ostream) -> ostream &
 

Private Types

enum  mode_t : uint8_t { x , X , d }
 

Private Attributes

mode_t mode
 输出流模式 More...
 

Detailed Description

输出流

Definition at line 41 of file ostream.hpp.

Member Enumeration Documentation

◆ mode_t

enum ostream::mode_t : uint8_t
private

输出流模式枚举

Enumerator

16 进制 x

16 进制 X

10 进制 d

Definition at line 101 of file ostream.hpp.

101  : uint8_t {
103  x,
105  X,
107  d,
108  };
@ d
10 进制 d
Definition: ostream.hpp:107
@ X
16 进制 X
Definition: ostream.hpp:105
@ x
16 进制 x
Definition: ostream.hpp:103

Constructor & Destructor Documentation

◆ ostream() [1/3]

ostream::ostream ( )
default

使用默认构造

◆ ~ostream()

ostream::~ostream ( )
default

使用默认析构

◆ ostream() [2/3]

ostream::ostream ( const ostream )
delete

◆ ostream() [3/3]

ostream::ostream ( ostream &&  )
delete

Member Function Documentation

◆ endl()

auto ostream::endl ( ostream _ostream) -> ostream &
static

输出换行

Parameters
_ostream
Returns
输出流

Definition at line 42 of file ostream.cpp.

42 { return _ostream << L'\n'; }
Here is the caller graph for this function:

◆ hex_x()

auto ostream::hex_x ( ostream _ostream) -> ostream &
static

输出 16 进制

Parameters
_ostream输出流
Returns
输出流

Definition at line 32 of file ostream.cpp.

32  {
33  _ostream.mode = ostream::x;
34  return _ostream;
35 }
mode_t mode
输出流模式
Definition: ostream.hpp:110
Here is the caller graph for this function:

◆ hex_X()

auto ostream::hex_X ( ostream _ostream) -> ostream &
static

输出 16 进制

Parameters
_ostream输出流
Returns
输出流

Definition at line 37 of file ostream.cpp.

37  {
38  _ostream.mode = ostream::X;
39  return _ostream;
40 }
Here is the caller graph for this function:

◆ operator<<() [1/10]

template<class _t >
auto ostream::operator<< ( _t  _val) -> ostream &
inline

输出类型

Template Parameters
_t模板类型
Parameters
_val数据
Returns
输出流

Definition at line 116 of file ostream.hpp.

116  {
117  *this << (uint64_t)_val;
118  return *this;
119 }

◆ operator<<() [2/10]

template<>
auto ostream::operator<< ( const void *  _val) -> ostream &
inline

Definition at line 186 of file ostream.hpp.

186  {
187  *this << reinterpret_cast<uint64_t>(_val);
188  return *this;
189 }

◆ operator<<() [3/10]

template<>
auto ostream::operator<< ( const wchar_t *  _val) -> ostream &
inline

Definition at line 175 of file ostream.hpp.

175  {
176  Print(L"%s", _val);
177  mode = d;
178  return *this;
179 }

◆ operator<<() [4/10]

template<>
auto ostream::operator<< ( int32_t  _val) -> ostream &
inline

Definition at line 121 of file ostream.hpp.

121  {
122  if (mode == d) {
123  Print(L"%d", _val);
124  } else if (mode == x) {
125  Print(L"0x%x", _val);
126  } else if (mode == X) {
127  Print(L"0x%X", _val);
128  }
129  mode = d;
130  return *this;
131 }

◆ operator<<() [5/10]

template<>
auto ostream::operator<< ( int64_t  _val) -> ostream &
inline

Definition at line 145 of file ostream.hpp.

145  {
146  if (mode == d) {
147  Print(L"%ld", _val);
148  } else if (mode == x) {
149  Print(L"0x%x", _val);
150  } else if (mode == X) {
151  Print(L"0x%X", _val);
152  }
153  mode = d;
154  return *this;
155 }

◆ operator<<() [6/10]

auto ostream::operator<< ( ostream &(*)(ostream &)  _ostream) -> ostream &

‘<<’ 操作符重载

Parameters
_ostream输出流
Returns
输出流

Definition at line 28 of file ostream.cpp.

28  {
29  return _ostream(*this);
30 }

◆ operator<<() [7/10]

template<>
auto ostream::operator<< ( uint32_t  _val) -> ostream &
inline

Definition at line 133 of file ostream.hpp.

133  {
134  if (mode == d) {
135  Print(L"%d", _val);
136  } else if (mode == x) {
137  Print(L"0x%x", _val);
138  } else if (mode == X) {
139  Print(L"0x%X", _val);
140  }
141  mode = d;
142  return *this;
143 }

◆ operator<<() [8/10]

template<>
auto ostream::operator<< ( uint64_t  _val) -> ostream &
inline

Definition at line 157 of file ostream.hpp.

157  {
158  if (mode == d) {
159  Print(L"%ld", _val);
160  } else if (mode == x) {
161  Print(L"0x%x", _val);
162  } else if (mode == X) {
163  Print(L"0x%X", _val);
164  }
165  mode = d;
166  return *this;
167 }

◆ operator<<() [9/10]

template<>
auto ostream::operator<< ( void *  _val) -> ostream &
inline

Definition at line 181 of file ostream.hpp.

181  {
182  *this << reinterpret_cast<uint64_t>(_val);
183  return *this;
184 }

◆ operator<<() [10/10]

template<>
auto ostream::operator<< ( wchar_t  _val) -> ostream &
inline

Definition at line 169 of file ostream.hpp.

169  {
170  Print(L"%c", _val);
171  mode = d;
172  return *this;
173 }

◆ operator=() [1/2]

auto ostream::operator= ( const ostream ) -> ostream &=delete
delete

◆ operator=() [2/2]

auto ostream::operator= ( ostream &&  ) -> ostream &=delete
delete

Member Data Documentation

◆ mode

mode_t ostream::mode
private

输出流模式

Definition at line 110 of file ostream.hpp.


The documentation for this class was generated from the following files: