blocxx
BLOCXX_NAMESPACE::DelayedFormat Class Reference

This is a class similar to the blocxx format, except that all arguments are bound by reference and the formatting is performed at a later point in time. More...

#include <DelayedFormat.hpp>

Public Member Functions

 DelayedFormat (const String &format)
 This constructor allows for simple text output without non-format arguments.
 
template<typename A>
 DelayedFormat (const String &format, A &a)
 
template<typename A, typename B>
 DelayedFormat (const String &format, A &a, B &b)
 
template<typename A, typename B, typename C>
 DelayedFormat (const String &format, A &a, B &b, C &c)
 
template<typename A, typename B, typename C, typename D>
 DelayedFormat (const String &format, A &a, B &b, C &c, D &d)
 
template<typename A, typename B, typename C, typename D, typename E>
 DelayedFormat (const String &format, A &a, B &b, C &c, D &d, E &e)
 
template<typename A, typename B, typename C, typename D, typename E, typename F>
 DelayedFormat (const String &format, A &a, B &b, C &c, D &d, E &e, F &f)
 
template<typename A, typename B, typename C, typename D, typename E, typename F, typename G>
 DelayedFormat (const String &format, A &a, B &b, C &c, D &d, E &e, F &f, G &g)
 
template<typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H>
 DelayedFormat (const String &format, A &a, B &b, C &c, D &d, E &e, F &f, G &g, H &h)
 
template<typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I>
 DelayedFormat (const String &format, A &a, B &b, C &c, D &d, E &e, F &f, G &g, H &h, I &i)
 
Format format () const
 Format the output using the stored references and initial format string.
 
 operator String () const
 Simple conversion operator.
 
Format formatWithString (const String &fs) const
 Format the stored references using a different format string than used for initialization.
 
Format formatWithString (const char *fs) const
 

Private Types

typedef Reference< DelayedFormatInternals::DelayedFormatReferenceBaseparamEntry
 

Private Member Functions

template<class T>
void append (T &t)
 This is a helper function to keep the various constructors simple.
 

Private Attributes

String formatString
 The format string which will be passed to Format() when formatting this object.
 
Array< paramEntryformatParameters
 The parameters that will be passed to format.
 

Detailed Description

This is a class similar to the blocxx format, except that all arguments are bound by reference and the formatting is performed at a later point in time.

Because the references are stored, no temporary values can be passed to the delayed formatter; store them in a variable first.

For clarity and emphasis it is important to restate that NOTHING (except the format string) can be passed to this formatter whose lifetime does not exceed the instance of this formatter.

Definition at line 104 of file DelayedFormat.hpp.

Member Typedef Documentation

◆ paramEntry

Constructor & Destructor Documentation

◆ DelayedFormat() [1/10]

BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format)

This constructor allows for simple text output without non-format arguments.

The blocxx::Format class does not allow such behavior, as such, an empty string will be used as a parameter for creation of the output Format object. That means that %1 will be a valid format conversion, but it will always be empty.

Definition at line 63 of file DelayedFormat.cpp.

References format(), formatParameters, and formatString.

◆ DelayedFormat() [2/10]

template<typename A>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a )

Definition at line 163 of file DelayedFormat.hpp.

References append(), format(), formatParameters, and formatString.

◆ DelayedFormat() [3/10]

template<typename A, typename B>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b )

Definition at line 171 of file DelayedFormat.hpp.

References append(), format(), formatParameters, and formatString.

◆ DelayedFormat() [4/10]

template<typename A, typename B, typename C>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b,
C & c )

Definition at line 179 of file DelayedFormat.hpp.

References append(), format(), formatParameters, and formatString.

◆ DelayedFormat() [5/10]

template<typename A, typename B, typename C, typename D>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b,
C & c,
D & d )

Definition at line 187 of file DelayedFormat.hpp.

References append(), format(), formatParameters, and formatString.

◆ DelayedFormat() [6/10]

template<typename A, typename B, typename C, typename D, typename E>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b,
C & c,
D & d,
E & e )

Definition at line 195 of file DelayedFormat.hpp.

References append(), format(), formatParameters, and formatString.

◆ DelayedFormat() [7/10]

template<typename A, typename B, typename C, typename D, typename E, typename F>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b,
C & c,
D & d,
E & e,
F & f )

Definition at line 203 of file DelayedFormat.hpp.

References append(), F, format(), formatParameters, and formatString.

◆ DelayedFormat() [8/10]

template<typename A, typename B, typename C, typename D, typename E, typename F, typename G>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b,
C & c,
D & d,
E & e,
F & f,
G & g )

Definition at line 211 of file DelayedFormat.hpp.

References append(), F, format(), formatParameters, formatString, and G.

◆ DelayedFormat() [9/10]

template<typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b,
C & c,
D & d,
E & e,
F & f,
G & g,
H & h )

Definition at line 219 of file DelayedFormat.hpp.

References append(), F, format(), formatParameters, formatString, G, and H.

◆ DelayedFormat() [10/10]

template<typename A, typename B, typename C, typename D, typename E, typename F, typename G, typename H, typename I>
BLOCXX_NAMESPACE::DelayedFormat::DelayedFormat ( const String & format,
A & a,
B & b,
C & c,
D & d,
E & e,
F & f,
G & g,
H & h,
I & i )

Definition at line 227 of file DelayedFormat.hpp.

References append(), F, format(), formatParameters, formatString, G, H, and I.

Member Function Documentation

◆ append()

template<typename T>
void BLOCXX_NAMESPACE::DelayedFormat::append ( T & t)
private

This is a helper function to keep the various constructors simple.

Definition at line 156 of file DelayedFormat.hpp.

References formatParameters.

Referenced by DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), and DelayedFormat().

◆ format()

Format BLOCXX_NAMESPACE::DelayedFormat::format ( ) const

Format the output using the stored references and initial format string.

Definition at line 73 of file DelayedFormat.cpp.

References formatString, and formatWithString().

Referenced by DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), and operator String().

◆ formatWithString() [1/2]

Format BLOCXX_NAMESPACE::DelayedFormat::formatWithString ( const char * fs) const

Definition at line 83 of file DelayedFormat.cpp.

References BLOCXX_ASSERT, and formatParameters.

◆ formatWithString() [2/2]

Format BLOCXX_NAMESPACE::DelayedFormat::formatWithString ( const String & fs) const

Format the stored references using a different format string than used for initialization.

Definition at line 78 of file DelayedFormat.cpp.

References BLOCXX_NAMESPACE::String::c_str(), and formatWithString().

Referenced by format(), and formatWithString().

◆ operator String()

BLOCXX_NAMESPACE::DelayedFormat::operator String ( ) const

Simple conversion operator.

Definition at line 68 of file DelayedFormat.cpp.

References format().

Member Data Documentation

◆ formatParameters

Array<paramEntry> BLOCXX_NAMESPACE::DelayedFormat::formatParameters
private

◆ formatString

String BLOCXX_NAMESPACE::DelayedFormat::formatString
private

The format string which will be passed to Format() when formatting this object.

Definition at line 149 of file DelayedFormat.hpp.

Referenced by DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), DelayedFormat(), and format().


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