sbuild  1.6.10
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends | List of all members
sbuild::format_detail Class Reference

Format names and values for output. More...

#include <sbuild-format-detail.h>

+ Collaboration diagram for sbuild::format_detail:

Public Member Functions

 format_detail (const std::string &title, std::locale locale)
 The constructor. More...
 
format_detailadd (std::string const &name, std::string const &value)
 Add a name-value pair (string specialisation). More...
 
format_detailadd (std::string const &name, bool value)
 Add a name-value pair (bool specialisation). More...
 
format_detailadd (std::string const &name, string_list const &value)
 Add a name-value pair (string_list specialisation). More...
 
template<typename T >
format_detailadd (std::string const &name, T const &value)
 Add a name-value pair. More...
 

Private Types

typedef std::pair< std::string, std::string > value_type
 Name and value pairs.
 
typedef std::vector< value_typelist_type
 List of name and value pairs.
 

Private Member Functions

std::string get_title () const
 Get the title of the chroot. More...
 

Private Attributes

std::string title
 The title of the items to format.
 
std::locale locale
 The locale to use for output.
 
list_type items
 The items to format;.
 

Friends

template<class charT , class traits >
std::basic_ostream< charT, traits > & operator<< (std::basic_ostream< charT, traits > &stream, format_detail const &rhs)
 Output the format_detail to an ostream. More...
 

Detailed Description

Format names and values for output.

Constructor & Destructor Documentation

format_detail::format_detail ( const std::string &  title,
std::locale  locale 
)

The constructor.

Parameters
titlethe title of the set of name and value pairs.
localethe locale to use for formatting the values.

Member Function Documentation

format_detail & format_detail::add ( std::string const &  name,
std::string const &  value 
)
format_detail & format_detail::add ( std::string const &  name,
bool  value 
)

Add a name-value pair (bool specialisation).

Parameters
namethe name.
valuethe bool value.
Returns
a reference to the format_detail object.

References sbuild::_(), and add().

format_detail & format_detail::add ( std::string const &  name,
string_list const &  value 
)

Add a name-value pair (string_list specialisation).

Parameters
namethe name.
valuethe string_list value.
Returns
a reference to the format_detail object.

References add(), and sbuild::string_list_to_string().

template<typename T >
format_detail& sbuild::format_detail::add ( std::string const &  name,
T const &  value 
)
inline

Add a name-value pair.

Parameters
namethe name.
valuethe value.
Returns
a reference to the format_detail object.

References add(), and get_title().

std::string format_detail::get_title ( ) const
private

Get the title of the chroot.

The title is formatted for output.

Returns
the formatted title.

References sbuild::_(), and title.

Referenced by add().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

template<class charT , class traits >
std::basic_ostream<charT,traits>& operator<< ( std::basic_ostream< charT, traits > &  stream,
format_detail const &  rhs 
)
friend

Output the format_detail to an ostream.

Parameters
streamthe stream to output to.
rhsthe format_detail to output.
Returns
the stream.

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