mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add dictionaryContent wrapper
STYLE: adjust wording of age-warning
This commit is contained in:
125
src/OpenFOAM/db/dictionary/dictionaryContent/dictionaryContent.H
Normal file
125
src/OpenFOAM/db/dictionary/dictionaryContent/dictionaryContent.H
Normal file
@ -0,0 +1,125 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | www.openfoam.com
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::dictionaryContent
|
||||
|
||||
Description
|
||||
A wrapper for dictionary content, \em without operators that could
|
||||
affect inheritance patterns.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef dictionaryContent_H
|
||||
#define dictionaryContent_H
|
||||
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class dictionaryContent Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class dictionaryContent
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- The dictionary content
|
||||
dictionary dict_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Default construct
|
||||
dictionaryContent() = default;
|
||||
|
||||
//- Copy construct
|
||||
dictionaryContent(const dictionaryContent&) = default;
|
||||
|
||||
//- Move construct
|
||||
dictionaryContent(dictionaryContent&&) = default;
|
||||
|
||||
//- Copy construct from dictionary
|
||||
explicit dictionaryContent(const dictionary& dict)
|
||||
:
|
||||
dict_(dict)
|
||||
{}
|
||||
|
||||
//- Move construct from dictionary
|
||||
explicit dictionaryContent(dictionary&& dict)
|
||||
:
|
||||
dict_(std::move(dict))
|
||||
{}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~dictionaryContent() = default;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Read-access to the content
|
||||
const dictionary& dict() const noexcept
|
||||
{
|
||||
return dict_;
|
||||
}
|
||||
|
||||
//- Copy assign new content
|
||||
void dict(const dictionary& dict)
|
||||
{
|
||||
dict_ = dict;
|
||||
}
|
||||
|
||||
//- Move assign new content
|
||||
void dict(dictionary&& dict)
|
||||
{
|
||||
dict_ = std::move(dict);
|
||||
}
|
||||
|
||||
|
||||
// Operators
|
||||
|
||||
//- No copy assignment
|
||||
void operator=(const dictionaryContent&) = delete;
|
||||
|
||||
//- No move assignment
|
||||
void operator=(dictionaryContent&&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2014 OpenFOAM Foundation
|
||||
Copyright (C) 2015-2020 OpenCFD Ltd.
|
||||
Copyright (C) 2015-2021 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -49,7 +49,7 @@ void Foam::error::warnAboutAge(const char* what, const int version)
|
||||
// Warning for things that predate the YYMM versioning
|
||||
// (eg, 240 for version 2.4)
|
||||
std::cerr
|
||||
<< " This " << what << " is considered to be VERY old!\n"
|
||||
<< " This " << what << " is very old.\n"
|
||||
<< std::endl;
|
||||
}
|
||||
else if (version < foamVersion::api)
|
||||
@ -62,8 +62,7 @@ void Foam::error::warnAboutAge(const char* what, const int version)
|
||||
);
|
||||
|
||||
std::cerr
|
||||
<< " This " << what << " is deemed to be " << months
|
||||
<< " months old.\n"
|
||||
<< " This " << what << " is " << months << " months old.\n"
|
||||
<< std::endl;
|
||||
}
|
||||
// No warning for (foamVersion::api < version).
|
||||
|
||||
Reference in New Issue
Block a user