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 current stream flags.
77  //- Dummy for dummy stream, returns 0.
78  virtual std::ios_base::fmtflags flags() const override
79  {
80  return std::ios_base::fmtflags(0);
81  }
82 
83  //- Set stream flags, return old stream flags.
84  //- Dummy for dummy stream, returns 0.
85  virtual std::ios_base::fmtflags flags(std::ios_base::fmtflags) override
86  {
87  return std::ios_base::fmtflags(0);
88  }
89 
90 
91  // Read Functions
92 
93  //- Return next token from stream
94  virtual Istream& read(token&) override
95  {
97  return *this;
98  }
99 
100  //- Read a character
101  virtual Istream& read(char&) override
102  {
104  return *this;
105  }
106 
107  //- Read a word
108  virtual Istream& read(word&) override
109  {
111  return *this;
112  }
113 
114  // Read a string (including enclosing double-quotes)
115  virtual Istream& read(string&) override
116  {
118  return *this;
119  }
120 
121  //- Read a label
122  virtual Istream& read(label&) override
123  {
125  return *this;
126  }
127 
128  //- Read a float
129  virtual Istream& read(float&) override
130  {
132  return *this;
133  }
134 
135  //- Read a double
136  virtual Istream& read(double&) override
137  {
139  return *this;
140  }
141 
142  //- Read binary block
143  virtual Istream& read(char*, std::streamsize) override
144  {
146  return *this;
147  }
148 
149  //- Low-level raw binary read
150  virtual Istream& readRaw(char*, std::streamsize) override
151  {
153  return *this;
154  }
155 
156  //- Start of low-level raw binary read
157  virtual bool beginRawRead() override
158  {
159  return false;
160  }
161 
162  //- End of low-level raw binary read
163  virtual bool endRawRead() override
164  {
165  return false;
166  }
167 
168  //- Rewind the stream so that it may be read again
169  virtual void rewind() override
170  {}
171 };
172 
173 
174 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 
176 } // End namespace Foam
177 
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 
180 #endif
181 
182 // ************************************************************************* //
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:99
virtual void rewind() override
Rewind the stream so that it may be read again.
virtual std::ios_base::fmtflags flags() const override
Return current stream flags. Dummy for dummy stream, returns 0.
Definition: dummyISstream.H:79
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:52
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:688
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.