#include <stringutils.h>
for stringrep(). Somewhat similar to Stroustrup's Form class from section 21.4.6.3 of the C++ Programming Language, 3rd Ed.; might want to adapt that class someday instead.
Definition at line 177 of file stringutils.h.
Public Methods | |
StreamFormat (const int width_=-1, const char fill_=' ', const int digitsafterdecimal_=-1, const bool rightadjust_=true) | |
Constructor taking explicit arguments. | |
StreamFormat (const string &flags) | |
Constructor taking flags in a string format, which is handy for implementing formatted string substitution. | |
virtual std::ostream & | put (std::ostream &s) const |
Virtual interface to the operator<<, since << cannot be virtual. |
|
Constructor taking explicit arguments. The width and fill apply to all types; they can e.g. be used to padd a numeric value with a specified number of leading zeros. The digitsafterdecimal is intended only for floating-point values; it specifies the precise number of digits to be used after the decimal (which by default depends instead on the actual value). Definition at line 188 of file stringutils.h. |
|
Constructor taking flags in a string format, which is handy for implementing formatted string substitution. One could e.g. accept ${05.2value} or ${value:05.2}, pull out the 05.2, and pass it to the flags argument here. Currently accepts an optional leading fill character (anything but [1-9], an integer width, and (preceded by a decimal point, if present) an optional integer number of fractional digits to be used for floating point values. Definition at line 203 of file stringutils.h. References String::fractional_portion(), and String::integer_portion(). |