caseFileConfiguration.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
26 #include "caseFileConfiguration.H"
27 #include "Time.H"
28 
29 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
30 
32 {
33  os << indent << "{" << incrIndent << endl;
34 }
35 
36 
37 void Foam::caseFileConfiguration::beginDict(OFstream& os,const word& name)
38 {
39  os << indent << name << endl;
40  beginDict(os);
41 }
42 
43 
44 void Foam::caseFileConfiguration::endDict(OFstream& os, bool newline)
45 {
46  os << decrIndent << indent << "}" << endl;
47 
48  if (newline)
49  {
50  os << endl;
51  }
52 }
53 
54 
56 {
57  os << indent << "(" << incrIndent << endl;
58 }
59 
60 
61 void Foam::caseFileConfiguration::beginList(OFstream& os, const word& name)
62 {
63  os << indent << name << endl;
64  beginList(os);
65 }
66 
67 
68 void Foam::caseFileConfiguration::endList(OFstream& os, bool newline)
69 {
70  os << decrIndent << indent << ");" << endl;
71 
72  if (newline)
73  {
74  os << endl;
75  }
76 }
77 
78 
79 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
80 
82 (
83  const fileName& name,
84  const fileName& dir,
85  const Time& time
86 )
87 :
88  dict_(IOobject(name, dir, time)),
89  os_(dict_.objectPath(true))
90 {}
91 
92 
93 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
94 
96 {}
97 
98 
99 // ************************************************************************* //
~caseFileConfiguration()
Destructor.
void endList(OFstream &os, bool newline=true)
Output stream to end a list.
void beginDict(OFstream &os)
Output stream to begin a new dictionary without name.
caseFileConfiguration(const fileName &name, const fileName &dir, const Time &time)
Construct from components.
void beginList(OFstream &os)
Output stream to begin a new list without name.
void endDict(OFstream &os, bool newline=true)
Output stream to end a dictionary.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
Definition: Ostream.H:235
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
word name(const bool)
Return a word representation of a bool.
Definition: boolIO.C:39
Ostream & incrIndent(Ostream &os)
Increment the indent level.
Definition: Ostream.H:228
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:221