26 #ifndef NFD_TOOLS_NFDC_FORMAT_HELPERS_HPP 27 #define NFD_TOOLS_NFDC_FORMAT_HELPERS_HPP 105 Separator(
const std::string& first,
const std::string& subsequent);
108 Separator(
const std::string& subsequent);
118 std::string m_subsequent;
151 ItemAttributes(
bool wantMultiLine =
false,
int maxAttributeWidth = 0);
163 operator()(
const std::string& attribute);
169 bool m_wantMultiLine;
170 int m_maxAttributeWidth;
191 template<
typename DurationT>
197 getTimeUnit<time::nanoseconds>(
bool isLong)
199 return isLong ?
"nanoseconds" :
"ns";
204 getTimeUnit<time::microseconds>(
bool isLong)
206 return isLong ?
"microseconds" :
"us";
211 getTimeUnit<time::milliseconds>(
bool isLong)
213 return isLong ?
"milliseconds" :
"ms";
218 getTimeUnit<time::seconds>(
bool isLong)
220 return isLong ?
"seconds" :
"s";
225 getTimeUnit<time::minutes>(
bool isLong)
227 return isLong ?
"minutes" :
"m";
232 getTimeUnit<time::hours>(
bool isLong)
234 return isLong ?
"hours" :
"h";
239 getTimeUnit<time::days>(
bool isLong)
241 return isLong ?
"days" :
"d";
246 template<
typename OutputPrecision>
250 return to_string(time::duration_cast<OutputPrecision>(d).count()) +
251 (isLong ?
" " :
"") + detail::getTimeUnit<OutputPrecision>(isLong);
263 #endif // NFD_TOOLS_NFDC_FORMAT_HELPERS_HPP
std::string getTimeUnit(bool isLong)
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
print attributes of an item
int nSpaces
number of spaces; print nothing if negative
print different string on first and subsequent usage
print a number of whitespaces
print boolean as 'on' or 'off'