Melon
A C++ library designed for RadishOS.
Loading...
Searching...
No Matches
Melon::Fmt Namespace Reference

Contains functions for string formatting. More...

Classes

struct  IsSpecialValue
 Default behaviour for every type T. More...
struct  IsSpecialValue< Conversion::BinaryValue< T > >
 Partial template specialization for Conversion::BinaryValue<T>. More...
struct  IsSpecialValue< Conversion::OctalValue< T > >
 Partial template specialization for Conversion::OctalValue<T>. More...
struct  IsSpecialValue< Conversion::HexadecimalValue< T > >
 Partial template specialization for Conversion::HexadecimalValue<T>. More...

Concepts

concept  Formattable
 Makes sure that T is supported by formatArgs().

Functions

template<Formattable T, typename... ARGS>
constexpr void formatArgs (String::String &out, const String::String &fmt, Typing::USize &idx, T &&arg, ARGS &&...args)
 Format a string.
constexpr void formatArgs (String::String &out, const String::String &fmt, Typing::USize &idx)
 Overload to allow formatString() to compile without format arguments.
template<typename... ARGS>
String::String formatString (const String::String &str, ARGS &&...args)
 Format a string.

Variables

template<typename T>
constexpr bool IsSpecialValueV = IsSpecialValue<std::remove_cvref_t<T>>::value
 Alias to avoid typing IsSpecialValue<T>::value.

Detailed Description

Contains functions for string formatting.

Function Documentation

◆ formatArgs()

template<Formattable T, typename... ARGS>
void Melon::Fmt::formatArgs ( String::String & out,
const String::String & fmt,
Typing::USize & idx,
T && arg,
ARGS &&... args )
constexpr

Format a string.

Parameters
outoutput string
fmtstring to format
idxindex in the string
argargument
argsarguments

◆ formatString()

template<typename... ARGS>
String::String Melon::Fmt::formatString ( const String::String & str,
ARGS &&... args )

Format a string.

Expected format: "This is a parameter: {} and here is another one: {}", a, b

Parameters
strstring to format
argsvalues