37 os <<
"<?xml version=\"1.0\"?>" 38 <<
"<nfdStatus xmlns=\"ndn:/localhost/nfd/status/1\">";
50 for (
char ch : text.
s) {
78 return "PT" + to_string(d.count()) +
"S";
84 return time::toString(t,
"%Y-%m-%dT%H:%M:%S%F");
94 for (
int i = 0; i < spaces.
nSpaces; ++i) {
100 Separator::Separator(
const std::string& first,
const std::string& subsequent)
102 , m_subsequent(subsequent)
115 if (++sep.m_count == 1) {
116 return os << sep.m_first;
118 return os << sep.m_subsequent;
122 : m_wantMultiLine(wantMultiLine)
123 , m_maxAttributeWidth(maxAttributeWidth)
131 return {*
this, attribute};
137 return m_wantMultiLine ?
"\n" :
"";
144 if (attr.
ia.m_wantMultiLine) {
145 if (attr.
ia.m_count > 1) {
148 os <<
Spaces{attr.
ia.m_maxAttributeWidth -
static_cast<int>(attr.
attribute.size())};
151 if (attr.
ia.m_count > 1) {
161 return to_string(d.count()) + (isLong ?
" seconds" :
"s");
167 return time::toIsoString(t);
std::string formatSeconds(time::seconds d, bool isLong)
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 different string on first and subsequent usage
print a number of whitespaces