DictionaryBaseIO.C
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) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2019 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 \*---------------------------------------------------------------------------*/
28 
29 #include "DictionaryBase.H"
30 #include "IOstreams.H"
31 
32 // * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
33 
34 template<class IDLListType, class T>
35 Foam::Ostream& Foam::operator<<
36 (
37  Ostream& os,
38  const DictionaryBase<IDLListType, T>& dict
39 )
40 {
41  for (auto iter = dict.cbegin(); iter != dict.cend(); ++iter)
42  {
43  os << *iter;
44 
45  // Check stream before going to next entry.
46  if (!os.good())
47  {
48  Info
49  << "operator<<(Ostream&, const DictionaryBase&) : "
50  << "Can't write entry for DictionaryBase"
51  << endl;
52 
53  break;
54  }
55  }
56 
57  return os;
58 }
59 
60 
61 // ************************************************************************* //
dictionary dict
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
messageStream Info
Information stream (stdout output on master, null elsewhere)