mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-09 12:50:05 +00:00
Cleanup base API
This commit is contained in:
parent
a86b1acf6a
commit
4f39d88650
@ -657,7 +657,6 @@ using buffered_context =
|
||||
conditional_t<std::is_same<Char, char>::value, context,
|
||||
generic_context<basic_appender<Char>, Char>>;
|
||||
|
||||
template <typename Context> struct arg_mapper;
|
||||
FMT_EXPORT template <typename Context> class basic_format_arg;
|
||||
FMT_EXPORT template <typename Context> class basic_format_args;
|
||||
FMT_EXPORT template <typename Context> class dynamic_format_arg_store;
|
||||
@ -694,6 +693,11 @@ struct has_to_string_view<
|
||||
T, void_t<decltype(detail::to_string_view(std::declval<T>()))>>
|
||||
: std::true_type {};
|
||||
|
||||
/// String's character (code unit) type. detail:: is intentional to prevent ADL.
|
||||
template <typename S,
|
||||
typename V = decltype(detail::to_string_view(std::declval<S>()))>
|
||||
using char_t = typename V::value_type;
|
||||
|
||||
template <typename Char>
|
||||
using unsigned_char = typename conditional_t<std::is_integral<Char>::value,
|
||||
std::make_unsigned<Char>,
|
||||
@ -825,11 +829,6 @@ FMT_DEPRECATED FMT_NORETURN inline void throw_format_error(
|
||||
report_error(message);
|
||||
}
|
||||
|
||||
/// String's character (code unit) type.
|
||||
template <typename S,
|
||||
typename V = decltype(detail::to_string_view(std::declval<S>()))>
|
||||
using char_t = typename V::value_type;
|
||||
|
||||
enum class presentation_type : unsigned char {
|
||||
// Common specifiers:
|
||||
none = 0,
|
||||
@ -2098,10 +2097,6 @@ template <typename T> struct format_as_result {
|
||||
};
|
||||
template <typename T> using format_as_t = typename format_as_result<T>::type;
|
||||
|
||||
template <typename T>
|
||||
struct has_format_as
|
||||
: bool_constant<!std::is_same<format_as_t<T>, void>::value> {};
|
||||
|
||||
#define FMT_MAP_API static FMT_CONSTEXPR FMT_ALWAYS_INLINE
|
||||
|
||||
// Maps formatting arguments to reduce the set of types we need to work with.
|
||||
|
@ -3820,6 +3820,10 @@ FMT_API void format_error_code(buffer<char>& out, int error_code,
|
||||
using fmt::report_error;
|
||||
FMT_API void report_error(format_func func, int error_code,
|
||||
const char* message) noexcept;
|
||||
|
||||
template <typename T>
|
||||
struct has_format_as
|
||||
: bool_constant<!std::is_same<format_as_t<T>, void>::value> {};
|
||||
} // namespace detail
|
||||
|
||||
FMT_BEGIN_EXPORT
|
||||
|
@ -618,7 +618,7 @@ inline auto vsprintf(basic_string_view<Char> fmt,
|
||||
*
|
||||
* std::string message = fmt::sprintf("The answer is %d", 42);
|
||||
*/
|
||||
template <typename S, typename... T, typename Char = char_t<S>>
|
||||
template <typename S, typename... T, typename Char = detail::char_t<S>>
|
||||
inline auto sprintf(const S& fmt, const T&... args) -> std::basic_string<Char> {
|
||||
return vsprintf(detail::to_string_view(fmt),
|
||||
fmt::make_format_args<basic_printf_context<Char>>(args...));
|
||||
@ -643,7 +643,7 @@ inline auto vfprintf(std::FILE* f, basic_string_view<Char> fmt,
|
||||
*
|
||||
* fmt::fprintf(stderr, "Don't %s!", "panic");
|
||||
*/
|
||||
template <typename S, typename... T, typename Char = char_t<S>>
|
||||
template <typename S, typename... T, typename Char = detail::char_t<S>>
|
||||
inline auto fprintf(std::FILE* f, const S& fmt, const T&... args) -> int {
|
||||
return vfprintf(f, detail::to_string_view(fmt),
|
||||
make_printf_args<Char>(args...));
|
||||
|
Loading…
Reference in New Issue
Block a user