HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
core.h File Reference
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iterator>
#include <string>
#include <type_traits>
+ Include dependency graph for core.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  internal::result_of< typename >
 
struct  internal::result_of< F(Args...)>
 
class  internal::basic_buffer< T >
 
class  internal::container_buffer< Container >
 
struct  internal::error_handler
 
struct  internal::no_formatter_error< T >
 
struct  is_constructible< T >
 
class  basic_string_view< Char >
 
struct  compile_string
 
struct  is_compile_string< S >
 
class  basic_format_arg< Context >
 
class  basic_format_args< Context >
 
struct  formatter< T, Char, Enable >
 
struct  convert_to_int< T, Char, Enable >
 
struct  internal::dummy_string_view
 
struct  internal::is_string< S >
 
struct  internal::char_t< S >
 
struct  internal::named_arg_base< Char >
 
struct  internal::named_arg< T, Char >
 
struct  internal::string_value< Char >
 
struct  internal::custom_value< Context >
 
class  internal::value< Context >
 
struct  internal::init< Context, T, TYPE >
 
class  internal::arg_map< Context >
 
class  basic_format_arg< Context >
 
class  basic_format_arg< Context >::handle
 
struct  monostate
 
class  basic_parse_context< Char, ErrorHandler >
 
class  internal::arg_map< Context >
 
class  internal::locale_ref
 
class  internal::context_base< OutputIt, Context, Char >
 
struct  internal::get_type< Context, T >
 
class  basic_format_context< OutputIt, Char >
 
struct  basic_format_context< OutputIt, Char >::formatter_type< T >
 
struct  buffer_context< Char >
 
class  format_arg_store< Context, Args >
 
class  basic_format_args< Context >
 
struct  format_args
 
struct  wformat_args
 
struct  char_t< S >
 
struct  internal::named_arg_base< Char >
 
struct  internal::named_arg< T, Char >
 
struct  internal::checked_args< S, Args >
 
struct  is_contiguous< Container >
 
struct  is_contiguous< std::basic_string< Char > >
 
struct  is_contiguous< internal::basic_buffer< Char > >
 

Namespaces

 internal
 

Macros

#define FMT_VERSION   50202
 
#define FMT_HAS_FEATURE(x)   0
 
#define FMT_HAS_INCLUDE(x)   0
 
#define FMT_HAS_CPP_ATTRIBUTE(x)   0
 
#define FMT_GCC_VERSION   0
 
#define FMT_HAS_GXX_CXX11   0
 
#define FMT_MSC_VER   0
 
#define FMT_USE_CONSTEXPR
 
#define FMT_CONSTEXPR   inline
 
#define FMT_CONSTEXPR_DECL
 
#define FMT_USE_CONSTEXPR11   (FMT_USE_CONSTEXPR || FMT_GCC_VERSION >= 406 || FMT_MSC_VER >= 1900)
 
#define FMT_CONSTEXPR11
 
#define FMT_OVERRIDE
 
#define FMT_USE_EXPLICIT   0
 
#define FMT_EXPLICIT
 
#define FMT_NULL   NULL
 
#define FMT_USE_NULLPTR   0
 
#define FMT_EXCEPTIONS   1
 
#define FMT_USE_NOEXCEPT   0
 
#define FMT_DETECTED_NOEXCEPT   throw()
 
#define FMT_HAS_CXX11_NOEXCEPT   0
 
#define FMT_NOEXCEPT   FMT_DETECTED_NOEXCEPT
 
#define FMT_INLINE_NAMESPACE   namespace
 
#define FMT_END_NAMESPACE   } using namespace v5; }
 
#define FMT_BEGIN_NAMESPACE   namespace fmt { FMT_INLINE_NAMESPACE v5 {
 
#define FMT_API
 
#define FMT_ASSERT(condition, message)   assert((condition) && message)
 
#define FMT_MAKE_VALUE(TAG, ArgType, ValueType)
 
#define FMT_MAKE_VALUE_SAME(TAG, Type)
 
#define FMT_USE_ALIAS_TEMPLATES   FMT_HAS_FEATURE(cxx_alias_templates)
 
#define FMT_CHAR(S)   typename char_t<S>::type
 
#define FMT_ENABLE_IF_STRING(S, T)   typename std::enable_if<internal::is_string<S>::value, T>::type
 

Typedefs

typedef basic_buffer< char > internal::buffer
 
typedef basic_buffer< wchar_t > internal::wbuffer
 
typedef basic_string_view< char > string_view
 
typedef basic_string_view
< wchar_t > 
wstring_view
 
typedef std::conditional
< sizeof(long)==sizeof(int),
int, long long >::type 
internal::long_type
 
typedef basic_parse_context< char > format_parse_context
 
typedef basic_parse_context
< wchar_t > 
wformat_parse_context
 
typedef basic_parse_context< char > parse_context
 
typedef basic_parse_context
< wchar_t > 
wparse_context
 
typedef buffer_context< char >
::type 
format_context
 
typedef buffer_context
< wchar_t >::type 
wformat_context
 

Enumerations

enum  internal::type {
  internal::none_type, internal::named_arg_type, internal::int_type, internal::uint_type,
  internal::long_long_type, internal::ulong_long_type, internal::bool_type, internal::char_type,
  internal::last_integer_type = char_type, internal::double_type, internal::long_double_type, internal::last_numeric_type = long_double_type,
  internal::cstring_type, internal::string_type, internal::pointer_type, internal::custom_type
}
 
enum  { internal::max_packed_args = 15 }
 

Functions

template<typename T >
std::add_rvalue_reference< T >
::type 
internal::declval () FMT_NOEXCEPT
 
template<typename Int >
FMT_CONSTEXPR
std::make_unsigned< Int >
::type 
internal::to_unsigned (Int value)
 
template<typename Container >
Container & internal::get_container (std::back_insert_iterator< Container > it)
 
template<typename Char >
basic_string_view< Char > to_string_view (basic_string_view< Char > s)
 
template<typename Char >
basic_string_view< Char > to_string_view (const std::basic_string< Char > &s)
 
template<typename Char >
basic_string_view< Char > to_string_view (const Char *s)
 
template<typename S , typename Enable = typename std::enable_if<is_compile_string<S>::value>::type>
FMT_CONSTEXPR
basic_string_view< typename
S::char_type > 
to_string_view (const S &s)
 
dummy_string_view internal::to_string_view (...)
 
FMT_CONSTEXPR bool internal::is_integral (type t)
 
FMT_CONSTEXPR bool internal::is_arithmetic (type t)
 
template<typename Context , typename T >
FMT_CONSTEXPR basic_format_arg
< Context > 
internal::make_arg (const T &value)
 
FMT_MAKE_VALUE((sizeof(long)==sizeof(int)?int_type:long_long_type),
long, long_type) typedef std 
internal::FMT_MAKE_VALUE ((sizeof(unsigned long)==sizeof(unsigned)?uint_type:ulong_long_type), unsigned long, ulong_type) template< typename C
 
FMT_MAKE_VALUE((sizeof(long)==sizeof(int)?int_type:long_long_type),
long, long_type) typedef std
Char FMT_CONSTEXPR
std::enable_if< std::is_same
< typename C::char_type, Char >
::value, init< C, int,
char_type > >::type 
internal::make_value (Char val)
 
template<typename C >
FMT_CONSTEXPR std::enable_if
< !std::is_same< typename
C::char_type, char >::value,
init< C, int, char_type >
>::type 
internal::make_value (char val)
 
 internal::FMT_MAKE_VALUE (cstring_type, typename C::char_type *, const typename C::char_type *) FMT_MAKE_VALUE(cstring_type
 
const C::char_type const
C::char_type * 
internal::FMT_MAKE_VALUE (string_type, typename basic_string_view< typename C::char_type >::type, basic_string_view< typename C::char_type >) FMT_MAKE_VALUE(string_type
 
template<typename C , typename T >
const C::char_type const
C::char_type const
std::basic_string< typename
C::char_type >
basic_string_view< typename
C::char_type > std::enable_if
<!std::is_same< T, typename
C::char_type >::value >::type 
internal::make_value (const T *)
 
template<typename C , typename T >
std::enable_if< std::is_enum
< T >::value &&convert_to_int
< T, typename C::char_type >
::value, init< C, int,
int_type > >::type 
internal::make_value (const T &val)
 
template<typename C , typename T , typename Char = typename C::char_type>
std::enable_if
< is_constructible
< basic_string_view< Char >, T >
::value &&!internal::is_string
< T >::value, init< C,
basic_string_view< Char >
, string_type > >::type 
internal::make_value (const T &val)
 
template<typename C , typename T , typename Char = typename C::char_type>
std::enable_if
< !convert_to_int< T, Char >
::value &&!std::is_same< T,
Char >::value
&&!std::is_convertible< T,
basic_string_view< Char >
>::value &&!is_constructible
< basic_string_view< Char >, T >
::value &&!internal::is_string
< T >::value, init< C, const T
&, custom_type > >::type 
internal::make_value (const T &val)
 
template<typename C , typename T >
init< C, const void
*, named_arg_type > 
internal::make_value (const named_arg< T, typename C::char_type > &val)
 
template<typename C , typename S >
FMT_CONSTEXPR11 std::enable_if
< internal::is_string< S >
::value, init< C,
basic_string_view< typename
C::char_type >, string_type >
>::type 
internal::make_value (const S &val)
 
template<typename Visitor , typename Context >
FMT_CONSTEXPR
internal::result_of< Visitor(int)>
::type 
visit_format_arg (Visitor &&vis, const basic_format_arg< Context > &arg)
 
template<typename Visitor , typename Context >
FMT_CONSTEXPR
internal::result_of< Visitor(int)>
::type 
visit (Visitor &&vis, const basic_format_arg< Context > &arg)
 
template<typename Context >
FMT_CONSTEXPR11 unsigned long long internal::get_types ()
 
template<typename Context , typename Arg , typename... Args>
FMT_CONSTEXPR11 unsigned long long internal::get_types ()
 
template<bool IS_PACKED, typename Context , typename T >
std::enable_if< IS_PACKED,
value< Context > >::type 
internal::make_arg (const T &value)
 
template<bool IS_PACKED, typename Context , typename T >
std::enable_if<!IS_PACKED,
basic_format_arg< Context >
>::type 
internal::make_arg (const T &value)
 
template<typename Context = format_context, typename... Args>
format_arg_store< Context, Args...> make_format_args (const Args &...args)
 
template<typename... Args, typename S >
std::enable_if
<!is_compile_string< S >
::value >::type 
internal::check_format_string (const S &)
 
template<typename... Args, typename S >
std::enable_if
< is_compile_string< S >
::value >::type 
internal::check_format_string (S)
 
template<typename Char >
std::basic_string< Char > internal::vformat (basic_string_view< Char > format_str, basic_format_args< typename buffer_context< Char >::type > args)
 
template<typename Char >
buffer_context< Char >
::type::iterator 
internal::vformat_to (internal::basic_buffer< Char > &buf, basic_string_view< Char > format_str, basic_format_args< typename buffer_context< Char >::type > args)
 
template<typename T >
internal::named_arg< T, char > arg (string_view name, const T &arg)
 
template<typename T >
internal::named_arg< T, wchar_t > arg (wstring_view name, const T &arg)
 
template<typename S , typename T , typename Char >
void arg (S, internal::named_arg< T, Char >)=delete
 
template<typename Container , typename S >
std::enable_if< is_contiguous
< Container >::value,
std::back_insert_iterator
< Container > >::type 
vformat_to (std::back_insert_iterator< Container > out, const S &format_str, basic_format_args< typename buffer_context< FMT_CHAR(S)>::type > args)
 
template<typename Container , typename S , typename... Args>
std::enable_if< is_contiguous
< Container >::value
&&internal::is_string< S >
::value,
std::back_insert_iterator
< Container > >::type 
format_to (std::back_insert_iterator< Container > out, const S &format_str, const Args &...args)
 
template<typename S , typename Char = FMT_CHAR(S)>
std::basic_string< Char > vformat (const S &format_str, basic_format_args< typename buffer_context< Char >::type > args)
 
template<typename S , typename... Args>
std::basic_string< FMT_CHAR(S)> format (const S &format_str, const Args &...args)
 
FMT_API void vprint (std::FILE *f, string_view format_str, format_args args)
 
FMT_API void vprint (std::FILE *f, wstring_view format_str, wformat_args args)
 
template<typename S , typename... Args>
 FMT_ENABLE_IF_STRING (S, void) print(std
 
FMT_API void vprint (string_view format_str, format_args args)
 
FMT_API void vprint (wstring_view format_str, wformat_args args)
 
const Args &args vprint (to_string_view(format_str), internal::checked_args< S, Args...>(format_str, args...))
 

Macro Definition Documentation

#define FMT_API

Definition at line 164 of file core.h.

#define FMT_ASSERT (   condition,
  message 
)    assert((condition) && message)

Definition at line 168 of file core.h.

#define FMT_BEGIN_NAMESPACE   namespace fmt { FMT_INLINE_NAMESPACE v5 {

Definition at line 153 of file core.h.

#define FMT_CHAR (   S)    typename char_t<S>::type

Definition at line 1319 of file core.h.

#define FMT_CONSTEXPR   inline

Definition at line 69 of file core.h.

#define FMT_CONSTEXPR11

Definition at line 80 of file core.h.

#define FMT_CONSTEXPR_DECL

Definition at line 70 of file core.h.

#define FMT_DETECTED_NOEXCEPT   throw()

Definition at line 132 of file core.h.

#define FMT_ENABLE_IF_STRING (   S,
 
)    typename std::enable_if<internal::is_string<S>::value, T>::type

Definition at line 1321 of file core.h.

#define FMT_END_NAMESPACE   } using namespace v5; }

Definition at line 151 of file core.h.

#define FMT_EXCEPTIONS   1

Definition at line 119 of file core.h.

#define FMT_EXPLICIT

Definition at line 98 of file core.h.

#define FMT_GCC_VERSION   0

Definition at line 43 of file core.h.

#define FMT_HAS_CPP_ATTRIBUTE (   x)    0

Definition at line 37 of file core.h.

#define FMT_HAS_CXX11_NOEXCEPT   0

Definition at line 133 of file core.h.

#define FMT_HAS_FEATURE (   x)    0

Definition at line 24 of file core.h.

#define FMT_HAS_GXX_CXX11   0

Definition at line 49 of file core.h.

#define FMT_HAS_INCLUDE (   x)    0

Definition at line 31 of file core.h.

#define FMT_INLINE_NAMESPACE   namespace

Definition at line 150 of file core.h.

#define FMT_MAKE_VALUE (   TAG,
  ArgType,
  ValueType 
)
Value:
template <typename C> \
FMT_CONSTEXPR init<C, ValueType, TAG> make_value(ArgType val) { \
return static_cast<ValueType>(val); \
}
GLuint const GLfloat * val
Definition: glew.h:2794
FMT_CONSTEXPR11 std::enable_if< internal::is_string< S >::value, init< C, basic_string_view< typename C::char_type >, string_type > >::type make_value(const S &val)
Definition: core.h:758
#define FMT_CONSTEXPR
Definition: core.h:69

Definition at line 640 of file core.h.

#define FMT_MAKE_VALUE_SAME (   TAG,
  Type 
)
Value:
template <typename C> \
FMT_CONSTEXPR init<C, Type, TAG> make_value(Type val) { return val; }
GLuint const GLfloat * val
Definition: glew.h:2794
FMT_CONSTEXPR11 std::enable_if< internal::is_string< S >::value, init< C, basic_string_view< typename C::char_type >, string_type > >::type make_value(const S &val)
Definition: core.h:758
#define FMT_CONSTEXPR
Definition: core.h:69

Definition at line 646 of file core.h.

#define FMT_MSC_VER   0

Definition at line 55 of file core.h.

#define FMT_NOEXCEPT   FMT_DETECTED_NOEXCEPT

Definition at line 138 of file core.h.

#define FMT_NULL   NULL

Definition at line 107 of file core.h.

#define FMT_OVERRIDE

Definition at line 88 of file core.h.

#define FMT_USE_ALIAS_TEMPLATES   FMT_HAS_FEATURE(cxx_alias_templates)

Definition at line 1302 of file core.h.

#define FMT_USE_CONSTEXPR
Value:
(FMT_HAS_FEATURE(cxx_relaxed_constexpr) || FMT_MSC_VER >= 1910 || \
(FMT_GCC_VERSION >= 600 && __cplusplus >= 201402L))
#define FMT_MSC_VER
Definition: core.h:55
#define FMT_GCC_VERSION
Definition: core.h:43
#define FMT_HAS_FEATURE(x)
Definition: core.h:24

Definition at line 61 of file core.h.

#define FMT_USE_CONSTEXPR11   (FMT_USE_CONSTEXPR || FMT_GCC_VERSION >= 406 || FMT_MSC_VER >= 1900)

Definition at line 74 of file core.h.

#define FMT_USE_EXPLICIT   0

Definition at line 97 of file core.h.

#define FMT_USE_NOEXCEPT   0

Definition at line 124 of file core.h.

#define FMT_USE_NULLPTR   0

Definition at line 111 of file core.h.

#define FMT_VERSION   50202

Definition at line 19 of file core.h.

Typedef Documentation

Definition at line 1124 of file core.h.

Definition at line 921 of file core.h.

Definition at line 925 of file core.h.

Definition at line 426 of file core.h.

typedef buffer_context<wchar_t>::type wformat_context

Definition at line 1125 of file core.h.

Definition at line 922 of file core.h.

Definition at line 926 of file core.h.

typedef basic_string_view<wchar_t> wstring_view

Definition at line 427 of file core.h.

Function Documentation

template<typename T >
internal::named_arg<T, char> arg ( string_view  name,
const T &  arg 
)
inline

Returns a named argument to be used in a formatting function.

Example**::

fmt::print("Elapsed time: {s:.2f} seconds", fmt::arg("s", 1.23));

Definition at line 1393 of file core.h.

template<typename T >
internal::named_arg<T, wchar_t> arg ( wstring_view  name,
const T &  arg 
)
inline

Definition at line 1398 of file core.h.

template<typename S , typename T , typename Char >
void arg ( ,
internal::named_arg< T, Char >   
)
delete
template<typename S , typename... Args>
FMT_ENABLE_IF_STRING ( ,
void   
)
inline

Prints formatted data to the file f. For wide format strings, f* should be in wide-oriented mode set via fwide(f, 1) or _setmode(_fileno(f), _O_U8TEXT) on Windows.

Example**::

fmt::print(stderr, "Don't {}!", "panic");

Prints formatted data to stdout.

Example**::

fmt::print("Elapsed time: {0:.2f} seconds", 1.23);

Definition at line 1478 of file core.h.

template<typename S , typename... Args>
std::basic_string<FMT_CHAR(S)> format ( const S &  format_str,
const Args &...  args 
)
inline

Formats arguments and returns the result as a string.

Example**::

#include <fmt/core.h> std::string message = fmt::format("The answer is {}", 42);

Definition at line 1456 of file core.h.

template<typename Container , typename S , typename... Args>
std::enable_if< is_contiguous<Container>::value && internal::is_string<S>::value, std::back_insert_iterator<Container> >::type format_to ( std::back_insert_iterator< Container >  out,
const S &  format_str,
const Args &...  args 
)
inline

Definition at line 1432 of file core.h.

template<typename Context = format_context, typename... Args>
format_arg_store<Context, Args...> make_format_args ( const Args &...  args)
inline

Constructs an ~fmtformat_arg_store object that contains references to arguments and can be implicitly converted to ~fmtformat_args. Context can be omitted in which case it defaults to ~fmtcontext.

Definition at line 1193 of file core.h.

template<typename Char >
basic_string_view<Char> to_string_view ( basic_string_view< Char >  s)
inline

The function to_string_view adapts non-intrusively any kind of string or string-like type if the user provides a (possibly templated) overload of to_string_view which takes an instance of the string class StringType<Char> and returns a fmt::basic_string_view<Char>. The conversion function must live in the very same namespace as StringType<Char> to be picked up by ADL. Non-templated string types like f.e. QString must return a basic_string_view with a fixed matching char type.

Example**::

namespace my_ns { inline string_view to_string_view(const my_string &s) { return { s.data(), s.length() }; } }

std::string message = fmt::format(my_string("The answer is {}"), 42);

Definition at line 453 of file core.h.

template<typename Char >
basic_string_view<Char> to_string_view ( const std::basic_string< Char > &  s)
inline

Definition at line 457 of file core.h.

template<typename Char >
basic_string_view<Char> to_string_view ( const Char *  s)
inline

Definition at line 460 of file core.h.

template<typename S , typename Enable = typename std::enable_if<is_compile_string<S>::value>::type>
FMT_CONSTEXPR basic_string_view<typename S::char_type> to_string_view ( const S &  s)

Definition at line 479 of file core.h.

template<typename S , typename Char = FMT_CHAR(S)>
std::basic_string<Char> vformat ( const S &  format_str,
basic_format_args< typename buffer_context< Char >::type args 
)
inline

Definition at line 1439 of file core.h.

template<typename Container , typename S >
std::enable_if< is_contiguous<Container>::value, std::back_insert_iterator<Container> >::type vformat_to ( std::back_insert_iterator< Container >  out,
const S &  format_str,
basic_format_args< typename buffer_context< FMT_CHAR(S)>::type args 
)

Formats a string and writes the output to out.

Definition at line 1419 of file core.h.

template<typename Visitor , typename Context >
FMT_CONSTEXPR internal::result_of<Visitor(int)>::type visit ( Visitor &&  vis,
const basic_format_arg< Context > &  arg 
)

Definition at line 867 of file core.h.

template<typename Visitor , typename Context >
FMT_CONSTEXPR internal::result_of<Visitor(int)>::type visit_format_arg ( Visitor &&  vis,
const basic_format_arg< Context > &  arg 
)

Visits an argument dispatching to the appropriate visit method based on the argument type. For example, if the argument type is double then vis(value) will be called with the value of type double.

Definition at line 828 of file core.h.

FMT_API void vprint ( std::FILE *  f,
string_view  format_str,
format_args  args 
)

Definition at line 944 of file format-inl.h.

FMT_API void vprint ( std::FILE *  f,
wstring_view  format_str,
wformat_args  args 
)

Definition at line 951 of file format-inl.h.

FMT_API void vprint ( string_view  format_str,
format_args  args 
)

Definition at line 957 of file format-inl.h.

FMT_API void vprint ( wstring_view  format_str,
wformat_args  args 
)

Definition at line 961 of file format-inl.h.

const Args& args vprint ( to_string_view(format_str)  ,
internal::checked_args< S, Args...>  format_str, args... 
)