libzypp 17.37.17
zypp::str::Format Class Reference

Convenient building of std::string with boost::format. More...

#include <zypp-core/base/String.h>

Public Member Functions

 Format ()
 Format (const std::string &format_r)
template<class Tp>
Formatoperator% (Tp &&arg)
 operator std::string () const
std::string asString () const
std::string str () const
const boost::format & fmter () const
boost::format & fmter ()

Protected Attributes

boost::format _fmter

(Note that these are not member symbols.)

std::ostream & operator<< (std::ostream &str, const Format &obj)
 Stream output.

Detailed Description

Convenient building of std::string with boost::format.

Basically a boost::format autoconvertible to std::string for building string arguments.

Note
It won't complain about malformed or incomplete format strings. Usefull when dealing with translations or classes providing a default formater.
void fnc( const std::string & txt_r );
fnc( str::Format("Hello %1%") % 13 );
std::string txt( str::Format("Hello %1%") % 13 );
Convenient building of std::string with boost::format.
Definition String.h:254

Definition at line 253 of file String.h.

Constructor & Destructor Documentation

◆ Format() [1/2]

zypp::str::Format::Format ( )
inline

Definition at line 255 of file String.h.

◆ Format() [2/2]

zypp::str::Format::Format ( const std::string & format_r)
inline

Definition at line 256 of file String.h.

Member Function Documentation

◆ operator%()

template<class Tp>
Format & zypp::str::Format::operator% ( Tp && arg)
inline

Definition at line 259 of file String.h.

◆ operator std::string()

zypp::str::Format::operator std::string ( ) const
inline

Definition at line 262 of file String.h.

◆ asString()

std::string zypp::str::Format::asString ( ) const
inline

Definition at line 263 of file String.h.

◆ str()

std::string zypp::str::Format::str ( ) const
inline

Definition at line 264 of file String.h.

◆ fmter() [1/2]

const boost::format & zypp::str::Format::fmter ( ) const
inline

Definition at line 266 of file String.h.

◆ fmter() [2/2]

boost::format & zypp::str::Format::fmter ( )
inline

Definition at line 267 of file String.h.

◆ operator<<()

std::ostream & operator<< ( std::ostream & str,
const Format & obj )
related

Stream output.

Definition at line 274 of file String.h.

Member Data Documentation

◆ _fmter

boost::format zypp::str::Format::_fmter
protected

Definition at line 270 of file String.h.


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