E-MailRelay
Public Member Functions | List of all members
G::format Class Reference

A simple version of boost::format for formatting strings in an i18n-friendly way. More...

#include <gformat.h>

Public Member Functions

 format (const std::string &fmt)
 Constructor. More...
 
 format (const char *fmt)
 Constructor. More...
 
formatparse (const std::string &fmt)
 Resets the object with the given format string. More...
 
formatparse (const char *fmt)
 Resets the object with the given format string. More...
 
std::string str () const
 Returns the string. More...
 
std::size_t size () const
 Returns the string size. More...
 
template<typename T >
formatoperator% (const T &)
 Applies a substitution value. More...
 

Detailed Description

A simple version of boost::format for formatting strings in an i18n-friendly way.

Eg:

using G::format ; // or boost::format
std::cout << format("a %2% %1% d") % "c" % "b" << "\n" ;
A simple version of boost::format for formatting strings in an i18n-friendly way.
Definition: gformat.h:46
format(const std::string &fmt)
Constructor.
Definition: gformat.cpp:25

Definition at line 45 of file gformat.h.

Constructor & Destructor Documentation

◆ format() [1/2]

G::format::format ( const std::string &  fmt)
explicit

Constructor.

Definition at line 25 of file gformat.cpp.

◆ format() [2/2]

G::format::format ( const char *  fmt)
explicit

Constructor.

Definition at line 30 of file gformat.cpp.

Member Function Documentation

◆ operator%()

template<typename T >
format & G::format::operator% ( const T &  item)

Applies a substitution value.

Definition at line 86 of file gformat.h.

◆ parse() [1/2]

G::format & G::format::parse ( const char *  fmt)

Resets the object with the given format string.

Definition at line 43 of file gformat.cpp.

◆ parse() [2/2]

G::format & G::format::parse ( const std::string &  fmt)

Resets the object with the given format string.

Definition at line 35 of file gformat.cpp.

◆ size()

std::size_t G::format::size ( ) const

Returns the string size.

Definition at line 86 of file gformat.cpp.

◆ str()

std::string G::format::str ( ) const

Returns the string.

Definition at line 57 of file gformat.cpp.


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