template <typename Char = char>
toml::default_formatter class final

A wrapper for printing TOML objects out to a stream as formatted TOML.

Template parameters
Char The underlying character type of the output stream. Must be 1 byte in size.
auto tbl = toml::table{{
    { "description", "This is some TOML, yo." },
    { "fruit", toml::array{ "apple", "orange", "pear" } },
    { "numbers", toml::array{ 1, 2, 3, 4, 5 } },
    { "table", toml::table{{ { "foo", "bar" } }} }
}};

// these two lines are equivalent:
std::cout << toml::default_formatter{ tbl } << "\n";
std::cout << tbl << "\n";
description = "This is some TOML, yo."
fruit = ["apple", "orange", "pear"]
numbers = [1, 2, 3, 4, 5]

[table]
foo = "bar"

Public static variables

static format_flags default_flags constexpr
The default flags for a default_formatter.

Constructors, destructors, conversion operators

default_formatter(const toml::node& source, format_flags flags = default_flags) explicit noexcept
Constructs a default formatter and binds it to a TOML object.
default_formatter(const toml::parse_result& result, format_flags flags = default_flags) explicit noexcept
Constructs a default TOML formatter and binds it to a toml::parse_result.

Friends

template <typename T, typename U>
auto operator<<(std::basic_ostream<T>&, default_formatter<U>&) -> std::basic_ostream<T>&
Prints the bound TOML object out to the stream as formatted TOML.
template <typename T, typename U>
auto operator<<(std::basic_ostream<T>&, default_formatter<U>&&) -> std::basic_ostream<T>&
Prints the bound TOML object out to the stream as formatted TOML (rvalue overload).

Function documentation

template <typename Char>
toml::default_formatter::default_formatter(const toml::node& source, format_flags flags = default_flags) explicit noexcept

Constructs a default formatter and binds it to a TOML object.

Parameters
source The source TOML object.
flags Format option flags.

template <typename Char>
toml::default_formatter::default_formatter(const toml::parse_result& result, format_flags flags = default_flags) explicit noexcept

Constructs a default TOML formatter and binds it to a toml::parse_result.

Parameters
result The parse result.
flags Format option flags.