1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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& t)",
83 ) << "attempt to read beyond EOF"
84 << exit(FatalIOError);
95 token::undefinedToken.lineNumber()
96 = operator[](size() - 1).lineNumber();
100 token::undefinedToken.lineNumber() = lineNumber();
103 t = token::undefinedToken;
110 Foam::Istream& Foam::ITstream::read(char&)
112 notImplemented("Istream& ITstream::read(char& c)");
117 Foam::Istream& Foam::ITstream::read(word&)
119 notImplemented("Istream& ITstream::read(word&)");
124 Foam::Istream& Foam::ITstream::read(string&)
126 notImplemented("Istream& ITstream::read(string&)");
131 Foam::Istream& Foam::ITstream::read(label&)
133 notImplemented("Istream& ITstream::read(label&)");
138 Foam::Istream& Foam::ITstream::read(floatScalar&)
140 notImplemented("Istream& ITstream::read(floatScalar&)");
145 Foam::Istream& Foam::ITstream::read(doubleScalar&)
147 notImplemented("Istream& ITstream::read(doubleScalar&)");
152 Foam::Istream& Foam::ITstream::read(longDoubleScalar&)
154 notImplemented("Istream& ITstream::read(longDoubleScalar&)");
159 Foam::Istream& Foam::ITstream::read(char*, std::streamsize)
161 notImplemented("Istream& ITstream::read(char*, std::streamsize)");
166 // Rewind the token stream so that it may be read again
167 Foam::Istream& Foam::ITstream::rewind()
173 lineNumber_ = operator[](0).lineNumber();
182 // ************************************************************************* //