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-2022 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  // 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  }
104  //- Read a label
105  virtual Istream& read(label&)
106  {
108  return *this;
109  }
110 
111  //- Read a float
112  virtual Istream& read(float&)
113  {
115  return *this;
116  }
117 
118  //- Read a double
119  virtual Istream& read(double&)
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 // ************************************************************************* //
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:64
virtual void rewind()
Rewind the stream so that it may be read again.
virtual bool beginRawRead()
Start of low-level raw binary read.
virtual Istream & readRaw(char *, std::streamsize)
Low-level raw binary read.
A class for handling words, derived from Foam::string.
Definition: word.H:63
dummyISstream()=default
Default construct.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
Definition: StringStream.H:120
virtual Istream & read(token &)
Return next token from stream.
Definition: dummyISstream.H:78
virtual ios_base::fmtflags flags() const
Return flags of stream.
virtual bool endRawRead()
End of low-level raw binary read.
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:666
Dummy input stream, which can be used as a placeholder for interfaces taking an Istream or ISstream...
Definition: dummyISstream.H:52
virtual Istream & read(label &)
Read a label.
Namespace for OpenFOAM.