19 #ifndef SBUILD_FORMAT_DETAIL_H
20 #define SBUILD_FORMAT_DETAIL_H
22 #include <sbuild/types.h>
23 #include <sbuild/util.h>
60 add (
const std::string& name,
61 const std::string& value);
71 add (
const std::string& name,
82 add (
const std::string& name,
94 add (
const std::string& 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 (
const auto& item : rhs.items)
132 int width = wcswidth(wide.c_str(), wide.length());
134 if (max_width < width)
143 stream <<
" " << rhs.get_title() <<
'\n';
145 for (
const auto& item : rhs.items)
147 std::wostringstream ws;
151 ws << L
" " << std::setw(max_width) << std::left << wide;
153 stream <<
narrow_string(ws.str(), loc) << item.second <<
'\n';