wordDirective.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) 2021 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::functionEntries::wordDirective
28 
29 Description
30  Converts/expands string content to a word.
31  This can be useful for composition of names.
32 
33  For example,
34  \verbatim
35  #word "some_prefix_solverInfo_${application}_${{10 * 5}}"
36  {
37  type solverInfo;
38  libs (utilityFunctionObjects);
39  fields (".*");
40 
41  returnName #word solver$type;
42  }
43  \endverbatim
44 
45 SourceFiles
46  wordDirective.C
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #ifndef functionEntries_wordDirective_H
51 #define functionEntries_wordDirective_H
52 
53 #include "functionEntry.H"
54 
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
56 
57 namespace Foam
58 {
59 namespace functionEntries
60 {
61 
62 /*---------------------------------------------------------------------------*\
63  Class wordDirective Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 class wordDirective
67 :
68  public functionEntry
69 {
70  // Private Member Functions
71 
72  //- Evaluate
73  static token evaluate(const dictionary& parentDict, Istream& is);
74 
75 
76 public:
77 
78  //- Execute in a primitiveEntry context
79  static bool execute
80  (
81  const dictionary& parentDict,
83  Istream& is
84  );
85 
86  //- Execute in a sub-dict context.
87  static bool execute(dictionary& parentDict, Istream& is);
88 };
89 
90 
91 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
92 
93 } // End namespace functionEntries
94 } // End namespace Foam
95 
96 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98 #endif
99 
100 // ************************************************************************* //
static bool execute(const dictionary &parentDict, primitiveEntry &entry, Istream &is)
Execute in a primitiveEntry context.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:120
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
A token holds an item read from Istream.
Definition: token.H:64
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read...
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:63
Converts/expands string content to a word. This can be useful for composition of names.
Definition: wordDirective.H:61
Namespace for OpenFOAM.
A keyword and a list of tokens is an &#39;entry&#39;.
Definition: entry.H:63