Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
Format.h File Reference
#include "Stroika/Foundation/StroikaPreComp.h"
#include <array>
#include "Stroika/Foundation/Characters/String.h"
#include "Stroika/Foundation/Characters/ToString.h"
#include "Stroika/Foundation/Common/Common.h"
#include "Stroika/Foundation/Common/Concepts.h"
#include "Stroika/Foundation/Common/StdCompat.h"
#include "Format.inl"

Go to the source code of this file.

Classes

struct  Stroika::Foundation::Characters::Private_::FixedString_< CHAR_T, N >
 
struct  Stroika::Foundation::Characters::FormatString< CHAR_T >
 Stroika's format string: it always formats WIDE - each argument as std::formatter<T, wchar_t> formats it - into a String; written narrow ("..."_f) only as a terser spelling, so then it must be ASCII. More...
 
struct  Stroika::Foundation::Characters::FormatString< char >
 a narrow FormatString: its text must be ASCII - checked at run time, it throws otherwise - and it keeps its own widened copy, so that text need not last More...
 
struct  Stroika::Foundation::Characters::FormatLiteral< LITERAL >
 what "..."_f is: a format string whose literal is part of its type - so it is widened (if narrow) at compile time, and checked against the arguments of each call at compile time, as std::format checks its format string More...
 

Namespaces

namespace  Stroika::Foundation
 
namespace  Stroika::Foundation::Characters
 
namespace  Stroika::Foundation::Characters::Literals
 Create a format-string (see std::wformat_string or Stroika FormatString, or python 'f' strings) - a FormatLiteral.
 

Concepts

concept  Stroika::Foundation::Characters::IFormattable
 what types Stroika's formatting - FormatString (_f), Format, DbgTrace - formats: anything std::format can, and anything else Characters::ToString can print, as its ToString
 
concept  Stroika::Foundation::Characters::IFormatLiteral
 a FormatLiteral - what "..."_f is
 

Functions

template<typename RESULT , typename F , typename... ARGS>
RESULT Stroika::Foundation::Characters::Private_::WithFormatArgs_ (F &&f, const ARGS &... args)
 
template<typename CHAR_T >
String Stroika::Foundation::Characters::VFormat (const FormatString< CHAR_T > &f, const Common::StdCompat::wformat_args &args)
 same as std::vformat, except that it always uses wformat_args, and produces a Stroika String
 
template<typename CHAR_T >
String Stroika::Foundation::Characters::VFormat (const locale &loc, const FormatString< CHAR_T > &f, const Common::StdCompat::wformat_args &args)
 As above, with a locale.
 
String Stroika::Foundation::Characters::FormatV (const wchar_t *format, va_list argsList)
 printf-style formatting of a va_list, into a String - with one difference from vswprintf: s takes a const wchar_t* (as Microsoft's does - the better reading, with wide characters)
 
template<typename CHAR_T , IFormattable... ARGS>
String Stroika::Foundation::Characters::Format (const FormatString< CHAR_T > &f, ARGS &&... args)
 Like std::format, but formats wide, into a String: f (args...) - its args checked at run time.
 
template<typename CHAR_T , IFormattable... ARGS>
String Stroika::Foundation::Characters::Format (const locale &l, const FormatString< CHAR_T > &f, ARGS &&... args)
 Like std::format, with a locale.
 
template<Private_::FixedString_ LITERAL, Stroika_Foundation_Common_formattable_FilterOnStringLitOp_BWA(IFormattable)... ARGS>
String Stroika::Foundation::Characters::Format (const FormatLiteral< LITERAL > &f, ARGS &&... args)
 Like std::format - args checked against f at compile time.
 
template<Private_::FixedString_ LITERAL, Stroika_Foundation_Common_formattable_FilterOnStringLitOp_BWA(IFormattable)... ARGS>
String Stroika::Foundation::Characters::Format (const locale &l, const FormatLiteral< LITERAL > &f, ARGS &&... args)
 Like std::format, with a locale - checked at compile time.
 

Detailed Description

Note
Code-Status: Beta

Definition in file Characters/Format.h.

Function Documentation

◆ WithFormatArgs_()

template<typename RESULT , typename F , typename... ARGS>
RESULT Stroika::Foundation::Characters::Private_::WithFormatArgs_ ( F &&  f,
const ARGS &...  args 
)

f (the wformat_args of args): each argument itself where std::format can format it, else its Characters::ToString - kept alive through the call. Declared again in Debug/Trace.h, which cannot include this header.

Definition at line 42 of file Characters/Format.inl.