Loading...
Searching...
No Matches
dictionaryContent.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) 2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::dictionaryContent
28
29Description
30 A wrapper for dictionary content, \em without operators that could
31 affect inheritance patterns.
32
33\*---------------------------------------------------------------------------*/
34
35#ifndef Foam_dictionaryContent_H
36#define Foam_dictionaryContent_H
37
38#include "dictionary.H"
39#include "wordList.H"
40#include "wordRes.H"
41
42// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43
44namespace Foam
45{
46
47/*---------------------------------------------------------------------------*\
48 Class dictionaryContent Declaration
49\*---------------------------------------------------------------------------*/
50
52{
53 // Private Data
54
55 //- The dictionary content
56 dictionary dict_;
57
58public:
59
60 // Constructors
61
62 //- Default construct
63 dictionaryContent() = default;
64
65 //- Copy construct
66 dictionaryContent(const dictionaryContent&) = default;
67
68 //- Move construct
71 //- Copy construct from dictionary
72 explicit dictionaryContent(const dictionary& dict)
73 :
74 dict_(dict)
75 {}
76
77 //- Move construct from dictionary
79 :
80 dict_(std::move(dict))
81 {}
82
84 //- Destructor
85 virtual ~dictionaryContent() = default;
86
87
88 // Member Functions
89
90 //- Copy construct a dictionary,
91 //- filtered by simple allow/deny lists
92 //
93 // An empty 'allow' list accepts everything not in the 'deny' list.
94 //
95 // \return filtered dictionary copy
96 static dictionary copyDict
97 (
98 const dictionary& input,
99 const wordList& allow = wordList(),
100 const wordList& deny = wordList()
101 );
102
103 //- Copy construct a dictionary,
104 //- filtered by a combination of allow/deny lists
105 //
106 // An empty 'allow' list accepts everything not in the 'deny' list.
107 // A literal match has higher priority over a regex match.
108 //
109 // \verbatim
110 // input: ( abc apple wall wall1 wall2 )
111 // allow: ( abc def "wall.*" )
112 // deny: ( "[ab].*" wall )
113 //
114 // result: (abc wall1 wall2)
115 // \endverbatim
116 //
117 // \return filtered dictionary copy
118 static dictionary copyDict
119 (
120 const dictionary& input,
121 const wordRes& allow,
122 const wordRes& deny = wordRes()
123 );
124
125
126 //- Read-access to the content
127 const dictionary& dict() const noexcept
128 {
129 return dict_;
130 }
131
132 //- Copy assign new content
133 void dict(const dictionary& dict)
134 {
135 dict_ = dict;
136 }
137
138 //- Move assign new content
139 void dict(dictionary&& dict)
140 {
141 dict_ = std::move(dict);
143
144
145 // Operators
146
147 //- No copy assignment
148 void operator=(const dictionaryContent&) = delete;
149
150 //- No move assignment
151 void operator=(dictionaryContent&&) = delete;
152};
153
154
155// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156
157} // End namespace Foam
159// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
160
161#endif
162
163// ************************************************************************* //
A wrapper for dictionary content, without operators that could affect inheritance patterns.
virtual ~dictionaryContent()=default
Destructor.
void dict(dictionary &&dict)
Move assign new content.
dictionaryContent(dictionary &&dict)
Move construct from dictionary.
dictionaryContent(dictionaryContent &&)=default
Move construct.
dictionaryContent()=default
Default construct.
void operator=(const dictionaryContent &)=delete
No copy assignment.
void operator=(dictionaryContent &&)=delete
No move assignment.
void dict(const dictionary &dict)
Copy assign new content.
dictionaryContent(const dictionary &dict)
Copy construct from dictionary.
static dictionary copyDict(const dictionary &input, const wordList &allow=wordList(), const wordList &deny=wordList())
Copy construct a dictionary, filtered by simple allow/deny lists.
const dictionary & dict() const noexcept
Read-access to the content.
dictionaryContent(const dictionaryContent &)=default
Copy construct.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
A List of wordRe with additional matching capabilities.
Definition wordRes.H:56
Namespace for OpenFOAM.
List< word > wordList
List of word.
Definition fileName.H:60
const direction noexcept
Definition scalarImpl.H:265
dictionary dict