dictionaryEntryIO.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-2015 OpenFOAM Foundation
9  Copyright (C) 2016-2021 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 "dictionaryEntry.H"
30 #include "IOstreams.H"
31 
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
33 
35 (
36  const dictionary& parentDict,
37  Istream& is
38 )
39 :
40  entry(keyType(is)),
41  dictionary(parentDict, dictionary(is))
42 {
44 }
45 
46 
48 (
49  const keyType& key,
50  const dictionary& parentDict,
51  Istream& is
52 )
53 :
54  entry(key),
55  dictionary(key, parentDict, is)
56 {
58 }
59 
60 
61 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
62 
64 {
66 }
67 
68 
69 // * * * * * * * * * * * * * * Ostream operator * * * * * * * * * * * * * * //
70 
71 Foam::Ostream& Foam::operator<<
72 (
73  Ostream& os,
74  const dictionaryEntry& e
75 )
76 {
77  e.write(os);
78  return os;
79 }
80 
81 
82 template<>
83 Foam::Ostream& Foam::operator<<
84 (
85  Ostream& os,
86  const InfoProxy<dictionaryEntry>& iproxy
87 )
88 {
89  const auto& e = *iproxy;
90 
91  os << " dictionaryEntry '" << e.keyword() << "'" << endl;
92 
93  return os;
94 }
95 
96 
97 // ************************************************************************* //
void writeEntry(Ostream &os) const
Write sub-dictionary with its dictName as its header.
Definition: dictionaryIO.C:157
A class for handling keywords in dictionaries.
Definition: keyType.H:66
dictionaryEntry(const dictionaryEntry &)=delete
No copy construct.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
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...
const dimensionedScalar e
Elementary charge.
Definition: createFields.H:11
const keyType & keyword() const noexcept
Return keyword.
Definition: entry.H:231
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
#define FUNCTION_NAME
virtual void write(Ostream &os) const
Write.
bool fatalCheck(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:51
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Definition: foamGltfBase.H:103
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:63