dictionaryListEntry.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) 2016-2023 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::dictionaryListEntry
26 
27 Description
28  Read/write List of dictionaries.
29 
30  The List entries get stored in a
31  dictionary which itself is stored in the parent dictionary with
32  keyword 'entryDDD' where DDD is the position in the parent dictionary.
33  The printing is again in List format - the keyword is only printed as
34  comment. Can be used to e.g. manipulate polyMesh/boundary files.
35 
36 SourceFiles
37  dictionaryListEntry.C
38  dictionaryListEntryIO.C
39 
40 \*---------------------------------------------------------------------------*/
41 
42 #ifndef dictionaryListEntry_H
43 #define dictionaryListEntry_H
44 
45 #include "dictionaryEntry.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 namespace Foam
50 {
51 
52 // Forward declaration of friend functions and operators
53 
54 class dictionaryListEntry;
55 
56 Ostream& operator<<(Ostream&, const dictionaryListEntry&);
57 
58 
59 /*---------------------------------------------------------------------------*\
60  Class dictionaryListEntry Declaration
61 \*---------------------------------------------------------------------------*/
62 
64 :
65  public dictionaryEntry
66 {
67  // Private Member Functions
68 
69  //- Returns size of dictionary without FoamFile
70  static label realSize(const dictionary&);
71 
72 
73 public:
74 
75  // Constructors
76 
77  //- Construct from the parent dictionary and Istream
78  dictionaryListEntry(const dictionary& parentDict, Istream&);
79 
80  //- Construct as copy for the given parent dictionary
82  (
83  const dictionary& parentDict,
84  const dictionaryListEntry&
85  );
86 
87  //- Disallow bitwise copy
88  dictionaryListEntry(const dictionary&) = delete;
89 
90  autoPtr<entry> clone(const dictionary& parentDict) const
91  {
92  return autoPtr<entry>(new dictionaryListEntry(parentDict, *this));
93  }
94 
95 
96  // Member Functions
97 
98  //- Write
99  virtual void write(Ostream&) const;
100 
101  //- Return info proxy.
102  // Used to print token information to a stream
104  {
105  return *this;
106  }
107 
108 
109  // Ostream operator
110 
111  friend Ostream& operator<<(Ostream&, const dictionaryListEntry&);
112 };
113 
114 
115 template<>
117 
118 
119 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
120 
121 } // End namespace Foam
122 
123 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
124 
125 #endif
126 
127 // ************************************************************************* //
A helper class for outputting values to Ostream.
Definition: InfoProxy.H:50
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:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A keyword and a list of tokens is a 'dictionaryEntry'.
Read/write List of dictionaries.
virtual void write(Ostream &) const
Write.
dictionaryListEntry(const dictionary &parentDict, Istream &)
Construct from the parent dictionary and Istream.
friend Ostream & operator<<(Ostream &, const dictionaryListEntry &)
InfoProxy< dictionaryListEntry > info() const
Return info proxy.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
autoPtr< dictionary > clone() const
Construct and return clone.
Definition: dictionary.C:398
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59
Ostream & operator<<(Ostream &os, const fvConstraints &constraints)