fmt
Loading...
Searching...
No Matches
format.cpp File Reference
module fmt

Implementation unit for the core formatting code. More...

#include "fmt/macros.hpp"
#include <cerrno>
#include <climits>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <version>
import fmt:format;
import std;

Classes

struct  fmt::detail::locale
struct  fmt::detail::numpunct< Char >
struct  fmt::detail::dragonbox::DivSmallPow10InfosStruct
struct  fmt::detail::dragonbox::CacheAccessor< float >
struct  fmt::detail::dragonbox::CacheAccessor< float >::ComputeMulResult
struct  fmt::detail::dragonbox::CacheAccessor< float >::ComputeMulParityResult
struct  fmt::detail::dragonbox::CacheAccessor< double >
struct  fmt::detail::dragonbox::CacheAccessor< double >::ComputeMulResult
struct  fmt::detail::dragonbox::CacheAccessor< double >::ComputeMulParityResult
struct  fmt::Formatter< detail::Bigint >
struct  fmt::detail::Span< T >
struct  fmt::detail::HasFlockfile< F, Enable >
struct  fmt::detail::HasFlockfile< F, void_t< decltype(flockfile(&std::declval< F & >()))> >
class  fmt::detail::FileBase< F >
class  fmt::detail::GlibcFile< F >
class  fmt::detail::AppleFile< F >
class  fmt::detail::FallbackFile< F >
class  fmt::detail::FilePrintBuffer< F, Enable >
class  fmt::detail::FilePrintBuffer< F, enable_if_t< HasFlockfile< F >::value > >
struct  fmt::detail::Singleton

Typedefs

using fmt::detail::file_ref = decltype(getFile(static_cast<FILE*>(nullptr), 0))

Functions

void fmt::assertFail (const char *file, int line, const char *message)
template<typename Facet>
Facet fmt::detail::use_facet (locale)
auto fmt::detail::allocate (size_t size) -> void *
auto fmt::detail::formatErrorCode (Buffer< char > &out, int error_code, StringView message) noexcept -> void
auto fmt::detail::doReportError (FormatFunc func, int error_code, const char *message) noexcept -> void
auto fmt::detail::fwriteAll (const void *ptr, size_t count, FILE *stream) -> void
template<typename Char>
auto fmt::detail::thousandsSepImpl (LocaleRef loc) -> ThousandsSepResult< Char >
template<typename Char>
auto fmt::detail::decimalPointImpl (LocaleRef loc) -> Char
void fmt::reportError (const char *message)
auto fmt::vsystemError (int error_code, StringView fmt, FormatArgs args) -> std::system_error
template<typename F>
auto fmt::detail::operator== (BasicFp< F > x, BasicFp< F > y) -> bool
auto fmt::detail::rotr (std::uint32_t n, std::uint32_t r) noexcept -> std::uint32_t
auto fmt::detail::rotr (std::uint64_t n, std::uint32_t r) noexcept -> std::uint64_t
auto fmt::detail::dragonbox::umul96Upper64 (std::uint32_t x, std::uint64_t y) noexcept -> std::uint64_t
auto fmt::detail::dragonbox::umul192Lower128 (std::uint64_t x, Uint128 y) noexcept -> Uint128
auto fmt::detail::dragonbox::umul96Lower64 (std::uint32_t x, std::uint64_t y) noexcept -> std::uint64_t
auto fmt::detail::dragonbox::floorLog10Pow2MinusLog104Over3 (int e) noexcept -> int
template<int N>
auto fmt::detail::dragonbox::checkDivisibilityAndDivideByPow10 (std::uint32_t &n) noexcept -> bool
template<int N>
auto fmt::detail::dragonbox::smallDivisionByPow10 (std::uint32_t n) noexcept -> std::uint32_t
auto fmt::detail::dragonbox::divideBy10ToKappaPlus1 (std::uint32_t n) noexcept -> std::uint32_t
auto fmt::detail::dragonbox::divideBy10ToKappaPlus1 (std::uint64_t n) noexcept -> std::uint64_t
auto fmt::detail::dragonbox::getCachedPower (int k) noexcept -> Uint128
template<typename T>
auto fmt::detail::dragonbox::isLeftEndpointIntegerShorterInterval (int exponent) noexcept -> bool
auto fmt::detail::dragonbox::removeTrailingZeros (std::uint32_t &n, int s=0) noexcept -> int
auto fmt::detail::dragonbox::removeTrailingZeros (std::uint64_t &n) noexcept -> int
template<typename T>
auto fmt::detail::dragonbox::shorterIntervalCase (int exponent) noexcept -> DecimalFp< T >
template<typename T>
auto fmt::detail::dragonbox::toDecimal (T x) noexcept -> DecimalFp< T >
auto fmt::formatSystemError (detail::Buffer< char > &out, int error_code, const char *message) noexcept -> void
auto fmt::reportSystemError (int error_code, const char *message) noexcept -> void
auto fmt::vformat (StringView fmt, FormatArgs args) -> std::string
auto fmt::detail::vformatTo (Buffer< char > &buf, StringView fmt, FormatArgs args, LocaleRef loc={}) -> void
template<typename F>
auto fmt::detail::flockfile (F *f) -> decltype(_lock_file(f))
template<typename F>
auto fmt::detail::funlockfile (F *f) -> decltype(_unlock_file(f))
template<typename F>
auto fmt::detail::getc_unlocked (F *f) -> decltype(_fgetc_nolock(f))
template<typename F>
requires (sizeof(F::_p) != 0 && !FMT_USE_FALLBACK_FILE)
auto fmt::detail::getFile (F *f, int) -> AppleFile< F >
template<typename F>
requires (sizeof(F::_IO_read_ptr) != 0 && !FMT_USE_FALLBACK_FILE)
auto fmt::detail::getFile (F *f, int) -> GlibcFile< F >
auto fmt::detail::getFile (FILE *f,...) -> FallbackFile< FILE >
auto fmt::detail::writeConsole (int fd, StringView text) -> bool
auto fmt::detail::print (std::FILE *f, StringView text) -> void
auto fmt::vprintBuffered (std::FILE *f, StringView fmt, FormatArgs args) -> void
auto fmt::vprint (std::FILE *f, StringView fmt, FormatArgs args) -> void
auto fmt::vprintln (std::FILE *f, StringView fmt, FormatArgs args) -> void
auto fmt::vprint (StringView fmt, FormatArgs args) -> void
auto fmt::detail::isPrintable (std::uint16_t x, const Singleton *singletons, size_t singletons_size, const unsigned char *singleton_lowers, const unsigned char *normal, size_t normal_size) -> bool
auto fmt::detail::isPrintable (std::uint32_t cp) -> bool
template auto fmt::detail::thousandsSepImpl (LocaleRef) -> ThousandsSepResult< char >
template auto fmt::detail::decimalPointImpl (LocaleRef) -> char

Variables

template<typename Locale>
Locale::id fmt::FormatFacet< Locale >::id
constexpr struct fmt::detail::dragonbox::DivSmallPow10InfosStruct fmt::detail::dragonbox::div_small_pow10_infos [] = {{10, 16}, {100, 16}}

Detailed Description

Implementation unit for the core formatting code.

Holds the out-of-line definitions and the explicit instantiations, so that they are compiled once rather than in every importer.

Function Documentation

◆ formatSystemError()

auto fmt::formatSystemError ( detail::Buffer< char > & out,
int error_code,
const char * message ) -> void
exportnoexcept

Formats an error message for an error returned by an operating system or a language runtime, for example a file opening error, and writes it to out. The format is the same as the one used by std::system_error(ec, message) where ec is std::error_code(error_code, std::generic_category()). It is implementation-defined but normally looks like:

<message>: <system-message>

where <message> is the passed message and <system-message> is the system message corresponding to the error code. error_code is a system error code as given by errno.

◆ reportError()

auto fmt::reportError ( const char * message)
export

Reports a format error at compile time or, via a format_error exception, at runtime.

◆ reportSystemError()

auto fmt::reportSystemError ( int error_code,
const char * message ) -> void
exportnoexcept

Reports a system error without throwing, for use in destructors.

Parameters
error_codea system error code, as given by errno.
messagethe message to prefix the system message with.

◆ vprint()

auto fmt::vprint ( StringView fmt,
FormatArgs args ) -> void
export

Type-erased form of print to stdout.