diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-12-02 06:14:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-02 06:14:31 -0500 |
| commit | 92d95762c9cf75d9493ec75042c9415b382f10b0 (patch) | |
| tree | dfcbd5b3fb9303e40b32db34cc857243df86ffc9 /include/ocl/io | |
| parent | a28d3e2e4e99793cf91f919d9341f5e07aa998e1 (diff) | |
| parent | bea0e3e713751e5c2a4d2d4343d8215333eef03e (diff) | |
Merge pull request #37 from amlel-el-mahrouss/developv1
chore: module source code tweaks and improvements.
Diffstat (limited to 'include/ocl/io')
| -rw-r--r-- | include/ocl/io/print.hpp | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/include/ocl/io/print.hpp b/include/ocl/io/print.hpp index 669dfef..5c8a17c 100644 --- a/include/ocl/io/print.hpp +++ b/include/ocl/io/print.hpp @@ -13,6 +13,7 @@ #include <iostream> #define console_io_out std::cout +#define console_io_in std::cin namespace ocl::io { @@ -40,19 +41,37 @@ namespace ocl::io print(other...); } - template <typename... T> - inline void println(T... fmt) noexcept + namespace detail { - print(fmt...); + inline bool is_stdio_sync = true; + } + + inline void enable_stdio_sync(const bool& enable) noexcept + { + console_io_out.sync_with_stdio(enable); + detail::is_stdio_sync = false; + } + + inline const bool& is_stdio_sync() + { + return detail::is_stdio_sync; + } -#ifdef _WIN32 + inline void lf() noexcept + { +#ifdef OCL_USE_CRLF_ENDINGS print("\r\n"); #else print("\n"); #endif } -} // namespace ocl::io -#undef console_io_out + template <typename... T> + inline void println(T... fmt) noexcept + { + print(fmt...); + lf(); + } +} // namespace ocl::io #endif // ifndef _OCL_PRINT_HPP |
