Home
Downloads
Documentation
Installation
User Guide
man-pages
API Documentation
README
Release Notes
Changes
License
Support
SourceForge Project
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
src
OpenFOAM
db
IOstreams
Sstreams
ISstream.H
Go to the documentation of this file.
1
/*---------------------------------------------------------------------------*\
2
========= |
3
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4
\\ / O peration |
5
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6
\\/ M anipulation |
7
-------------------------------------------------------------------------------
8
License
9
This file is part of OpenFOAM.
10
11
OpenFOAM is free software: you can redistribute it and/or modify it
12
under the terms of the GNU General Public License as published by
13
the Free Software Foundation, either version 3 of the License, or
14
(at your option) any later version.
15
16
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19
for more details.
20
21
You should have received a copy of the GNU General Public License
22
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23
24
Class
25
Foam::ISstream
26
27
Description
28
Generic input stream.
29
30
SourceFiles
31
ISstreamI.H
32
ISread.C
33
ISreadToken.C
34
35
\*---------------------------------------------------------------------------*/
36
37
#ifndef ISstream_H
38
#define ISstream_H
39
40
#include <
OpenFOAM/Istream.H
>
41
#include <
OpenFOAM/fileName.H
>
42
#include <iostream>
43
44
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45
46
namespace
Foam
47
{
48
49
/*---------------------------------------------------------------------------*\
50
Class ISstream Declaration
51
\*---------------------------------------------------------------------------*/
52
53
class
ISstream
54
:
55
public
Istream
56
{
57
// Private data
58
59
fileName
name_;
60
istream& is_;
61
62
63
// Private member functions
64
65
char
nextValid();
66
67
68
// Private Member Functions
69
70
//- Disallow default bitwise assignment
71
void
operator=(
const
ISstream
&);
72
73
74
protected
:
75
76
// Protected member functions
77
78
//- Return the stream reference
79
istream&
stream
()
80
{
81
return
is_;
82
}
83
84
//- Return the const stream reference
85
const
istream&
stream
()
const
86
{
87
return
is_;
88
}
89
90
91
public
:
92
93
// Constructors
94
95
//- Construct as wrapper around istream
96
inline
ISstream
97
(
98
istream& is,
99
const
string
&
name
,
100
streamFormat
format
=
ASCII
,
101
versionNumber
version
=
currentVersion
,
102
compressionType
compression
=
UNCOMPRESSED
103
);
104
105
106
// Destructor
107
108
virtual
~ISstream
()
109
{}
110
111
112
// Member functions
113
114
// Inquiry
115
116
//- Return the name of the stream
117
// Useful for Fstream to return the filename
118
virtual
const
fileName
&
name
()
const
119
{
120
return
name_;
121
}
122
123
//- Return non-const access to the name of the stream
124
// Useful to alter the stream name
125
virtual
fileName
&
name
()
126
{
127
return
name_;
128
}
129
130
//- Return flags of output stream
131
virtual
ios_base::fmtflags
flags
()
const
;
132
133
134
// Read functions
135
136
//- Raw, low-level get character function.
137
inline
ISstream
&
get
(
char
&);
138
139
//- Raw, low-level getline into a string function.
140
inline
ISstream
&
getLine
(
string
&);
141
142
//- Raw, low-level putback character function.
143
inline
ISstream
&
putback
(
const
char
&);
144
145
//- Return next token from stream
146
virtual
Istream
&
read
(
token
&);
147
148
//- Read a character
149
virtual
Istream
&
read
(
char
&);
150
151
//- Read a word
152
virtual
Istream
&
read
(
word
&);
153
154
//- Read a string (including enclosing double-quotes).
155
// Backslashes are retained, except when escaping double-quotes
156
// and an embedded newline character.
157
virtual
Istream
&
read
(
string
&);
158
159
//- Read a label
160
virtual
Istream
&
read
(label&);
161
162
//- Read a floatScalar
163
virtual
Istream
&
read
(
floatScalar
&);
164
165
//- Read a doubleScalar
166
virtual
Istream
&
read
(
doubleScalar
&);
167
168
//- Read binary block
169
virtual
Istream
&
read
(
char
*, std::streamsize);
170
171
//- Rewind and return the stream so that it may be read again
172
virtual
Istream
&
rewind
();
173
174
175
// Stream state functions
176
177
//- Set flags of output stream
178
virtual
ios_base::fmtflags
flags
(
const
ios_base::fmtflags
flags
);
179
180
181
// Print
182
183
//- Print description of IOstream to Ostream
184
virtual
void
print
(
Ostream
&)
const
;
185
};
186
187
188
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190
}
// End namespace Foam
191
192
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
193
194
#include <
OpenFOAM/ISstreamI.H
>
195
196
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
197
198
#endif
199
200
// ************************ vim: set sw=4 sts=4 et: ************************ //