forked from Simple-XX/SimpleKernel
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zone.N <[email protected]>
- Loading branch information
Showing
4 changed files
with
108 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
/** | ||
* @file iostream | ||
* @brief C++ 输入输出 | ||
* @author Zone.N ([email protected]) | ||
* @version 1.0 | ||
* @date 2021-09-18 | ||
* @copyright MIT LICENSE | ||
* https://github.com/Simple-XX/SimpleKernel | ||
* Based on https://github.com/MRNIU/MiniCRT | ||
* @par change log: | ||
* <table> | ||
* <tr><th>Date<th>Author<th>Description | ||
* <tr><td>2021-09-18<td>digmouse233<td>迁移到 doxygen | ||
* </table> | ||
*/ | ||
|
||
#ifndef SIMPLEKERNEL_SRC_KERNEL_LIBCXX_INCLUDE_IOSTREAM_ | ||
#define SIMPLEKERNEL_SRC_KERNEL_LIBCXX_INCLUDE_IOSTREAM_ | ||
|
||
#include <cstdint> | ||
|
||
namespace std { | ||
class ostream { | ||
public: | ||
enum openmode : uint8_t { | ||
in = 1, | ||
out = 2, | ||
binary = 4, | ||
trunc = 8, | ||
}; | ||
|
||
/// @name 构造/析构函数 | ||
/// @{ | ||
ostream() = default; | ||
ostream(const ostream&) = default; | ||
ostream(ostream&&) = default; | ||
auto operator=(const ostream&) -> ostream& = default; | ||
auto operator=(ostream&&) -> ostream& = default; | ||
~ostream() = default; | ||
/// @} | ||
|
||
ostream& operator<<(char c); | ||
ostream& operator<<(int n); | ||
ostream& operator<<(const char* lhs); | ||
ostream& operator<<(ostream& (*)(ostream&)); | ||
}; | ||
|
||
inline ostream& endl(ostream& lhs) { return lhs << '\n'; } | ||
|
||
static ostream cout [[maybe_unused]]; | ||
|
||
}; // namespace std | ||
|
||
#endif /* SIMPLEKERNEL_SRC_KERNEL_LIBCXX_INCLUDE_IOSTREAM_ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
|
||
/** | ||
* @file iostream | ||
* @brief C++ 输入输出 | ||
* @author Zone.N ([email protected]) | ||
* @version 1.0 | ||
* @date 2021-09-18 | ||
* @copyright MIT LICENSE | ||
* https://github.com/Simple-XX/SimpleKernel | ||
* Based on https://github.com/MRNIU/MiniCRT | ||
* @par change log: | ||
* <table> | ||
* <tr><th>Date<th>Author<th>Description | ||
* <tr><td>2021-09-18<td>digmouse233<td>迁移到 doxygen | ||
* </table> | ||
*/ | ||
|
||
#include "iostream" | ||
|
||
#include "cstdio" | ||
|
||
namespace std { | ||
|
||
ostream& ostream::operator<<(char c) { | ||
printf("%c", c); | ||
return *this; | ||
} | ||
|
||
ostream& ostream::operator<<(int n) { | ||
printf("%d", n); | ||
return *this; | ||
} | ||
|
||
ostream& ostream::operator<<(const char* lhs) { | ||
printf("%s", lhs); | ||
return *this; | ||
} | ||
|
||
ostream& ostream::operator<<(ostream& (*manip)(ostream&)) { | ||
return manip(*this); | ||
} | ||
|
||
}; // namespace std |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters