Rosetta
Classes | Namespaces | Macros | Functions
compile.h File Reference
#include <vector>
#include "format.h"

Classes

class  detail::compiled_string
 
struct  detail::is_compiled_string< S >
 
struct  detail::format_part< Char >
 
struct  detail::format_part< Char >::replacement
 
union  detail::format_part< Char >::value
 
struct  detail::part_counter< Char >
 
class  detail::format_string_compiler< Char, PartHandler >
 
struct  detail::basic_compiled_format
 
struct  detail::compiled_format_base< S, typename >
 
struct  detail::format_part_array< Char, N >
 
struct  detail::compiled_format_base< S, enable_if_t< is_compile_string< S >::value > >
 
class  detail::compiled_format< S, Args >
 

Namespaces

 detail
 
 detail::cf
 

Macros

#define FMT_COMPILE(s)   FMT_STRING_IMPL(s, fmt::detail::compiled_string)
 

Functions

template<typename T , typename... Tail>
const Tdetail::first (const T &value, const Tail &...)
 
template<typename Char >
FMT_CONSTEXPR unsigned detail::count_parts (basic_string_view< Char > format_str)
 
template<bool IS_CONSTEXPR, typename Char , typename PartHandler >
FMT_CONSTEXPR void detail::compile_format_string (basic_string_view< Char > format_str, PartHandler handler)
 
template<typename OutputIt , typename Context , typename Id >
void detail::format_arg (basic_format_parse_context< typename Context::char_type > &parse_ctx, Context &ctx, Id arg_id)
 
template<typename Context , typename OutputIt , typename CompiledFormat >
auto detail::cf::vformat_to (OutputIt out, CompiledFormat &cf, basic_format_args< Context > args) -> typename Context::iterator
 
template<typename Char , unsigned N>
FMT_CONSTEXPR format_part_array< Char, Ndetail::compile_to_parts (basic_string_view< Char > format_str)
 
template<typename T >
constexpr const Tdetail::constexpr_max (const T &a, const T &b)
 
template<typename... Args, typename S , FMT_ENABLE_IF(is_compile_string< S >::value) >
constexpr auto detail::compile (S format_str) -> detail::compiled_format< S, Args... >
 
template<typename... Args, typename Char , size_t N>
auto detail::compile (const Char(&format_str)[N]) -> detail::compiled_format< const Char *, Args... >
 
template<typename... Args>
FMT_DEPRECATED auto compile (const Args &... args) -> decltype(detail::compile(args...))
 
template<typename CompiledFormat , typename... Args, typename Char = typename CompiledFormat::char_type, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
std::basic_string< Char > format (const CompiledFormat &cf, const Args &... args)
 
template<typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
FMT_INLINE std::basic_string< typename S::char_type > format (const S &, Args &&... args)
 
template<typename OutputIt , typename CompiledFormat , typename... Args, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
OutputIt format_to (OutputIt out, const CompiledFormat &cf, const Args &... args)
 
template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
OutputIt format_to (OutputIt out, const S &, const Args &... args)
 
template<typename OutputIt , typename CompiledFormat , typename... Args>
auto format_to_n (OutputIt out, size_t n, const CompiledFormat &cf, const Args &... args) -> typename std::enable_if< detail::is_output_iterator< OutputIt, typename CompiledFormat::char_type >::value &&std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value, format_to_n_result< OutputIt >>::type
 
template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
format_to_n_result< OutputIt > format_to_n (OutputIt out, size_t n, const S &, const Args &... args)
 
template<typename CompiledFormat , typename... Args>
size_t formatted_size (const CompiledFormat &cf, const Args &... args)
 

Macro Definition Documentation

◆ FMT_COMPILE

#define FMT_COMPILE (   s)    FMT_STRING_IMPL(s, fmt::detail::compiled_string)

\rst Converts a string literal s into a format string that will be parsed at compile time and converted into efficient formatting code. Requires C++17 constexpr if compiler support.

Example**::

Converts 42 into std::string using the most efficient method and no runtime format string processing. std::string s = fmt::format(FMT_COMPILE("{}"), 42); \endrst

Function Documentation

◆ compile()

template<typename... Args>
FMT_DEPRECATED auto compile ( const Args &...  args) -> decltype(detail::compile(args...))

◆ format() [1/2]

template<typename CompiledFormat , typename... Args, typename Char = typename CompiledFormat::char_type, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
std::basic_string<Char> format ( const CompiledFormat &  cf,
const Args &...  args 
)

◆ format() [2/2]

template<typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
FMT_INLINE std::basic_string<typename S::char_type> format ( const S ,
Args &&...  args 
)

◆ format_to() [1/2]

template<typename OutputIt , typename CompiledFormat , typename... Args, FMT_ENABLE_IF(std::is_base_of< detail::basic_compiled_format, CompiledFormat >::value) >
OutputIt format_to ( OutputIt  out,
const CompiledFormat &  cf,
const Args &...  args 
)

◆ format_to() [2/2]

template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
OutputIt format_to ( OutputIt  out,
const S ,
const Args &...  args 
)

◆ format_to_n() [1/2]

template<typename OutputIt , typename CompiledFormat , typename... Args>
auto format_to_n ( OutputIt  out,
size_t  n,
const CompiledFormat &  cf,
const Args &...  args 
) -> typename std::enable_if< detail::is_output_iterator<OutputIt, typename CompiledFormat::char_type>::value && std::is_base_of<detail::basic_compiled_format, CompiledFormat>::value, format_to_n_result<OutputIt>>::type

◆ format_to_n() [2/2]

template<typename OutputIt , typename S , typename... Args, FMT_ENABLE_IF(detail::is_compiled_string< S >::value) >
format_to_n_result<OutputIt> format_to_n ( OutputIt  out,
size_t  n,
const S ,
const Args &...  args 
)

◆ formatted_size()

template<typename CompiledFormat , typename... Args>
size_t formatted_size ( const CompiledFormat &  cf,
const Args &...  args 
)