Melon
A C++ library designed for RadishOS.
Loading...
Searching...
No Matches
Print.hpp
1#pragma once
2
3#include "String.hpp"
4#include "Fmt.hpp"
5
6#include <stdio.h>
7
9namespace Melon::Print
10{
14 template<typename... ARGS>
15 void print(const String::String &str, ARGS &&...args)
16 {
17 String::String formatted;
18 Typing::USize idx = 0;
19 Fmt::formatArgs(formatted, str, idx, static_cast<ARGS &&>(args)...);
20 printf("%s", formatted.raw());
21 }
22
26 template<typename... ARGS>
27 void println(const String::String &str, ARGS &&...args)
28 {
29 print(str, static_cast<ARGS &&>(args)...);
30 print("\n");
31 }
32} // namespace Melon::Print
A dynamic string.
Definition String.hpp:11
const char * raw(this const String &self)
Gets a raw buffer which contains the string characters.
Definition String.cpp:42
constexpr void formatArgs(String::String &out, const String::String &fmt, Typing::USize &idx, T &&arg, ARGS &&...args)
Format a string.
Definition Fmt.hpp:69
Contains functions to display text.
Definition Print.hpp:10
void println(const String::String &str, ARGS &&...args)
Print a newline-terminated formatted string to the standard output stream.
Definition Print.hpp:27
void print(const String::String &str, ARGS &&...args)
Print a formatted string to the standard output stream.
Definition Print.hpp:15
size_t USize
Biggest unsigned type.
Definition Typing.hpp:38