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

fastformat::sinks Namespace Reference


Detailed Description

Namespace within which FastFormat sink functions are defined.

Remarks:
This namespace is designed to contain the fmt_slices() action shim, and is open for extension by users who may define their own overloads of the shim


Classes

class  c_string_sink
 Sink for translating a statement into c_string instructions. More...
class  char_buffer_sink
 Sink for translating a statement into char_buffer instructions. More...
struct  null_sink
 A class that acts as a bit-bucket sink. More...
class  OutputDebugString_sink
 Sink for sending a statement to Windows' OutputDebugString(). More...
class  shim_string_sink
 This class acts as a sink for string shims, to be used with STLSoft 1.9. More...
class  speech_sink
 Sink for translating a statement into speech. More...
class  string_array_sink
 Sink for translating a statement into an entry in an array of strings. More...
class  vectored_file_sink
 Sink for translating a statement into iovec instructions. More...
class  WindowsMessageBox_sink
 Sink for sending a statement to Windows' MessageBox(). More...

Functions

template<typename S>
S & fmt_slices (S &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Action shim for generic string types.
ACE_CString & fmt_slices (ACE_CString &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a ACE_CString sink.
template<typename C, size_t N, typename A>
stlsoft::auto_buffer< C, N, A > & fmt_slices (stlsoft::auto_buffer< C, N, A > &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Formats into an auto_buffer.
c_string_sinkfmt_slices (c_string_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Formats into a c_string.
CComBSTR & fmt_slices (CComBSTR &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a CComBSTR sink.
char_buffer_sinkfmt_slices (char_buffer_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Formats into a char_buffer.
CString & fmt_slices (CString &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a CString sink.
FILE *& fmt_slices (FILE *&sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a FILE* sink.
null_sinkfmt_slices (null_sink &sink, int, size_t cchTotal, size_t numResults, ff_string_slice_t const *)
 Writes an array of string slices into a null_sink sink.
std::basic_ostream< ff_char_t > & fmt_slices (std::basic_ostream< ff_char_t > &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a std::ostream sink.
OutputDebugString_sinkfmt_slices (OutputDebugString_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices to Windows' OutputDebugString().
char const * c_str_data_a (shim_string_sink const &sink)
 Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string.
ff_char_t const * c_str_data (shim_string_sink const &sink)
 Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string.
size_t c_str_len_a (shim_string_sink const &sink)
 Returns the number of characters in the length of the C-style string representing the shim string.
size_t c_str_len (shim_string_sink const &sink)
 Returns the number of characters in the length of the C-style string representing the shim string.
speech_sinkfmt_slices (speech_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a speech sink.
string_array_sinkfmt_slices (string_array_sink &sink, int flags, size_t, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a string array sink.
std::basic_stringstream
< ff_char_t > & 
fmt_slices (std::basic_stringstream< ff_char_t > &sink, int flags, size_t, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a std::stringstream sink.
vectored_file_sinkfmt_slices (vectored_file_sink &sink, int flags, size_t, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into an iovec sink.
WindowsMessageBox_sink MessageBox (HWND hwnd, LPCTSTR caption, UINT type)
 Creator function for the WindowsMessageBox_sink class.
WindowsMessageBox_sink MessageBox (LPCTSTR caption, UINT type)
 Creator function for the WindowsMessageBox_sink class.
WindowsMessageBox_sinkfmt_slices (WindowsMessageBox_sink &sink, int flags, size_t cchTotal, size_t numResults, ff_string_slice_t const *results)
 Writes an array of string slices into a WindowsMessageBox_sink sink.


Function Documentation

ff_char_t const* fastformat::sinks::c_str_data ( shim_string_sink const &  sink  )  [inline]

Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string.

char const* fastformat::sinks::c_str_data_a ( shim_string_sink const &  sink  )  [inline]

Returns a possibly non-nul-terminated non-NULL C-style string representing the shim string.

Examples:
examples/example.overload.2.custom_type.string_access_shims/example.overload.2.custom_type.string_access_shims.cpp.

size_t fastformat::sinks::c_str_len ( shim_string_sink const &  sink  )  [inline]

Returns the number of characters in the length of the C-style string representing the shim string.

References shim_string_sink::size().

Referenced by shim_string_sink::append().

size_t fastformat::sinks::c_str_len_a ( shim_string_sink const &  sink  )  [inline]

Returns the number of characters in the length of the C-style string representing the shim string.

Examples:
examples/example.overload.2.custom_type.string_access_shims/example.overload.2.custom_type.string_access_shims.cpp.

WindowsMessageBox_sink& fastformat::sinks::fmt_slices ( WindowsMessageBox_sink &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into a WindowsMessageBox_sink sink.

References WindowsMessageBox_sink::write().

vectored_file_sink& fastformat::sinks::fmt_slices ( vectored_file_sink &  sink,
int  flags,
size_t  ,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into an iovec sink.

References vectored_file_sink::write().

std::basic_stringstream<ff_char_t>& fastformat::sinks::fmt_slices ( std::basic_stringstream< ff_char_t > &  sink,
int  flags,
size_t  ,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into a std::stringstream sink.

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

string_array_sink& fastformat::sinks::fmt_slices ( string_array_sink &  sink,
int  flags,
size_t  ,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into a string array sink.

References string_array_sink::write().

speech_sink& fastformat::sinks::fmt_slices ( speech_sink &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into a speech sink.

References speech_sink::write().

OutputDebugString_sink& fastformat::sinks::fmt_slices ( OutputDebugString_sink &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices to Windows' OutputDebugString().

References OutputDebugString_sink::write().

std::basic_ostream<ff_char_t>& fastformat::sinks::fmt_slices ( std::basic_ostream< ff_char_t > &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into a std::ostream sink.

Note:
This sink always performs a concatenation, to avoid atomicity problems in the output. If you are using string streams, instead include fastformat/sinks/stringstream.hpp to avoid this step, since it is unncessary in that case.

References fastformat::util::concat_slices().

null_sink& fastformat::sinks::fmt_slices ( null_sink &  sink,
int  ,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *   
) [inline]

Writes an array of string slices into a null_sink sink.

References null_sink::cchTotal, null_sink::numSlices, and null_sink::numWrites.

FILE*& fastformat::sinks::fmt_slices ( FILE *&  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into a FILE* sink.

References fastformat::util::concat_slices(), and FASTFORMAT_LITERAL_STRING.

CString& fastformat::sinks::fmt_slices ( CString &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

char_buffer_sink& fastformat::sinks::fmt_slices ( char_buffer_sink &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Formats into a char_buffer.

References char_buffer_sink::write().

CComBSTR& fastformat::sinks::fmt_slices ( CComBSTR &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

c_string_sink& fastformat::sinks::fmt_slices ( c_string_sink &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Formats into a c_string.

References c_string_sink::write().

stlsoft::auto_buffer<C, N, A>& fastformat::sinks::fmt_slices ( stlsoft::auto_buffer< C, N, A > &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Formats into an auto_buffer.

Because the auto_buffer does not provide any string-carrying semantics we need to define a strict protocol for the semantics of this function:

  • if the auto_buffer is empty, then the result is written to the given length, along with the line-terminator if required, and a terminating nul character is appended
  • if the auto_buffer is not empty, then the last character is examined and removed if it is the nul-terminator. Then the result is written, along with the line-terminator if required, and a terminating nul character is appended

Note:
For efficiency, this provides the weak exception guarantee, not the strong. IS THIS TRUE?!?!?!?

References fastformat::fastformat_getNewlineForPlatform(), ff_string_slice_t::len, and ff_string_slice_t::ptr.

ACE_CString& fastformat::sinks::fmt_slices ( ACE_CString &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Writes an array of string slices into a ACE_CString sink.

References fastformat::util::concat_slices(), fastformat::fastformat_getNewlineForPlatform(), ff_string_slice_t::len, and ff_string_slice_t::ptr.

S& fastformat::sinks::fmt_slices ( S &  sink,
int  flags,
size_t  cchTotal,
size_t  numResults,
ff_string_slice_t const *  results 
) [inline]

Action shim for generic string types.

Remarks:
Users are encouraged to overload this function (which is an Action Shim; see "Breaking Up The Monolith") in order to make their string type compatible and/or to maximise the performance of the concatenation.
Note:
It is a deliberate design feature to favour speed over exception-safety here. The exception safety offers only the basic exception-safety guarantee, rather than the strong. If you require the strong guarantee, you should write your own action shim.

References fastformat::fastformat_getNewlineForPlatform(), ff_string_slice_t::len, and ff_string_slice_t::ptr.

WindowsMessageBox_sink fastformat::sinks::MessageBox ( LPCTSTR  caption,
UINT  type 
) [inline]

Creator function for the WindowsMessageBox_sink class.

WindowsMessageBox_sink fastformat::sinks::MessageBox ( HWND  hwnd,
LPCTSTR  caption,
UINT  type 
) [inline]

Creator function for the WindowsMessageBox_sink class.


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