1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
33 \*---------------------------------------------------------------------------*/
39 #include "tokenList.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class ITstream Declaration
48 \*---------------------------------------------------------------------------*/
60 //- Index of token currently being read
68 //- Construct from components
72 const UList<token>& tokens,
73 streamFormat format=ASCII,
74 versionNumber version=currentVersion
77 Istream(format, version),
87 //- Construct from components, transferring the tokens
91 const Xfer<List<token> >& tokens,
92 streamFormat format=ASCII,
93 versionNumber version=currentVersion
96 Istream(format, version),
106 //- Construct as copy
107 ITstream(const ITstream& its)
109 Istream(ASCII, currentVersion),
128 //- Return the name of the stream
129 const fileName& name() const
134 //- Return non-const access to the name of the stream
140 //- Return the current token index
141 label tokenIndex() const
146 //- Return non-const access to the current token index
152 //- Return the number of remaining tokens
153 label nRemainingTokens() const
155 return size() - tokenIndex_;
158 //- Return flags of output stream
159 ios_base::fmtflags flags() const
161 return ios_base::fmtflags(0);
167 //- Return next token from stream
168 virtual Istream& read(token&);
171 virtual Istream& read(char&);
174 virtual Istream& read(word&);
176 // Read a string (including enclosing double-quotes)
177 virtual Istream& read(string&);
180 virtual Istream& read(label&);
182 //- Read a floatScalar
183 virtual Istream& read(floatScalar&);
185 //- Read a doubleScalar
186 virtual Istream& read(doubleScalar&);
188 //- Read binary block
189 virtual Istream& read(char*, std::streamsize);
191 //- Rewind and return the stream so that it may be read again
192 virtual Istream& rewind();
197 //- Set flags of stream
198 ios_base::fmtflags flags(const ios_base::fmtflags)
200 return ios_base::fmtflags(0);
206 //- Print description of IOstream to Ostream
207 void print(Ostream&) const;
211 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 } // End namespace Foam
215 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 // ************************************************************************* //