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-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::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  '!' to go to the top-level dictionary
39 
40  - \par dot use '.' as the scope operator
41  '..' to go to the parent dictionary
42  ':' to go to the top-level dictionary
43 
44  The default dictionary syntax is \c slash but can be changed to \c dot in
45  etc/controlDict
46  \verbatim
47  OptimisationSwitches
48  {
49  .
50  .
51  .
52  inputSyntax dot;
53  }
54  \endverbatim
55 
56 SourceFiles
57  inputSyntaxEntry.C
58 
59 \*---------------------------------------------------------------------------*/
60 
61 #ifndef inputSyntaxEntry_H
62 #define inputSyntaxEntry_H
63 
64 #include "functionEntry.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 namespace Foam
69 {
70 namespace functionEntries
71 {
72 
73 /*---------------------------------------------------------------------------*\
74  Class inputSyntaxEntry Declaration
75 \*---------------------------------------------------------------------------*/
76 
77 class inputSyntaxEntry
78 :
79  public functionEntry
80 {
81  //- The input syntax options
82  enum inputSyntax
83  {
84  SLASH,
85  DOT
86  };
87 
88  //- The default input syntax
89  static inputSyntax defaultSyntax_;
90 
91  //- The current input syntax
92  static inputSyntax syntax_;
93 
94 
95  // Private Member Functions
96 
97  //- Read the syntax as a word and return the corresponding enum
98  static inputSyntax syntax(Istream&);
99 
100 
101 public:
102 
103  //- Runtime type information
104  ClassName("inputSyntax");
105 
106 
107  // Constructors
108 
109  //- Disallow default bitwise copy construction
110  inputSyntaxEntry(const inputSyntaxEntry&) = delete;
111 
112 
113  // Member Functions
114 
115  //- Execute the functionEntry in a sub-dict context
116  static bool execute(dictionary& parentDict, Istream&);
117 
118  //- Reset the inputSyntax to the default specified in etc/controlDict
119  // if not specified to %dot
120  static void clear();
121 
122  //- Return true if the inputSyntax is %slash
123  static bool slash();
124 
125  //- Return true if the inputSyntax is %dot
126  static bool dot();
127 
128  //- Return true if the inputSyntax is %slash
129  static char scopeChar();
130 
131 
132  // Member Operators
133 
134  //- Disallow default bitwise assignment
135  void operator=(const inputSyntaxEntry&) = delete;
136 };
137 
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 } // End namespace functionEntries
142 } // End namespace Foam
143 
144 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 
146 #endif
147 
148 // ************************************************************************* //
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:156
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.