includeEntry.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) 2011-2019 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::includeEntry
26 
27 Description
28  Specify an include file when reading dictionaries, expects a
29  single string to follow.
30 
31  An example of the \c \#include directive:
32  \verbatim
33  #include "includeFile"
34  \endverbatim
35 
36  The usual expansion of environment variables and other constructs
37  (eg, the \c ~OpenFOAM/ expansion) is retained.
38 
39 See also
40  fileName, string::expand()
41 
42 SourceFiles
43  includeEntry.C
44 
45 \*---------------------------------------------------------------------------*/
46 
47 #ifndef includeEntry_H
48 #define includeEntry_H
49 
50 #include "functionEntry.H"
51 
52 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 
54 namespace Foam
55 {
56 namespace functionEntries
57 {
58 
59 /*---------------------------------------------------------------------------*\
60  Class includeEntry Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class includeEntry
64 :
65  public functionEntry
66 {
67 
68 protected:
69 
70  // Protected Member Functions
71 
72  //- Read the include fileName from Istream, expand and return
73  static fileName includeFileName(Istream&, const dictionary&);
74 
75  //- Expand include fileName and return
77  (
78  const fileName& dir,
79  const fileName&,
80  const dictionary&
81  );
82 
83 
84 public:
85 
86  // Static Data Members
87 
88  //- Report which file is included to stdout
89  static bool log;
90 
91 
92  //- Runtime type information
93  ClassName("include");
94 
95 
96  // Constructors
97 
98  //- Disallow default bitwise copy construction
99  includeEntry(const includeEntry&) = delete;
100 
101 
102  // Member Functions
103 
104  //- Execute the functionEntry in a sub-dict context
105  static bool execute(dictionary& parentDict, Istream&);
106 
107  //- Execute the functionEntry in a primitiveEntry context
108  static bool execute
109  (
110  const dictionary& parentDict,
112  Istream&
113  );
114 
115 
116  // Member Operators
117 
118  //- Disallow default bitwise assignment
119  void operator=(const includeEntry&) = delete;
120 };
121 
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 } // End namespace functionEntries
126 } // End namespace Foam
127 
128 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
129 
130 #endif
131 
132 // ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:60
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
A class for handling file names.
Definition: fileName.H:82
Specify an include file when reading dictionaries, expects a single string to follow.
Definition: includeEntry.H:65
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
Definition: includeEntry.C:122
ClassName("include")
Runtime type information.
includeEntry(const includeEntry &)=delete
Disallow default bitwise copy construction.
static fileName includeFileName(Istream &, const dictionary &)
Read the include fileName from Istream, expand and return.
Definition: includeEntry.C:73
void operator=(const includeEntry &)=delete
Disallow default bitwise assignment.
static bool log
Report which file is included to stdout.
Definition: includeEntry.H:88
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:66
A keyword and a list of tokens is a 'primitiveEntry'. An primitiveEntry can be read,...
Namespace for OpenFOAM.