Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

String::StreamFormat Class Reference

#include <stringutils.h>

List of all members.


Detailed Description

Convenience structure to wrap up and pass around a set of arguments for stream output, e.g.

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 & Destructor Documentation

String::StreamFormat::StreamFormat const int    width_ = -1,
const char    fill_ = ' ',
const int    digitsafterdecimal_ = -1,
const bool    rightadjust_ = true
[inline]
 

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.

String::StreamFormat::StreamFormat const string &    flags [inline]
 

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().


The documentation for this class was generated from the following file:
Generated on Mon Jan 20 02:37:46 2003 for RF-LISSOM by doxygen1.3-rc2