19 #ifndef SBUILD_FORMAT_DETAIL_H 20 #define SBUILD_FORMAT_DETAIL_H 22 #include <sbuild/sbuild-types.h> 23 #include <sbuild/sbuild-util.h> 60 add (std::string
const& name,
61 std::string
const& value);
71 add (std::string
const& name,
82 add (std::string
const& name,
94 add (std::string
const& name,
97 std::ostringstream varstring;
98 varstring.imbue(this->locale);
100 return add(name, varstring.str());
120 template <
class charT,
class traits>
122 std::basic_ostream<charT,traits>&
123 operator << (std::basic_ostream<charT,traits>& stream,
126 std::locale loc = stream.getloc();
129 for (format_detail::list_type::const_iterator pos = rhs.items.begin();
130 pos != rhs.items.end();
134 int width = wcswidth(wide.c_str(), wide.length());
136 if (max_width < width)
145 stream <<
" " << rhs.get_title() <<
'\n';
147 for (format_detail::list_type::const_iterator pos = rhs.items.begin();
148 pos != rhs.items.end();
151 std::wostringstream ws;
155 ws << L
" " << std::setw(max_width) << std::left << wide;
157 stream <<
narrow_string(ws.str(), loc) << pos->second <<
'\n';
std::wstring widen_string(std::string const &str, std::locale locale)
Widen a string.
Definition: sbuild-util.cc:332
Debian source builder components.
Definition: sbuild-auth-null.h:24
std::vector< std::string > string_list
A string vector.
Definition: sbuild-types.h:38
std::string narrow_string(std::wstring const &str, std::locale locale)
Narrow a string.
Definition: sbuild-util.cc:379