40 os <<
"<?xml version=\"1.0\"?>" 41 <<
"<nfdStatus xmlns=\"ndn:/localhost/nfd/status/1\">";
53 for (
char ch : text.
s) {
90 std::ostringstream str;
98 time::seconds seconds(time::duration_cast<time::seconds>(time::abs(d)));
99 time::milliseconds ms(time::duration_cast<time::milliseconds>(time::abs(d) - seconds));
101 str << seconds.count();
104 str <<
"." << std::setfill(
'0') << std::setw(3) << ms.count();
115 return time::toString(t,
"%Y-%m-%dT%H:%M:%S%F");
125 for (
int i = 0; i < spaces.
nSpaces; ++i) {
131 Separator::Separator(
const std::string& first,
const std::string& subsequent)
133 , m_subsequent(subsequent)
146 if (++sep.m_count == 1) {
147 return os << sep.m_first;
149 return os << sep.m_subsequent;
153 : m_wantMultiLine(wantMultiLine)
154 , m_maxAttributeWidth(maxAttributeWidth)
162 return {*
this, attribute};
168 return m_wantMultiLine ?
"\n" :
"";
175 if (attr.
ia.m_wantMultiLine) {
176 if (attr.
ia.m_count > 1) {
179 os <<
Spaces{attr.
ia.m_maxAttributeWidth -
static_cast<int>(attr.
attribute.size())};
182 if (attr.
ia.m_count > 1) {
192 return os << (v.
flag ?
"on" :
"off");
198 return os << (v.
flag ?
"yes" :
"no");
204 return time::toIsoString(t);
ItemAttributes(bool wantMultiLine=false, int maxAttributeWidth=0)
constructor
friend std::ostream & operator<<(std::ostream &os, Separator &sep)
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
std::string formatTimestamp(time::system_clock::TimePoint t)
Attribute operator()(const std::string &attribute)
Separator(const std::string &first, const std::string &subsequent)
friend std::ostream & operator<<(std::ostream &os, const ItemAttributes::Attribute &attr)
int nSpaces
number of spaces; print nothing if negative
print boolean as 'yes' or 'no'
print different string on first and subsequent usage
print a number of whitespaces
print boolean as 'on' or 'off'