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/>.
28 Input from memory buffer stream.
33 \*---------------------------------------------------------------------------*/
35 #ifndef IStringStream_H
36 #define IStringStream_H
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 /*---------------------------------------------------------------------------*\
47 Class IStringStream Declaration
48 \*---------------------------------------------------------------------------*/
59 //- Construct from string
63 streamFormat format=ASCII,
64 versionNumber version=currentVersion
69 *(new std::istringstream(buffer)),
70 "IStringStream.sourceFile",
77 //- Construct from char*
81 streamFormat format=ASCII,
82 versionNumber version=currentVersion
87 *(new std::istringstream(buffer)),
88 "IStringStream.sourceFile",
98 delete &dynamic_cast<std::istringstream&>(stdStream());
106 //- Return the string
109 return dynamic_cast<const std::istringstream&>
118 //- Print description to Ostream
119 void print(Ostream&) const;
124 //- Return a non-const reference to const Istream
125 // Needed for read-constructors where the stream argument is temporary:
126 // e.g. thing thisThing(IFstream("thingFileName")());
127 Istream& operator()() const
129 return const_cast<IStringStream&>(*this);
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
136 } // End namespace Foam
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
142 // ************************************************************************* //