38 os <<
"<?xml version=\"1.0\"?>"
39 <<
"<nfdStatus xmlns=\"ndn:/localhost/nfd/status/1\">";
51 for (
char ch : text.
s) {
88 std::ostringstream str;
96 time::seconds seconds(time::duration_cast<time::seconds>(time::abs(d)));
97 time::milliseconds ms(time::duration_cast<time::milliseconds>(time::abs(d) - seconds));
99 str << seconds.count();
102 str <<
"." << std::setfill(
'0') << std::setw(3) << ms.count();
113 return time::toIsoExtendedString(t);
123 for (
int i = 0; i < spaces.
nSpaces; ++i) {
131 , m_subsequent(subsequent)
143 if (++sep.m_count == 1) {
144 return os << sep.m_first;
146 return os << sep.m_subsequent;
150 : m_wantMultiLine(wantMultiLine)
151 , m_maxAttributeWidth(maxAttributeWidth)
158 return {*
this, attribute};
164 return m_wantMultiLine ?
"\n" :
"";
171 if (attr.
ia.m_wantMultiLine) {
172 if (attr.
ia.m_count > 1) {
175 os <<
Spaces{attr.
ia.m_maxAttributeWidth -
static_cast<int>(attr.
attribute.size())};
178 if (attr.
ia.m_count > 1) {
188 return os << (v.
flag ?
"on" :
"off");
194 return os << (v.
flag ?
"yes" :
"no");
200 return time::toIsoString(t);
ItemAttributes(bool wantMultiLine=false, int maxAttributeWidth=0)
Constructor.
Attribute operator()(const std::string &attribute)
Print different string on first and subsequent usage.
Separator(std::string_view first, std::string_view subsequent)
std::string formatTimestamp(time::system_clock::time_point t)
std::ostream & operator<<(std::ostream &os, const Spaces &spaces)
Print boolean as 'on' or 'off'.
Print a number of whitespaces.
int nSpaces
number of spaces; print nothing if negative
Print boolean as 'yes' or 'no'.