inputSyntaxEntry.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) 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::inputSyntaxEntry
26 
27 Description
28  Specify the dictionary scoping syntax, expects a single word to follow.
29 
30  An example of \c \#inputSyntax directive:
31  \verbatim
32  #inputSyntax dot
33  \endverbatim
34 
35  The possible input syntax:
36  - \par slash use '/' as the scope operator
37  '../' to go to the parent dictionary
38  and '!' to go to the top-level dictionary
39  - \par dot use '.' as the scope operator
40  '..' to go to the parent dictionary
41  and ':' to go to the top-level dictionary
42 
43  The default dictionary syntax is \c dot but can be changed to \c slash in
44  etc/controlDict
45  \verbatim
46  OptimisationSwitches
47  {
48  .
49  .
50  .
51  inputSyntax slash;
52  }
53  \endverbatim
54 
55 SourceFiles
56  inputSyntaxEntry.C
57 
58 \*---------------------------------------------------------------------------*/
59 
60 #ifndef inputSyntaxEntry_H
61 #define inputSyntaxEntry_H
62 
63 #include "functionEntry.H"
64 
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66 
67 namespace Foam
68 {
69 namespace functionEntries
70 {
71 
72 /*---------------------------------------------------------------------------*\
73  Class inputSyntaxEntry Declaration
74 \*---------------------------------------------------------------------------*/
75 
76 class inputSyntaxEntry
77 :
78  public functionEntry
79 {
80  //- The input syntax options
81  enum inputSyntax
82  {
83  SLASH,
84  DOT
85  };
86 
87  //- The default input syntax
88  static inputSyntax defaultSyntax_;
89 
90  //- The current input syntax
91  static inputSyntax syntax_;
92 
93 
94  // Private Member Functions
95 
96  //- Read the syntax as a word and return the corresponding enum
97  static inputSyntax syntax(Istream&);
98 
99 
100 public:
101 
102  //- Runtime type information
103  ClassName("inputSyntax");
104 
105 
106  // Constructors
107 
108  //- Disallow default bitwise copy construction
109  inputSyntaxEntry(const inputSyntaxEntry&) = delete;
110 
111 
112  // Member Functions
113 
114  //- Execute the functionEntry in a sub-dict context
115  static bool execute(dictionary& parentDict, Istream&);
116 
117  //- Reset the inputSyntax to the default specified in etc/controlDict
118  // if not specified to %dot
119  static void clear();
120 
121  //- Return true if the inputSyntax is %slash
122  static bool slash();
123 
124  //- Return true if the inputSyntax is %dot
125  static bool dot();
126 
127  //- Return true if the inputSyntax is %slash
128  static char scopeChar();
129 
130 
131  // Member Operators
132 
133  //- Disallow default bitwise assignment
134  void operator=(const inputSyntaxEntry&) = delete;
135 };
136 
137 
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
139 
140 } // End namespace functionEntries
141 } // End namespace Foam
142 
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 
145 #endif
146 
147 // ************************************************************************* //
static bool slash()
Return true if the inputSyntax is slash.
static bool execute(dictionary &parentDict, Istream &)
Execute the functionEntry in a sub-dict context.
void operator=(const inputSyntaxEntry &)=delete
Disallow default bitwise assignment.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
Specify the dictionary scoping syntax, expects a single word to follow.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
static bool dot()
Return true if the inputSyntax is dot.
ClassName("inputSyntax")
Runtime type information.
A functionEntry causes entries to be added/manipulated on the specified dictionary given an input str...
Definition: functionEntry.H:63
static char scopeChar()
Return true if the inputSyntax is slash.
static void clear()
Reset the inputSyntax to the default specified in etc/controlDict.
inputSyntaxEntry(const inputSyntaxEntry &)=delete
Disallow default bitwise copy construction.
Namespace for OpenFOAM.