ifEntry.H
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) 2018 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::functionEntries::ifEntry
28
29Description
30 Conditional parsing of dictionary entries.
31
32 E.g.
33 \verbatim
34 U_inlet 15;
35
36 #if #calc "${U_inlet} < 10"
37 ..
38 #else
39 ..
40 #endif
41 \endverbatim
42
43 Note:
44 - only supports single line, '\' is not supported
45 - condition should be readable as a \c Switch
46 (0,1, true, false, etc.) or a scalar (0.0, ...)
47
48See also
49 Foam::functionEntries::ifeqEntry
50 Foam::Switch
51
52SourceFiles
53 ifEntry.C
54
55\*---------------------------------------------------------------------------*/
56
57#ifndef functionEntries_ifEntry_H
58#define functionEntries_ifEntry_H
59
60#include "ifeqEntry.H"
61
62// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63
64namespace Foam
65{
66namespace functionEntries
67{
68
69/*---------------------------------------------------------------------------*\
70 Class ifEntry Declaration
71\*---------------------------------------------------------------------------*/
73class ifEntry
74:
75 public ifeqEntry
77 friend class ifeqEntry;
78
79 // Private Member Functions
80
81 //- Test first token (label, scalar, word) for true/false
82 static bool isTrue(ITstream& is);
83
84 //- Execute the functionEntry in a sub-dict context
85 static bool execute
86 (
88 dictionary& parentDict,
89 Istream& is
90 );
91
92public:
93
94 //- Runtime type information
95 ClassName("if");
96
97 // Member Functions
98
99 //- Execute the functionEntry in a sub-dict context
100 static bool execute(dictionary& parentDict, Istream& is);
101};
102
103
104// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
105
106} // End namespace functionEntries
107} // End namespace Foam
108
109// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
110
111#endif
112
113// ************************************************************************* //
static bool isTrue(const char *envName, bool deflt)
Definition: sigFpe.C:70
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
Definition: DynamicList.H:72
An input stream of tokens.
Definition: ITstream.H:56
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Conditional parsing of dictionary entries.
Definition: ifEntry.H:75
ClassName("if")
Runtime type information.
Conditional parsing of dictionary entries.
Definition: ifeqEntry.H:92
#define ClassName(TypeNameString)
Add typeName information from argument TypeNameString to a class.
Definition: className.H:67
Namespace for OpenFOAM.