40 os <<
"<?xml version=\"1.0\"?>" 41 <<
"<nfdStatus xmlns=\"ndn:/localhost/nfd/status/1\">";
53 for (
char ch : text.
s) {
81 std::ostringstream str;
89 time::seconds seconds(time::duration_cast<time::seconds>(time::abs(d)));
90 time::milliseconds ms(time::duration_cast<time::milliseconds>(time::abs(d) - seconds));
92 str << seconds.count();
95 str <<
"." << std::setfill(
'0') << std::setw(3) << ms.count();
106 return time::toString(t,
"%Y-%m-%dT%H:%M:%S%F");
116 for (
int i = 0; i < spaces.
nSpaces; ++i) {
122 Separator::Separator(
const std::string& first,
const std::string& subsequent)
124 , m_subsequent(subsequent)
137 if (++sep.m_count == 1) {
138 return os << sep.m_first;
140 return os << sep.m_subsequent;
144 : m_wantMultiLine(wantMultiLine)
145 , m_maxAttributeWidth(maxAttributeWidth)
153 return {*
this, attribute};
159 return m_wantMultiLine ?
"\n" :
"";
166 if (attr.
ia.m_wantMultiLine) {
167 if (attr.
ia.m_count > 1) {
170 os <<
Spaces{attr.
ia.m_maxAttributeWidth -
static_cast<int>(attr.
attribute.size())};
173 if (attr.
ia.m_count > 1) {
183 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 different string on first and subsequent usage
print a number of whitespaces