souffle  2.0.2-371-g6315b36
Public Member Functions | Static Private Member Functions | Private Attributes
tinyformat::detail::FormatArg Class Reference

#include <tinyformat.h>

Collaboration diagram for tinyformat::detail::FormatArg:
Collaboration graph

Public Member Functions

void format (std::ostream &out, const char *fmtBegin, const char *fmtEnd, int ntrunc) const
 
 FormatArg ()=default
 
template<typename T >
 FormatArg (const T &value)
 
int toInt () const
 

Static Private Member Functions

template<typename T >
static TINYFORMAT_HIDDEN void formatImpl (std::ostream &out, const char *fmtBegin, const char *fmtEnd, int ntrunc, const void *value)
 
template<typename T >
static TINYFORMAT_HIDDEN int toIntImpl (const void *value)
 

Private Attributes

void(* m_formatImpl )(std::ostream &out, const char *fmtBegin, const char *fmtEnd, int ntrunc, const void *value) = nullptr
 
int(* m_toIntImpl )(const void *value) = nullptr
 
const void * m_value = nullptr
 

Detailed Description

Definition at line 506 of file tinyformat.h.

Constructor & Destructor Documentation

◆ FormatArg() [1/2]

tinyformat::detail::FormatArg::FormatArg ( )
default

◆ FormatArg() [2/2]

template<typename T >
tinyformat::detail::FormatArg::FormatArg ( const T &  value)
inline

Definition at line 512 of file tinyformat.h.

513  : m_value(static_cast<const void*>(&value)),
514  m_formatImpl(&formatImpl<T>),
515  m_toIntImpl(&toIntImpl<T>)
516  { }

Member Function Documentation

◆ format()

void tinyformat::detail::FormatArg::format ( std::ostream &  out,
const char *  fmtBegin,
const char *  fmtEnd,
int  ntrunc 
) const
inline

Definition at line 518 of file tinyformat.h.

520  {
523  m_formatImpl(out, fmtBegin, fmtEnd, ntrunc, m_value);
524  }

References m_formatImpl, m_value, and TINYFORMAT_ASSERT.

Referenced by tinyformat::detail::formatImpl().

◆ formatImpl()

template<typename T >
static TINYFORMAT_HIDDEN void tinyformat::detail::FormatArg::formatImpl ( std::ostream &  out,
const char *  fmtBegin,
const char *  fmtEnd,
int  ntrunc,
const void *  value 
)
inlinestaticprivate

Definition at line 535 of file tinyformat.h.

537  {
538  formatValue(out, fmtBegin, fmtEnd, ntrunc, *static_cast<const T*>(value));
539  }

References tinyformat::formatValue().

Here is the call graph for this function:

◆ toInt()

int tinyformat::detail::FormatArg::toInt ( ) const
inline

Definition at line 526 of file tinyformat.h.

527  {
530  return m_toIntImpl(m_value);
531  }

References m_toIntImpl, m_value, and TINYFORMAT_ASSERT.

Referenced by tinyformat::detail::parseWidthOrPrecision().

◆ toIntImpl()

template<typename T >
static TINYFORMAT_HIDDEN int tinyformat::detail::FormatArg::toIntImpl ( const void *  value)
inlinestaticprivate

Definition at line 542 of file tinyformat.h.

543  {
544  return convertToInt<T>::invoke(*static_cast<const T*>(value));
545  }

References tinyformat::detail::convertToInt< T, convertible >::invoke().

Here is the call graph for this function:

Field Documentation

◆ m_formatImpl

void(* tinyformat::detail::FormatArg::m_formatImpl) (std::ostream &out, const char *fmtBegin, const char *fmtEnd, int ntrunc, const void *value) = nullptr
private

Definition at line 548 of file tinyformat.h.

Referenced by format().

◆ m_toIntImpl

int(* tinyformat::detail::FormatArg::m_toIntImpl) (const void *value) = nullptr
private

Definition at line 550 of file tinyformat.h.

Referenced by toInt().

◆ m_value

const void* tinyformat::detail::FormatArg::m_value = nullptr
private

Definition at line 547 of file tinyformat.h.

Referenced by format(), and toInt().


The documentation for this class was generated from the following file:
tinyformat::detail::FormatArg::m_formatImpl
void(* m_formatImpl)(std::ostream &out, const char *fmtBegin, const char *fmtEnd, int ntrunc, const void *value)
Definition: tinyformat.h:548
tinyformat::detail::FormatArg::m_value
const void * m_value
Definition: tinyformat.h:547
TINYFORMAT_ASSERT
#define TINYFORMAT_ASSERT(cond)
Definition: tinyformat.h:154
tinyformat::detail::FormatArg::m_toIntImpl
int(* m_toIntImpl)(const void *value)
Definition: tinyformat.h:550
tinyformat::formatValue
void formatValue(std::ostream &out, const char *, const char *fmtEnd, int ntrunc, const T &value)
Format a value into a stream, delegating to operator<< by default.
Definition: tinyformat.h:328
tinyformat::detail::convertToInt::invoke
static int invoke(const T &)
Definition: tinyformat.h:271