includeEtcEntry.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) 2015-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::includeEtcEntry
26 
27 Description
28  Specify an etc file to include when reading dictionaries, expects a
29  single string to follow.
30 
31  Searches for files from user/group/shipped directories.
32  The search scheme allows for version-specific and
33  version-independent files using the following hierarchy:
34  - \b user settings:
35  - ~/.OpenFOAM/<VERSION>
36  - ~/.OpenFOAM/
37  - \b group (site) settings (when $WM_PROJECT_SITE is set):
38  - $WM_PROJECT_SITE/<VERSION>/etc/
39  - $WM_PROJECT_SITE/etc/
40  - \b group (site) settings (when $WM_PROJECT_SITE is not set):
41  - $WM_PROJECT_INST_DIR/site/<VERSION>/etc/
42  - $WM_PROJECT_INST_DIR/site/etc/
43  - \b other (shipped) settings:
44  - $WM_PROJECT_DIR/etc/
45 
46  An example of the \c \#includeEtc directive:
47  \verbatim
48  #includeEtc "etcFile"
49  \endverbatim
50 
51  The usual expansion of environment variables and other constructs is
52  retained.
53 
54 See also
55  findEtcFile, fileName, string::expand()
56 
57 SourceFiles
58  includeEtcEntry.C
59 
60 \*---------------------------------------------------------------------------*/
61 
62 #ifndef includeEtcEntry_H
63 #define includeEtcEntry_H
64 
65 #include "functionEntry.H"
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 
69 namespace Foam
70 {
71 namespace functionEntries
72 {
73 
74 /*---------------------------------------------------------------------------*\
75  Class includeEtcEntry Declaration
76 \*---------------------------------------------------------------------------*/
77 
78 class includeEtcEntry
79 :
80  public functionEntry
81 {
82  // Private Member Functions
83 
84  //- Expand include fileName and return
85  static fileName includeEtcFileName
86  (
87  const fileName&,
88  const dictionary&
89  );
90 
91 
92 public:
93 
94  // Static Data Members
95 
96  //- Report which file is included to stdout
97  static bool log;
98 
99 
100  //- Runtime type information
101  ClassName("includeEtc");
102 
103 
104  // Constructors
105 
106  //- Disallow default bitwise copy construction
107  includeEtcEntry(const includeEtcEntry&) = delete;
108 
109 
110  // Member Functions
111 
112  //- Execute the functionEntry in a sub-dict context
113  static bool execute(dictionary& parentDict, Istream&);
114 
115  //- Execute the functionEntry in a primitiveEntry context
116  static bool execute
117  (
118  const dictionary& parentDict,
120  Istream&
121  );
122 
123 
124  // Member Operators
125 
126  //- Disallow default bitwise assignment
127  void operator=(const includeEtcEntry&) = delete;
128 };
129 
130 
131 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
132 
133 } // End namespace functionEntries
134 } // End namespace Foam
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 #endif
139 
140 // ************************************************************************* //
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 etc file to include when reading dictionaries, expects a single string to follow.
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
includeEtcEntry(const includeEtcEntry &)=delete
Disallow default bitwise copy construction.
void operator=(const includeEtcEntry &)=delete
Disallow default bitwise assignment.
ClassName("includeEtc")
Runtime type information.
static bool log
Report which file is included to stdout.
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.