STK++ 0.9.13
I/O stream declarations

Nearly all of the I/O classes are parameterized on the type of characters they read and write (The major exception is ios_base at the top of the hierarchy). More...

Collaboration diagram for I/O stream declarations:

Functions

ostream & STK::operator<< (ostream &os, Binary const &value)
 Overloading of the ostream << for the type Binary.
istream & STK::operator>> (istream &is, Binary &value)
 Overloading of the istream >> for the type Binary.
ostream & STK::operator<< (ostream &os, const Sign &value)
 Overloading of the ostream << for the type Sign.
istream & STK::operator>> (istream &is, Sign &value)
 Overloading of the istream >> for the type Sign.
typedef std::basic_ios< Char > STK::ios
 ios for Char
typedef std::basic_streambuf< Char > STK::streambuf
 streambuf for Char
typedef std::basic_istream< Char > STK::istream
 istream for Char
typedef std::basic_ostream< Char > STK::ostream
 ostream for Char
typedef std::basic_iostream< Char > STK::iostream
 iostream for Char
typedef std::basic_stringbuf< Char > STK::stringbuf
 stringbuf for Char
typedef std::basic_istringstream< Char > STK::istringstream
 istringstream for Char
typedef std::basic_ostringstream< Char > STK::ostringstream
 ostringstream (ostringstream) for Char
typedef std::basic_stringstream< Char > STK::stringstream
 stringstream for Char
typedef std::basic_filebuf< Char > STK::filebuf
 filebuf for Char
typedef std::basic_ifstream< Char > STK::ifstream
 ifstream for Char
typedef std::basic_ofstream< Char > STK::ofstream
 ofstream for Char
typedef std::basic_fstream< Char > STK::fstream

Detailed Description

Nearly all of the I/O classes are parameterized on the type of characters they read and write (The major exception is ios_base at the top of the hierarchy).

For ease of use, all of the basic_* I/O-related classes are given typedef names in the namespace STK. For example:

typedef basic_ifstream<Char> ifstream;

These declarations in the STK namespace would be very useful if you modify the built-in type representation of Char (say wchar_t).

Typedef Documentation

◆ filebuf

typedef std::basic_filebuf<Char> STK::filebuf

filebuf for Char

Definition at line 69 of file STK_Stream.h.

◆ fstream

typedef std::basic_fstream<Char> STK::fstream

Definition at line 75 of file STK_Stream.h.

◆ ifstream

typedef std::basic_ifstream<Char> STK::ifstream

ifstream for Char

Definition at line 71 of file STK_Stream.h.

◆ ios

typedef std::basic_ios<Char> STK::ios

ios for Char

Definition at line 51 of file STK_Stream.h.

◆ iostream

typedef std::basic_iostream<Char> STK::iostream

iostream for Char

Definition at line 59 of file STK_Stream.h.

◆ istream

typedef std::basic_istream<Char> STK::istream

istream for Char

Definition at line 55 of file STK_Stream.h.

◆ istringstream

typedef std::basic_istringstream<Char> STK::istringstream

istringstream for Char

Definition at line 63 of file STK_Stream.h.

◆ ofstream

typedef std::basic_ofstream<Char> STK::ofstream

ofstream for Char

Definition at line 73 of file STK_Stream.h.

◆ ostream

typedef std::basic_ostream<Char> STK::ostream

ostream for Char

Definition at line 57 of file STK_Stream.h.

◆ ostringstream

typedef std::basic_ostringstream<Char> STK::ostringstream

ostringstream (ostringstream) for Char

Definition at line 65 of file STK_Stream.h.

◆ streambuf

typedef std::basic_streambuf<Char> STK::streambuf

streambuf for Char

Definition at line 53 of file STK_Stream.h.

◆ stringbuf

typedef std::basic_stringbuf<Char> STK::stringbuf

stringbuf for Char

Definition at line 61 of file STK_Stream.h.

◆ stringstream

typedef std::basic_stringstream<Char> STK::stringstream

stringstream for Char

Definition at line 67 of file STK_Stream.h.

Function Documentation

◆ operator<<() [1/2]

ostream & STK::operator<< ( ostream & os,
Binary const & value )
inline

Overloading of the ostream << for the type Binary.

Parameters
osthe output stream
valuethe value to send to the stream

Definition at line 93 of file STK_Binary.h.

94{
95 return Arithmetic<Binary>::isNA(value) ? (os << stringNa)
96 : (os << static_cast<int>(value));
97}
String stringNa
Representation of a Not Available value.
static bool isNA(Type const &x)

References STK::Arithmetic< Type >::isNA(), and stringNa.

◆ operator<<() [2/2]

ostream & STK::operator<< ( ostream & os,
const Sign & value )
inline

Overloading of the ostream << for the type Sign.

Parameters
osthe output stream
valuethe value to send to the stream

Definition at line 101 of file STK_Sign.h.

102{ return Arithmetic<Sign>::isNA(value)
103 ? (os << stringNa) : (os << static_cast<int>(value));
104}

References STK::Arithmetic< Type >::isNA().

◆ operator>>() [1/2]

istream & STK::operator>> ( istream & is,
Binary & value )
inline

Overloading of the istream >> for the type Binary.

Parameters
isthe input stream
valuethe value to get from the stream

Definition at line 104 of file STK_Binary.h.

105{
106 int res;
107 // try to read an integer
108 if (!(is >> res).fail())
109 {
110 switch (res)
111 {
112 case 0:
113 value = zero_;
114 break;
115 case 1:
116 value = one_;
117 break;
118 default:
119 value = binaryNA_;
120 break;
121 }
122 }
123 else
124 { value = binaryNA_; is.clear(); is.setstate(std::ios::failbit);}
125 return is;
126}
@ zero_
0 value
Definition STK_Binary.h:49
@ one_
1 value
Definition STK_Binary.h:50
@ binaryNA_
Not Available value.
Definition STK_Binary.h:51

References binaryNA_, one_, and zero_.

◆ operator>>() [2/2]

istream & STK::operator>> ( istream & is,
Sign & value )
inline

Overloading of the istream >> for the type Sign.

Parameters
isthe input stream
valuethe value to get from the stream

Definition at line 111 of file STK_Sign.h.

112{
113 // get current file position
114 int res;
115 // try to read an integer
116 if (!(is >> res).fail())
117 {
118 switch (res)
119 {
120 case 1:
121 value = positive_;
122 break;
123 case -1:
124 value = negative_;
125 break;
126 default:
127 value = signNA_;
128 break;
129 }
130 }
131 else
132 { value = signNA_; is.clear(); is.setstate(std::ios::failbit);}
133 return is;
134}
@ signNA_
Not Available value.
Definition STK_Sign.h:51
@ positive_
positive sign
Definition STK_Sign.h:50
@ negative_
negative sign
Definition STK_Sign.h:49

References negative_, positive_, and signNA_.