PSCF v1.1
|
Wrapper for a std::string, for formatted ostream output. More...
#include <Str.h>
Public Member Functions | |
Constructors | |
Str () | |
Default constructor. More... | |
Str (std::string value) | |
Constructor, set value only. More... | |
Str (std::string value, int width) | |
Constructor, set value and width. More... | |
Mutators | |
void | setValue (std::string value) |
Set the string value. More... | |
void | setWidth (int width) |
Set the default width. More... | |
Accessors | |
std::string | value () const |
Return string value. More... | |
int | width () const |
Return default string width. More... | |
std::istream & | operator>> (std::istream &in, Str &object) |
Input stream extractor for an Str object. More... | |
std::ostream & | operator<< (std::ostream &out, const Str &object) |
Output stream inserter for an Str object. More... | |
Wrapper for a std::string, for formatted ostream output.
An Str object has std::string value, and an integer output field width. The << operator for an Str object uses the specified width. The value and width may both be specified as parameters to a constructor. If the width is not specified as a constructor parameter, it is set within the constructor to a default value given by Format::defaultWidth().
An Str object may be passed to an ostream as a temporary object. For example, the expression:
outputs "Hello" using the default width, followed by "World" in a field of width 20.
|
explicit |
Util::Str::Str | ( | std::string | value, |
int | width | ||
) |
void Util::Str::setValue | ( | std::string | value | ) |
void Util::Str::setWidth | ( | int | width | ) |
std::string Util::Str::value | ( | ) | const |
int Util::Str::width | ( | ) | const |
|
friend |
|
friend |