All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ifEntry.H
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) 2018-2020 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 Class
25  Foam::functionEntries::ifEntry
26 
27 Description
28  Conditional parsing of dictionary entries.
29 
30  E.g.
31  \verbatim
32  U_inlet 15;
33 
34  #if #calc "${U_inlet} < 10"
35  ..
36  #else
37  ..
38  #endif
39  \endverbatim
40 
41  Note:
42  - only supports single line, '\' is not supported
43  - condition should be readable as a \c Switch
44  (supports 0,1, true, false, etc.)
45 
46 See also
47  Foam::functionEntries::ifeqEntry
48  Foam::Switch
49 
50 SourceFiles
51  ifEntry.C
52 
53 \*---------------------------------------------------------------------------*/
54 
55 #ifndef ifEntry_H
56 #define ifEntry_H
57 
58 #include "ifeqEntry.H"
59 
60 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61 
62 namespace Foam
63 {
64 namespace functionEntries
65 {
66 
67 /*---------------------------------------------------------------------------*\
68  Class ifEntry Declaration
69 \*---------------------------------------------------------------------------*/
70 
71 class ifEntry
72 :
73  public ifeqEntry
74 {
75  friend class ifeqEntry;
76 
77  // Private Member Functions
78 
79  //- Execute the functionEntry in a sub-dict context
80  static bool execute
81  (
82  DynamicList<filePos>& stack,
83  dictionary& parentDict,
84  Istream& is
85  );
86 
87 
88 public:
89 
90  //- Runtime type information
91  ClassName("if");
92 
93 
94  // Constructors
95 
96  //- Disallow default bitwise copy construction
97  ifEntry(const ifEntry&) = delete;
98 
99 
100  // Member Functions
101 
102  //- Execute the functionEntry in a sub-dict context
103  static bool execute(dictionary& parentDict, Istream& is);
104 
105 
106  // Member Operators
107 
108  //- Disallow default bitwise assignment
109  void operator=(const ifEntry&) = delete;
110 };
111 
112 
113 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
114 
115 } // End namespace functionEntries
116 } // End namespace Foam
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 #endif
121 
122 // ************************************************************************* //
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
ClassName("if")
Runtime type information.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
Conditional parsing of dictionary entries.
Definition: ifEntry.H:70
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
Definition: DynamicList.H:56
void operator=(const ifEntry &)=delete
Disallow default bitwise assignment.
Conditional parsing of dictionary entries.
Definition: ifeqEntry.H:85
ifEntry(const ifEntry &)=delete
Disallow default bitwise copy construction.
Namespace for OpenFOAM.