Loading...
Searching...
No Matches
dictionaryEntry.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) 2011-2016 OpenFOAM Foundation
9 Copyright (C) 2017-2021 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::dictionaryEntry
29
30Description
31 A keyword and a list of tokens is a 'dictionaryEntry'.
32
33 An dictionaryEntry can be read, written and printed, and the types and
34 values of its tokens analysed. A dictionaryEntry is a high-level building
35 block for data description. It is a front-end for the token parser.
36 A list of entries can be used as a set of keyword syntax elements,
37 for example.
38
39SourceFiles
40 dictionaryEntry.C
41 dictionaryEntryIO.C
42
43\*---------------------------------------------------------------------------*/
44
45#ifndef Foam_dictionaryEntry_H
46#define Foam_dictionaryEntry_H
47
48#include "entry.H"
49#include "dictionary.H"
50#include "InfoProxy.H"
51
52// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53
54namespace Foam
55{
56
57// Forward Declarations
58class dictionaryEntry;
60
61template<>
63
65/*---------------------------------------------------------------------------*\
66 Class dictionaryEntry Declaration
67\*---------------------------------------------------------------------------*/
68
70:
71 public entry,
72 public dictionary
73{
74public:
75
76 // Generated Methods
77
78 //- No copy construct
79 dictionaryEntry(const dictionaryEntry&) = delete;
80
81
82 // Constructors
83
84 //- Construct from the parent dictionary and Istream.
85 // The keyword is extracted from the stream
86 dictionaryEntry(const dictionary& parentDict, Istream& is);
87
88 //- Construct from the keyword, parent dictionary and a Istream
90 (
91 const keyType& key,
92 const dictionary& parentDict,
93 Istream& is
94 );
95
96 //- Construct from the keyword, parent dictionary and a dictionary
98 (
99 const keyType& key,
100 const dictionary& parentDict,
101 const dictionary& dict
102 );
103
104 //- Construct as copy for the given parent dictionary
106 (
107 const dictionary& parentDict,
108 const dictionaryEntry& dictEnt
109 );
110
111 autoPtr<entry> clone(const dictionary& parentDict) const
112 {
113 return autoPtr<entry>(new dictionaryEntry(parentDict, *this));
114 }
115
116
117 // Member functions
118
119 //- Return the scoped dictionary name (eg, dictA.dictB.dictC)
120 virtual const fileName& name() const
121 {
122 return dictionary::name();
123 }
124
125 //- Return scoped dictionary name for modification
126 virtual fileName& name()
127 {
129 }
130
131 //- Return scoped dictionary name relative to the current case
132 virtual fileName relativeName() const
133 {
135 }
137 //- Return line number of first token in dictionary
138 virtual label startLineNumber() const;
139
140 //- Return line number of last token in dictionary
141 virtual label endLineNumber() const;
142
143 //- This entry is not a primitive,
144 //- calling this function generates a FatalError
145 virtual ITstream& stream() const;
146
147
148 //- Return pointer to this dictionary
149 virtual const dictionary* dictPtr() const noexcept;
150
151 //- Return non-const pointer to this dictionary
152 virtual dictionary* dictPtr() noexcept;
153
154 //- Return dictionary (ie, this)
155 virtual const dictionary& dict() const noexcept;
156
157 //- Return non-const access to dictionary
158 virtual dictionary& dict() noexcept;
159
160
161 //- Write
162 virtual void write(Ostream& os) const;
163
164 //- Return info proxy,
165 //- used to print token information to a stream
166 InfoProxy<dictionaryEntry> info() const noexcept { return *this; }
167
168
169 // Ostream Operators
170
171 friend Ostream& operator<<(Ostream& os, const dictionaryEntry& e);
172};
173
174
175// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
176
177} // End namespace Foam
178
179// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180
181#endif
182
183// ************************************************************************* //
writer write("magLe", fld)
An input stream of tokens.
Definition ITstream.H:56
A helper class for outputting values to Ostream.
Definition InfoProxy.H:49
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
A keyword and a list of tokens is a 'dictionaryEntry'.
virtual fileName & name()
Return scoped dictionary name for modification.
autoPtr< entry > clone(const dictionary &parentDict) const
Construct on freestore as copy with reference to the.
virtual fileName relativeName() const
Return scoped dictionary name relative to the current case.
virtual const fileName & name() const
Return the scoped dictionary name (eg, dictA.dictB.dictC).
InfoProxy< dictionaryEntry > info() const noexcept
Return info proxy, used to print token information to a stream.
dictionaryEntry(const dictionaryEntry &)=delete
No copy construct.
virtual void write(Ostream &os) const
Write.
virtual const dictionary & dict() const noexcept
Return dictionary (ie, this).
friend Ostream & operator<<(Ostream &os, const dictionaryEntry &e)
virtual const dictionary * dictPtr() const noexcept
Return pointer to this dictionary.
virtual label endLineNumber() const
Return line number of last token in dictionary.
virtual ITstream & stream() const
This entry is not a primitive, calling this function generates a FatalError.
virtual label startLineNumber() const
Return line number of first token in dictionary.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
const fileName & name() const noexcept
The dictionary name.
Definition dictionaryI.H:41
dictionary()
Default construct, a top-level empty dictionary.
Definition dictionary.C:68
autoPtr< dictionary > clone() const
Construct and return clone.
Definition dictionary.C:165
fileName relativeName(const bool caseTag=false) const
The dictionary name relative to the case.
Definition dictionary.C:179
friend class entry
Declare friendship with the entry class for IO.
Definition dictionary.H:338
A class for handling file names.
Definition fileName.H:75
A class for handling keywords in dictionaries.
Definition keyType.H:69
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
const direction noexcept
Definition scalarImpl.H:265
dictionary dict
volScalarField & e