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 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::dummyISstream
29 
30 Description
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 
34 Note
35  The inheritance from an empty IStringStream is solely for convenience
36  of implementation and should not be relied upon.
37 
38 SourceFiles
39  dummyISstream.H
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef dummyISstream_H
44 #define dummyISstream_H
45 
46 #include "StringStream.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 /*---------------------------------------------------------------------------*\
54  Class dummyISstream Declaration
55 \*---------------------------------------------------------------------------*/
56 
57 class dummyISstream
58 :
59  public IStringStream
60 {
61 public:
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 // ************************************************************************* //
Foam::doubleScalar
double doubleScalar
A typedef for double.
Definition: scalarFwd.H:48
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::dummyISstream::dummyISstream
dummyISstream()=default
Default construct.
Foam::dummyISstream::read
virtual Istream & read(char &)
Read a character.
Definition: dummyISstream.H:83
Foam::dummyISstream::beginRawRead
virtual bool beginRawRead()
Start of low-level raw binary read.
Definition: dummyISstream.H:139
Foam::dummyISstream::~dummyISstream
virtual ~dummyISstream()=default
Destructor.
Foam::dummyISstream::read
virtual Istream & read(doubleScalar &)
Read a doubleScalar.
Definition: dummyISstream.H:118
Foam::dummyISstream
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream....
Definition: dummyISstream.H:56
Foam::dummyISstream::read
virtual Istream & read(char *, std::streamsize)
Read binary block.
Definition: dummyISstream.H:125
Foam::floatScalar
float floatScalar
A typedef for float.
Definition: scalarFwd.H:45
StringStream.H
Input/output from string buffers.
Foam::token
A token holds an item read from Istream.
Definition: token.H:68
Foam::dummyISstream::read
virtual Istream & read(token &)
Return next token from stream.
Definition: dummyISstream.H:76
Foam::dummyISstream::read
virtual Istream & read(word &)
Read a word.
Definition: dummyISstream.H:90
Foam::dummyISstream::read
virtual Istream & read(string &)
Read a string (including enclosing double-quotes).
Definition: dummyISstream.H:97
NotImplemented
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:517
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Foam::dummyISstream::read
virtual Istream & read(label &)
Read a label.
Definition: dummyISstream.H:104
Foam::dummyISstream::endRawRead
virtual bool endRawRead()
End of low-level raw binary read.
Definition: dummyISstream.H:145
Foam::IStringStream
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
Definition: StringStream.H:108
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::dummyISstream::readRaw
virtual Istream & readRaw(char *, std::streamsize)
Low-level raw binary read.
Definition: dummyISstream.H:132
Foam::dummyISstream::flags
virtual ios_base::fmtflags flags() const
Return flags of stream.
Definition: dummyISstream.H:155
Foam::dummyISstream::rewind
virtual void rewind()
Rewind the stream so that it may be read again.
Definition: dummyISstream.H:151
Foam::dummyISstream::read
virtual Istream & read(floatScalar &)
Read a floatScalar.
Definition: dummyISstream.H:111
Foam::dummyISstream::flags
virtual ios_base::fmtflags flags(const ios_base::fmtflags)
Set flags of stream.
Definition: dummyISstream.H:161