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-2023 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 Foam_dummyISstream_H
44 #define Foam_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  // Stream-state
75 
76  //- Return flags of stream
77  virtual ios_base::fmtflags flags() const override
78  {
79  return ios_base::fmtflags(0);
80  }
81 
82  //- Set flags of stream
83  virtual ios_base::fmtflags flags(const ios_base::fmtflags) override
84  {
85  return ios_base::fmtflags(0);
86  }
87 
88 
89  // Read Functions
90 
91  //- Return next token from stream
92  virtual Istream& read(token&) override
93  {
95  return *this;
96  }
97 
98  //- Read a character
99  virtual Istream& read(char&) override
100  {
102  return *this;
103  }
104 
105  //- Read a word
106  virtual Istream& read(word&) override
107  {
109  return *this;
110  }
111 
112  // Read a string (including enclosing double-quotes)
113  virtual Istream& read(string&) override
114  {
116  return *this;
117  }
118 
119  //- Read a label
120  virtual Istream& read(label&) override
121  {
123  return *this;
124  }
125 
126  //- Read a float
127  virtual Istream& read(float&) override
128  {
130  return *this;
131  }
132 
133  //- Read a double
134  virtual Istream& read(double&) override
135  {
137  return *this;
138  }
139 
140  //- Read binary block
141  virtual Istream& read(char*, std::streamsize) override
142  {
144  return *this;
145  }
146 
147  //- Low-level raw binary read
148  virtual Istream& readRaw(char*, std::streamsize) override
149  {
151  return *this;
152  }
153 
154  //- Start of low-level raw binary read
155  virtual bool beginRawRead() override
156  {
157  return false;
158  }
159 
160  //- End of low-level raw binary read
161  virtual bool endRawRead() override
162  {
163  return false;
164  }
165 
166  //- Rewind the stream so that it may be read again
167  virtual void rewind() override
168  {}
169 };
170 
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
virtual ~dummyISstream()=default
Destructor.
Input/output from string buffers.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A token holds an item read from Istream.
Definition: token.H:65
virtual Istream & read(token &) override
Return next token from stream.
Definition: dummyISstream.H:97
virtual void rewind() override
Rewind the stream so that it may be read again.
virtual ios_base::fmtflags flags() const override
Return flags of stream.
Definition: dummyISstream.H:78
A class for handling words, derived from Foam::string.
Definition: word.H:63
dummyISstream()=default
Default construct.
virtual bool beginRawRead() override
Start of low-level raw binary read.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
Definition: StringStream.H:120
virtual bool endRawRead() override
End of low-level raw binary read.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:686
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream...
Definition: dummyISstream.H:52
virtual Istream & readRaw(char *, std::streamsize) override
Low-level raw binary read.
virtual Istream & read(char &) override
Read a character.
Namespace for OpenFOAM.