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-2018 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  // Private Member Functions
68 
69  //- Disallow default bitwise copy construct
70  includeEntry(const includeEntry&);
71 
72  //- Disallow default bitwise assignment
73  void operator=(const includeEntry&);
74 
75 protected:
76 
77  // Protected Member Functions
78 
79  //- Read the include fileName from Istream, expand and return
80  static fileName includeFileName(Istream&, const dictionary&);
81 
82  //- Expand include fileName and return
84  (
85  const fileName& dir,
86  const fileName&,
87  const dictionary&
88  );
89 
90 public:
91 
92  // Static data members
93 
94  //- Report which file is included to stdout
95  static bool log;
96 
97 
98  //- Runtime type information
99  ClassName("include");
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 
117 
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
119 
120 } // End namespace functionEntries
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:69
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
ClassName("include")
Runtime type information.
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
Definition: includeEntry.C:122
A keyword and a list of tokens is a &#39;primitiveEntry&#39;. An primitiveEntry can be read, written and printed, and the types and values of its tokens analysed.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:63
Specify an include file when reading dictionaries, expects a single string to follow.
Definition: includeEntry.H:62
static fileName includeFileName(Istream &, const dictionary &)
Read the include fileName from Istream, expand and return.
Definition: includeEntry.C:73
static bool log
Report which file is included to stdout.
Definition: includeEntry.H:94
Namespace for OpenFOAM.