dummyISstream.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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2017 OpenFOAM Foundation
9 Copyright (C) 2019-2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::dummyISstream
29
30Description
31 Dummy input stream, which can be used as a placeholder for interfaces
32 taking an Istream or ISstream. Aborts at any attempt to read from it.
33
34Note
35 The inheritance from an empty IStringStream is solely for convenience
36 of implementation and should not be relied upon.
37
38SourceFiles
39 dummyISstream.H
40
41\*---------------------------------------------------------------------------*/
42
43#ifndef dummyISstream_H
44#define dummyISstream_H
45
46#include "StringStream.H"
47
48// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49
50namespace Foam
51{
52
53/*---------------------------------------------------------------------------*\
54 Class dummyISstream Declaration
55\*---------------------------------------------------------------------------*/
57class dummyISstream
58:
59 public IStringStream
60{
61public:
62
63 // Generated Methods
64
65 //- Default construct
66 dummyISstream() = default;
67
68 //- Destructor
69 virtual ~dummyISstream() = default;
70
71
72 // Member Functions
73
74 // Read Functions
75
76 //- Return next token from stream
77 virtual Istream& read(token&)
78 {
80 return *this;
81 }
82
83 //- Read a character
84 virtual Istream& read(char&)
85 {
87 return *this;
88 }
89
90 //- Read a word
91 virtual Istream& read(word&)
92 {
94 return *this;
95 }
96
97 // Read a string (including enclosing double-quotes)
98 virtual Istream& read(string&)
99 {
101 return *this;
102 }
103
104 //- Read a label
105 virtual Istream& read(label&)
106 {
108 return *this;
109 }
110
111 //- Read a floatScalar
112 virtual Istream& read(floatScalar&)
113 {
115 return *this;
116 }
117
118 //- Read a doubleScalar
119 virtual Istream& read(doubleScalar&)
120 {
122 return *this;
123 }
124
125 //- Read binary block
126 virtual Istream& read(char*, std::streamsize)
127 {
129 return *this;
130 }
131
132 //- Low-level raw binary read
133 virtual Istream& readRaw(char*, std::streamsize)
134 {
136 return *this;
137 }
138
139 //- Start of low-level raw binary read
140 virtual bool beginRawRead()
141 {
142 return false;
143 }
144
145 //- End of low-level raw binary read
146 virtual bool endRawRead()
147 {
148 return false;
149 }
150
151 //- Rewind the stream so that it may be read again
152 virtual void rewind()
153 {}
154
155 //- Return flags of stream
156 virtual ios_base::fmtflags flags() const
157 {
158 return ios_base::fmtflags(0);
159 }
160
161 //- Set flags of stream
162 virtual ios_base::fmtflags flags(const ios_base::fmtflags)
163 {
164 return ios_base::fmtflags(0);
165 }
166};
167
168
169// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170
171} // End namespace Foam
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175#endif
176
177// ************************************************************************* //
Input/output from string buffers.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
Definition: StringStream.H:112
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream....
Definition: dummyISstream.H:59
virtual ios_base::fmtflags flags(const ios_base::fmtflags)
Set flags of stream.
virtual bool beginRawRead()
Start of low-level raw binary read.
virtual Istream & readRaw(char *, std::streamsize)
Low-level raw binary read.
virtual Istream & read(word &)
Read a word.
Definition: dummyISstream.H:90
virtual Istream & read(char *, std::streamsize)
Read binary block.
virtual Istream & read(char &)
Read a character.
Definition: dummyISstream.H:83
virtual Istream & read(token &)
Return next token from stream.
Definition: dummyISstream.H:76
virtual Istream & read(doubleScalar &)
Read a doubleScalar.
virtual Istream & read(floatScalar &)
Read a floatScalar.
virtual Istream & read(label &)
Read a label.
virtual ~dummyISstream()=default
Destructor.
virtual Istream & read(string &)
Read a string (including enclosing double-quotes).
Definition: dummyISstream.H:97
dummyISstream()=default
Default construct.
virtual ios_base::fmtflags flags() const
Return flags of stream.
virtual void rewind()
Rewind the stream so that it may be read again.
virtual bool endRawRead()
End of low-level raw binary read.
A token holds an item read from Istream.
Definition: token.H:69
A class for handling words, derived from Foam::string.
Definition: word.H:68
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Namespace for OpenFOAM.
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
float floatScalar
A typedef for float.
Definition: scalarFwd.H:45