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;
201 template<
typename DurationT>
207 getTimeUnit<time::nanoseconds>(
bool isLong)
209 return isLong ?
"nanoseconds" :
"ns";
214 getTimeUnit<time::microseconds>(
bool isLong)
216 return isLong ?
"microseconds" :
"us";
221 getTimeUnit<time::milliseconds>(
bool isLong)
223 return isLong ?
"milliseconds" :
"ms";
228 getTimeUnit<time::seconds>(
bool isLong)
230 return isLong ?
"seconds" :
"s";
235 getTimeUnit<time::minutes>(
bool isLong)
237 return isLong ?
"minutes" :
"m";
242 getTimeUnit<time::hours>(
bool isLong)
244 return isLong ?
"hours" :
"h";
249 getTimeUnit<time::days>(
bool isLong)
251 return isLong ?
"days" :
"d";
256 template<
typename OutputPrecision>
260 return to_string(time::duration_cast<OutputPrecision>(d).count()) +
261 (isLong ?
" " :
"") + detail::getTimeUnit<OutputPrecision>(isLong);
273 #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 boolean as 'yes' or 'no'
print different string on first and subsequent usage
print a number of whitespaces
print boolean as 'on' or 'off'