PSCF v1.1
Bool.h
1#ifndef UTIL_BOOL_H
2#define UTIL_BOOL_H
3
4/*
5* Util Package - C++ Utilities for Scientific Computation
6*
7* Copyright 2010 - 2017, The Regents of the University of Minnesota
8* Distributed under the terms of the GNU General Public License.
9*/
10
11#include <iostream>
12
13namespace Util
14{
15
35 class Bool
36 {
37
38 public:
39
41
42
46 Bool();
47
53 explicit Bool(bool value);
54
61 Bool(bool value, int width);
62
64
66
72 void setValue(bool value);
73
79 void setWidth(int width);
80
82
84
86 bool value();
87
89 int width();
90
92
93 private:
94
96 bool value_;
97
99 int width_;
100
101 //friends:
102
103 friend std::istream& operator>>(std::istream& in, Bool &object);
104 friend std::ostream& operator<<(std::ostream& out, const Bool &object);
105
106 };
107
115 std::istream& operator>>(std::istream& in, Bool &object);
116
124 std::ostream& operator<<(std::ostream& out, const Bool &object);
125
126}
127#endif
Wrapper for an bool value, for formatted ostream output.
Definition: Bool.h:36
void setValue(bool value)
Set the value.
Definition: Bool.cpp:32
int width()
Return default width (number of characters).
Definition: Bool.cpp:41
Bool()
Default constructor.
Definition: Bool.cpp:15
friend std::ostream & operator<<(std::ostream &out, const Bool &object)
Output stream inserter for an Bool object.
Definition: Bool.cpp:56
bool value()
Return value.
Definition: Bool.cpp:38
void setWidth(int width)
Set the output width.
Definition: Bool.cpp:35
friend std::istream & operator>>(std::istream &in, Bool &object)
Input stream extractor for an Bool object.
Definition: Bool.cpp:47
Utility classes for scientific computation.
Definition: accumulators.mod:1
std::istream & operator>>(std::istream &in, Pair< Data > &pair)
Input a Pair from an istream.
Definition: Pair.h:44
std::ostream & operator<<(std::ostream &out, const Pair< Data > &pair)
Output a Pair to an ostream, without line breaks.
Definition: Pair.h:57