Simpatico  v1.10
List of all members | Friends
Util::Bool Class Reference

Detailed Description

Wrapper for an bool value, for formatted ostream output.

An Bool object has a bool value, and a minimum output field width. The << operator for a Bool 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 the default Format::defaultWidth().

An Bool object may be passed to an ostream as a temporary object. For example, the expression:

std::cout << Bool(true) << Bool(false, 10) << std::endl;

outputs the value true using the default width, followed by the false value in a field of minimum width 10.

Definition at line 35 of file Bool.h.

#include <Bool.h>

Public Member Functions

Constructors
 Bool ()
 Default constructor. More...
 
 Bool (bool value)
 Constructor, value only. More...
 
 Bool (bool value, int width)
 Constructor, value and width. More...
 
Setters
void setValue (bool value)
 
void setWidth (int width)
 
Accessors
bool value ()
 
int width ()
 

Friends

std::istream & operator>> (std::istream &in, Bool &object)
 Input stream extractor for an Bool object. More...
 
std::ostream & operator<< (std::ostream &out, const Bool &object)
 Output stream inserter for an Bool object. More...
 

Constructor & Destructor Documentation

Util::Bool::Bool ( )

Default constructor.

Definition at line 15 of file Bool.cpp.

Util::Bool::Bool ( bool  value)
explicit

Constructor, value only.

Definition at line 21 of file Bool.cpp.

Util::Bool::Bool ( bool  value,
int  width 
)

Constructor, value and width.

Definition at line 27 of file Bool.cpp.

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
Bool object 
)
friend

Input stream extractor for an Bool object.

Parameters
ininput stream
objectBool object to be read from stream
Returns
modified input stream

Definition at line 47 of file Bool.cpp.

std::ostream& operator<< ( std::ostream &  out,
const Bool object 
)
friend

Output stream inserter for an Bool object.

Parameters
outoutput stream
objectBool to be written to stream
Returns
modified output stream

Definition at line 56 of file Bool.cpp.


The documentation for this class was generated from the following files: