RESTinio
Loading...
Searching...
No Matches
restinio
impl
include_fmtlib.hpp
Go to the documentation of this file.
1
/*
2
* RESTinio
3
*/
4
11
12
#pragma once
13
14
// Because fmt can include `windows.h` we should include
15
// Asio's header before fmt.
16
//
17
// Since v.0.6.1
18
#include <
restinio/asio_include.hpp
>
19
20
#if defined(__GNUG__) || defined(__clang__)
21
22
#pragma GCC diagnostic push
23
#pragma GCC diagnostic ignored "-Wpedantic"
24
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
25
26
#if defined(__clang__)
27
#pragma GCC diagnostic ignored "-Wgnu-string-literal-operator-template"
28
#endif
29
30
#endif
31
32
#include <fmt/format.h>
33
#include <fmt/ostream.h>
34
#if FMT_VERSION < 60000
35
#include <fmt/time.h>
36
#else
37
#include <fmt/chrono.h>
38
#endif
39
40
// Workaround for absence of fmt::runtime in fmtlib prior to v8.0.0.
41
namespace
restinio
42
{
43
44
namespace
fmtlib_tools
45
{
46
47
#if FMT_VERSION < 80000
48
inline
auto
49
runtime_format_string
(
const
char
* fmt_string )
noexcept
50
{
51
return
fmt_string;
52
}
53
#else
54
inline
auto
55
runtime_format_string
(
const
char
* fmt_string )
56
{
57
return
fmt::runtime( fmt_string );
58
}
59
#endif
60
61
#if FMT_VERSION < 90000
62
template
<
typename
T >
63
decltype
(
auto
)
streamed
( T && v )
noexcept
64
{
65
return
std::forward<T>(v);
66
}
67
#else
68
template
<
typename
T >
69
decltype
(
auto
)
streamed
( T && v )
noexcept
70
{
71
return
fmt::streamed( std::forward<T>(v) );
72
}
73
#endif
74
75
}
/* namespace fmtlib_tools */
76
77
}
/* namespace restinio */
78
79
/*
80
* NOTE: if RESTinio is used in project compiled with
81
* FMT_ENFORCE_COMPILE_STRING then a format_string for fmt::format
82
* and fmt::print function has to be specified via FMT_STRING macro.
83
*
84
* To cope with this a new macro RESTINIO_FMT_FORMAT_STRING(s) was
85
* introduced in v.0.6.17. It's expanded into FMT_STRING(s) if
86
* FMT_ENFORCE_COMPILE_STRING is set, otherwise it's just s.
87
*/
88
89
#if defined(FMT_ENFORCE_COMPILE_STRING)
90
#define RESTINIO_FMT_FORMAT_STRING(s) FMT_STRING(s)
91
#else
92
#define RESTINIO_FMT_FORMAT_STRING(s) s
93
#endif
94
95
#if defined(__GNUG__) || defined(__clang__)
96
97
#pragma GCC diagnostic pop
98
99
#endif
asio_include.hpp
restinio::fmtlib_tools
Definition
include_fmtlib.hpp:45
restinio::fmtlib_tools::runtime_format_string
auto runtime_format_string(const char *fmt_string) noexcept
Definition
include_fmtlib.hpp:49
restinio::fmtlib_tools::streamed
decltype(auto) streamed(T &&v) noexcept
Definition
include_fmtlib.hpp:63
restinio
Definition
asio_include.hpp:21
Generated by
1.13.2