includeEtcEntry.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 | Copyright (C) 2015-2016 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>
39  - $WM_PROJECT_SITE
40  - \b group (site) settings (when $WM_PROJECT_SITE is not set):
41  - $WM_PROJECT_INST_DIR/site/<VERSION>
42  - $WM_PROJECT_INST_DIR/site/
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  //- Disallow default bitwise copy construct
86 
87  //- Disallow default bitwise assignment
88  void operator=(const includeEtcEntry&);
89 
90  //- Expand include fileName and return
91  static fileName includeEtcFileName
92  (
93  const fileName&,
94  const dictionary&
95  );
96 
97 
98 public:
99 
100  // Static data members
101 
102  //- Report which file is included to stdout
103  static bool log;
104 
105 
106  //- Runtime type information
107  ClassName("includeEtc");
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 
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
126 
127 } // End namespace functionEntries
128 } // End namespace Foam
129 
130 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
131 
132 #endif
133 
134 // ************************************************************************* //
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
static bool log
Report which file is included to stdout.
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 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.
ClassName("includeEtc")
Runtime type information.
Namespace for OpenFOAM.