kanzi::detail::LogArgumentFormat Class Reference

Represents log message argument formatting interface. More...

#include <kanzi/core/log/log_argument_format.hpp>

Public Types

enum  PresentationTypeSpecifier {
  CharacterPresentationTypeSpecifier, UnsignedDecimalPresentationTypeSpecifier, DecimalPresentationTypeSpecifier, UnsignedOctalPresentationTypeSpecifier,
  UnsignedHexidecimalPresentationTypeSpecifier, UnsignedHexidecimalUppercasePresentationTypeSpecifier, StringPresentationTypeSpecifier, PointerPresentationTypeSpecifier,
  FloatingPointDecimalPresentationTypeSpecifier, FloatingPointDecimalUppercasePresentationTypeSpecifier, FloatingPointExponentPresentationTypeSpecifier, FloatingPointExponentUppercasePresentationTypeSpecifier,
  FloatingPointHexidecimalPresentationTypeSpecifier, FloatingPointHexidecimalUppercasePresentationTypeSpecifier, FloatingPointAdaptivePresentationTypeSpecifier, FloatingPointAdaptiveUppercasePresentationTypeSpecifier
}
 Enumerates various presentation types supported by the formatting. More...
 
typedef string(* ConversionFunction) (string_view formatString, const void *value)
 Declares pointer type to function used to convert void argument pointer to string. More...
 
typedef optional< PresentationTypeSpecifierOptionalPresentationTypeSpecifier
 Optional presentation type specifier. More...
 
typedef string_view(* PresentationTypeSpecifierToStringConversionFunction) (OptionalPresentationTypeSpecifier presentationTypeSpecifier)
 The pointer type to the function that converts type presentation specifier to printf specifier. More...
 

Public Member Functions

const char * getFormatString () const
 Returns printf format string that is used with sprintf to convert the value to string. More...
 

Static Public Member Functions

template<typename T >
static enable_if< LogArgumentSupportsFormatting< T >::value, string >::type convertToString (string_view formatString, const void *valueVoidReference)
 Uses type information of the argument to convert pointer to the value to string representation of the value. More...
 
template<typename T >
static enable_if<!LogArgumentSupportsFormatting< T >::value, string >::type convertToString (string_view formatString, const void *valueVoidReference)
 Uses type information of the argument to convert pointer to the value to string representation of the value. More...
 

Detailed Description

Represents log message argument formatting interface.

This class incapsulates interface used by ::detail::kanzi::LogArgumentTypeEraser and ::detail::LogRecord to convert the log message format argument to string. For details, see Log message formating.

Member Typedef Documentation

typedef string(* kanzi::detail::LogArgumentFormat::ConversionFunction) (string_view formatString, const void *value)

Declares pointer type to function used to convert void argument pointer to string.

typedef string_view(* kanzi::detail::LogArgumentFormat::PresentationTypeSpecifierToStringConversionFunction) (OptionalPresentationTypeSpecifier presentationTypeSpecifier)

The pointer type to the function that converts type presentation specifier to printf specifier.

Member Enumeration Documentation

Enumerates various presentation types supported by the formatting.

Enumerator
CharacterPresentationTypeSpecifier 
UnsignedDecimalPresentationTypeSpecifier 
DecimalPresentationTypeSpecifier 
UnsignedOctalPresentationTypeSpecifier 
UnsignedHexidecimalPresentationTypeSpecifier 
UnsignedHexidecimalUppercasePresentationTypeSpecifier 
StringPresentationTypeSpecifier 
PointerPresentationTypeSpecifier 
FloatingPointDecimalPresentationTypeSpecifier 
FloatingPointDecimalUppercasePresentationTypeSpecifier 
FloatingPointExponentPresentationTypeSpecifier 
FloatingPointExponentUppercasePresentationTypeSpecifier 
FloatingPointHexidecimalPresentationTypeSpecifier 
FloatingPointHexidecimalUppercasePresentationTypeSpecifier 
FloatingPointAdaptivePresentationTypeSpecifier 
FloatingPointAdaptiveUppercasePresentationTypeSpecifier 

Member Function Documentation

template<typename T >
static enable_if<LogArgumentSupportsFormatting<T>::value, string>::type kanzi::detail::LogArgumentFormat::convertToString ( string_view  formatString,
const void *  valueVoidReference 
)
inlinestatic

Uses type information of the argument to convert pointer to the value to string representation of the value.

The argument value is converted according to format string supplied. This template function is only instantiated for the types that support formatting, i.e. integral types, pointers, arrays but not user defined types.

Parameters
formatStringThe format specification.
valueVoidReferenceThe pointer to the argument value.
Returns
The argument value converted to the string using supplied format specification.
template<typename T >
static enable_if<!LogArgumentSupportsFormatting<T>::value, string>::type kanzi::detail::LogArgumentFormat::convertToString ( string_view  formatString,
const void *  valueVoidReference 
)
inlinestatic

Uses type information of the argument to convert pointer to the value to string representation of the value.

The argument value is converted according to format string supplied. This template function is instantiated for types that do not support formatting, i.e. user defined types.

Parameters
formatStringThe format specification.
valueVoidReferenceThe pointer to the argument value.
Returns
The argument value converted to string using supplied format specification.
const char* kanzi::detail::LogArgumentFormat::getFormatString ( ) const
inline

Returns printf format string that is used with sprintf to convert the value to string.

For details, see LogArgumentFormat().

Returns
printf compatible format string

The documentation for this class was generated from the following file: