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/>.
24 \*---------------------------------------------------------------------------*/
29 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
31 void Foam::ITstream::print(Ostream& os) const
33 os << "ITstream : " << name_.c_str();
37 if (begin()->lineNumber() == rbegin()->lineNumber())
39 os << ", line " << begin()->lineNumber() << ", ";
43 os << ", lines " << begin()->lineNumber()
44 << '-' << rbegin()->lineNumber() << ", ";
49 os << ", line " << lineNumber() << ", ";
56 Foam::Istream& Foam::ITstream::read(token& t)
58 // Return the put back token if it exists
59 if (Istream::getBack(t))
61 lineNumber_ = t.lineNumber();
65 if (tokenIndex_ < size())
67 t = operator[](tokenIndex_++);
68 lineNumber_ = t.lineNumber();
70 if (tokenIndex_ == size())
81 "ITstream::read(token&)",
83 ) << "attempt to read beyond EOF"
84 << exit(FatalIOError);
93 t = token::undefinedToken;
97 t.lineNumber() = tokenList::last().lineNumber();
101 t.lineNumber() = lineNumber();
109 Foam::Istream& Foam::ITstream::read(char&)
111 notImplemented("Istream& ITstream::read(char&)");
116 Foam::Istream& Foam::ITstream::read(word&)
118 notImplemented("Istream& ITstream::read(word&)");
123 Foam::Istream& Foam::ITstream::read(string&)
125 notImplemented("Istream& ITstream::read(string&)");
130 Foam::Istream& Foam::ITstream::read(label&)
132 notImplemented("Istream& ITstream::read(label&)");
137 Foam::Istream& Foam::ITstream::read(floatScalar&)
139 notImplemented("Istream& ITstream::read(floatScalar&)");
144 Foam::Istream& Foam::ITstream::read(doubleScalar&)
146 notImplemented("Istream& ITstream::read(doubleScalar&)");
151 Foam::Istream& Foam::ITstream::read(char*, std::streamsize)
153 notImplemented("Istream& ITstream::read(char*, std::streamsize)");
158 Foam::Istream& Foam::ITstream::rewind()
164 lineNumber_ = tokenList::first().lineNumber();
173 // ************************************************************************* //