HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
print_win32_impl.hpp
1// Copyright Take Vos 2021.
2// Distributed under the Boost Software License, Version 1.0.
3// (See accompanying file LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt)
4
5#pragma once
6
8
9#include "print_intf.hpp"
10#include "../utility/utility.hpp"
11#include "../char_maps/module.hpp"
12#include "../macros.hpp"
13#include <memory>
14#include <string_view>
15
16hi_export_module(hikogui.console.print : impl);
17
18namespace hi::inline v1 {
19
20
21hi_export template<typename... Args>
22inline void print(std::format_string<Args...> fmt, Args&&... args) noexcept
23{
24 auto msg = std::format(fmt, std::forward<Args>(args)...);
25
26 if (IsDebuggerPresent()) {
27 hilet text_ = to_wstring(msg);
29
30 } else {
31 std::cout << msg;
32 }
33}
34
35hi_export template<typename... Args>
36inline void println(std::format_string<Args...> fmt, Args&&... args) noexcept
37{
38 auto msg = std::format(fmt, std::forward<Args>(args)...);
39 msg += '\n';
40
41 if (IsDebuggerPresent()) {
42 hilet text_ = to_wstring(msg);
44
45 } else {
46 std::cout << msg;
47 }
48}
49
50
51} // namespace hi::inline v1
Rules for working with win32 headers.
constexpr std::wstring to_wstring(std::u32string_view rhs) noexcept
Conversion from UTF-32 to wide-string (UTF-16/32).
Definition to_string.hpp:156
DOXYGEN BUG.
Definition algorithm.hpp:16
hi_export void println(std::format_string< Args... > fmt, Args &&... args) noexcept
Output a line of text to the console.
hi_export void print(std::format_string< Args... > fmt, Args &&... args) noexcept
Output text to the console.
constexpr Out narrow_cast(In const &rhs) noexcept
Cast numeric values without loss of precision.
Definition cast.hpp:377