Synesis Software STLSoft - ... Robust, Lightweight, Cross-platform, Template Software ...

fastformat::util Namespace Reference


Detailed Description

FastFormat utility namespace.


Classes

struct  auto_buffer_selector
 A Type Generator that deduces the appropriate specialisation of stlsoft::auto_buffer. More...

Functions

size_t calculate_number_of_windows_replacement_parameters (ff_char_t const *str, size_t len)
 Calculates the number of replacement parameters in a Windows format string.
size_t calculate_number_of_fastformat_replacement_parameters (ff_char_t const *str, size_t len)
 Calculates the number of replacement parameters in a FastFormat format string.
template<typename S>
change_windows_replacement_parameters_to_fastformat (S const &str)
 Converts a Windows format string to a FastFormat.Format format string.
template<typename S>
escape_fastformat_replacement_parameters (S const &str)
 Converts a literal string into a FastFormat.Format compatible string by replacing any '{' characters with a sequence of "{{".
template<typename B>
size_t concat_slices (B &buff, size_t numResults, ff_string_slice_t const *results)
 Writes a number of slices into a buffer pre-allocated to have sufficient space.
size_t concat_slices (size_t cchBuff, ff_char_t *buff, size_t numResults, ff_string_slice_t const *results)
 Writes a number of slices into a character array that must have sufficient space.


Function Documentation

size_t fastformat::util::calculate_number_of_fastformat_replacement_parameters ( ff_char_t const *  str,
size_t  len 
) [inline]

Calculates the number of replacement parameters in a FastFormat format string.

Parameters:
str Pointer to the string
len Length of the string
Returns:
The number of replacement parameters

size_t fastformat::util::calculate_number_of_windows_replacement_parameters ( ff_char_t const *  str,
size_t  len 
) [inline]

Calculates the number of replacement parameters in a Windows format string.

Parameters:
str Pointer to the string
len Length of the string
Returns:
The number of replacement parameters

S fastformat::util::change_windows_replacement_parameters_to_fastformat ( S const &  str  )  [inline]

Converts a Windows format string to a FastFormat.Format format string.

References FASTFORMAT_LITERAL_STRING.

size_t fastformat::util::concat_slices ( size_t  cchBuff,
ff_char_t *  buff,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes a number of slices into a character array that must have sufficient space.

Parameters:
cchBuff The number of characters in the array pointed to by the buff parameter
buff A pointer to an array that has sufficient space to hold all the elements
numResults The number of entries in the array pointed to by the results parameter
results Pointer to an array of string_slice_t elements to be written into buff.

References ff_string_slice_t::len, and ff_string_slice_t::ptr.

Referenced by fastformat::sinks::fmt_slices(), WindowsMessageBox_sink::write(), speech_sink::write(), and OutputDebugString_sink::write().

size_t fastformat::util::concat_slices ( B &  buff,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes a number of slices into a buffer pre-allocated to have sufficient space.

Parameters:
buff A mutable (non-const) reference to a buffer that has sufficient space to hold all the elements
numResults The number of entries in the array pointed to by the results parameter
results Pointer to an array of string_slice_t elements to be written into buff.
Remarks:
The buffer may be any type that is structurally conformant to stlsoft::auto_buffer to the degree of having a subscript operator that returns a mutable (non-const) reference to the start of the contiguously arrayed elements, and a non-mutable (const) size() method returning the number of elements available to be written.

References ff_string_slice_t::len, and ff_string_slice_t::ptr.

S fastformat::util::escape_fastformat_replacement_parameters ( S const &  str  )  [inline]

Converts a literal string into a FastFormat.Format compatible string by replacing any '{' characters with a sequence of "{{".


FastFormat Library documentation Matthew Wilson, 2006-2009 SourceForge.net Logo