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 | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2015-2016 OpenFOAM Foundation
9 Copyright (C) 2018-2019 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Class
28 Foam::functionEntries::includeEtcEntry
29
30Description
31 A dictionary directive for including a file found using the
32 Foam::findEtcFile() mechanism.
33
34 Specify an etc file to include when reading dictionaries, expects a
35 single string to follow.
36
37 An example of the \c \#includeEtc directive:
38 \verbatim
39 #includeEtc "etcFile"
40 \endverbatim
41
42 The usual expansion of environment variables and other constructs is
43 retained.
44
45See also
46 findEtcFile, fileName, string::expand()
47
48SourceFiles
49 includeEtcEntry.C
50
51\*---------------------------------------------------------------------------*/
52
53#ifndef functionEntries_includeEtcEntry_H
54#define functionEntries_includeEtcEntry_H
55
56#include "functionEntry.H"
57
58// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59
60namespace Foam
61{
62namespace functionEntries
63{
64
65/*---------------------------------------------------------------------------*\
66 Class includeEtcEntry Declaration
67\*---------------------------------------------------------------------------*/
70:
71 public functionEntry
72{
73protected:
74
75 // Protected Member Functions
76
77 //- Expand include fileName and search etc directories for the file
79 (
80 const fileName& f,
81 const dictionary& dict
82 );
83
84 //- Include file in a sub-dict context
85 static bool execute
86 (
87 const bool mandatory,
88 dictionary& parentDict,
89 Istream& is
90 );
91
92 //- Include file in a primitiveEntry context
93 static bool execute
94 (
95 const bool mandatory,
96 const dictionary& parentDict,
98 Istream& is
99 );
100
101public:
102
103 // Static Data Members
104
105 //- Report to stdout which file is included
106 static bool log;
107
108
109 // Member Functions
110
111 //- Include etc file in a sub-dict context
112 static bool execute(dictionary& parentDict, Istream& is);
113
114 //- Include etc file in a primitiveEntry context
115 static bool execute
116 (
117 const dictionary& parentDict,
119 Istream& is
120 );
121};
122
123
124/*---------------------------------------------------------------------------*\
125 Class sincludeEtcEntry Declaration
126\*---------------------------------------------------------------------------*/
127
128//- A dictionary directive for conditionally including an etc file,
129//- expects a single string to follow.
130//
131// The \c \#sincludeEtc directive is identically to the
132// \c \#includeEtc directive, but does not generate an error
133// if the file does not exist.
135:
136 public includeEtcEntry
137{
138public:
139
140 //- Include etc file (if it exists) in a sub-dict context
141 static bool execute(dictionary& parentDict, Istream& is);
142
143 //- Include etc file (if it exists) in a primitiveEntry context
144 static bool execute
145 (
146 const dictionary& parentDict,
148 Istream& is
149 );
150};
151
152
153// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154
155} // End namespace functionEntries
156} // End namespace Foam
157
158// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159
160#endif
161
162// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A keyword and a list of tokens is an 'entry'.
Definition: entry.H:70
A class for handling file names.
Definition: fileName.H:76
A dictionary directive for including a file found using the Foam::findEtcFile() mechanism.
static bool log
Report to stdout which file is included.
static fileName resolveEtcFile(const fileName &f, const dictionary &dict)
Expand include fileName and search etc directories for the file.
static bool execute(const bool mandatory, dictionary &parentDict, Istream &is)
Include file in a sub-dict context.
static bool execute(dictionary &parentDict, Istream &is)
Include etc file (if it exists) in a sub-dict context.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:69
A keyword and a list of tokens comprise a primitiveEntry. A primitiveEntry can be read,...
virtual const dictionary & dict() const
This entry is not a dictionary,.
Namespace for OpenFOAM.
labelList f(nPoints)