STYLE: set readOpt(..), writeOpt(..) by parameter, not by assignment

STYLE: qualify format/version/compression with IOstreamOption not IOstream

STYLE: reduce number of lookups when scanning {fa,fv}Solution

STYLE: call IOobject::writeEndDivider as static
This commit is contained in:
Mark Olesen
2022-07-18 12:11:53 +02:00
parent 8b1514c99b
commit 3d892ace29
135 changed files with 423 additions and 387 deletions

View File

@ -543,10 +543,10 @@ Foam::ensightCase::ensightCase
(
const fileName& ensightDir,
const word& caseName,
const IOstreamOption::streamFormat format
const IOstreamOption::streamFormat fmt
)
:
options_(new options(format)),
options_(new options(fmt)),
os_(nullptr),
ensightDir_(ensightDir),
caseName_(caseName + ".case"),

View File

@ -218,7 +218,7 @@ public:
(
const fileName& ensightDir,
const word& caseName,
const IOstreamOption::streamFormat format = IOstreamOption::BINARY
const IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
);
@ -415,7 +415,7 @@ public:
// Constructors
//- Construct with the specified format (default is binary)
options(IOstreamOption::streamFormat format = IOstreamOption::BINARY);
options(IOstreamOption::streamFormat fmt = IOstreamOption::BINARY);
// Member Functions

View File

@ -29,9 +29,9 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ensightCase::options::options(IOstreamOption::streamFormat format)
Foam::ensightCase::options::options(IOstreamOption::streamFormat fmt)
:
format_(format),
format_(fmt),
overwrite_(false),
nodeValues_(false),
separateCloud_(false),

View File

@ -119,10 +119,10 @@ void Foam::ensightFile::initialize()
Foam::ensightFile::ensightFile
(
const fileName& pathname,
IOstreamOption::streamFormat format
IOstreamOption::streamFormat fmt
)
:
OFstream(ensight::FileName(pathname), format)
OFstream(ensight::FileName(pathname), fmt)
{
initialize();
}
@ -132,10 +132,10 @@ Foam::ensightFile::ensightFile
(
const fileName& path,
const fileName& name,
IOstreamOption::streamFormat format
IOstreamOption::streamFormat fmt
)
:
OFstream(path/ensight::FileName(name), format)
OFstream(path/ensight::FileName(name), fmt)
{
initialize();
}

View File

@ -105,7 +105,7 @@ public:
explicit ensightFile
(
const fileName& pathname,
IOstreamOption::streamFormat format = IOstreamOption::BINARY
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
);
//- Construct from path and name.
@ -114,7 +114,7 @@ public:
(
const fileName& path,
const fileName& name,
IOstreamOption::streamFormat format = IOstreamOption::BINARY
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
);

View File

@ -56,10 +56,10 @@ void Foam::ensightGeoFile::initialize()
Foam::ensightGeoFile::ensightGeoFile
(
const fileName& pathname,
IOstreamOption::streamFormat format
IOstreamOption::streamFormat fmt
)
:
ensightFile(pathname, format)
ensightFile(pathname, fmt)
{
initialize();
}
@ -69,10 +69,10 @@ Foam::ensightGeoFile::ensightGeoFile
(
const fileName& path,
const fileName& name,
IOstreamOption::streamFormat format
IOstreamOption::streamFormat fmt
)
:
ensightFile(path, name, format)
ensightFile(path, name, fmt)
{
initialize();
}

View File

@ -80,7 +80,7 @@ public:
explicit ensightGeoFile
(
const fileName& pathname,
IOstreamOption::streamFormat format = IOstreamOption::BINARY
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
);
//- Construct from path and name.
@ -89,7 +89,7 @@ public:
(
const fileName& path,
const fileName& name,
IOstreamOption::streamFormat format = IOstreamOption::BINARY
IOstreamOption::streamFormat fmt = IOstreamOption::BINARY
);

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -87,7 +87,7 @@ Foam::fileName Foam::fileFormats::FIRECore::fireFileName
Foam::label Foam::fileFormats::FIRECore::getFireLabel(ISstream& is)
{
if (is.format() == IOstream::BINARY)
if (is.format() == IOstreamOption::BINARY)
{
fireInt_t ivalue;
@ -110,7 +110,7 @@ Foam::point Foam::fileFormats::FIRECore::getFirePoint(ISstream& is)
{
point pt;
if (is.format() == IOstream::BINARY)
if (is.format() == IOstreamOption::BINARY)
{
fireReal_t coord[3];
@ -139,7 +139,7 @@ std::string Foam::fileFormats::FIRECore::getFireString(ISstream& is)
{
std::string str;
if (is.format() == IOstream::BINARY)
if (is.format() == IOstreamOption::BINARY)
{
long len;
@ -204,7 +204,7 @@ void Foam::fileFormats::FIRECore::putFireLabel
const label value
)
{
if (os.format() == IOstream::BINARY)
if (os.format() == IOstreamOption::BINARY)
{
fireInt_t ivalue(value);
@ -227,7 +227,7 @@ void Foam::fileFormats::FIRECore::putFireLabels
const labelUList& lst
)
{
if (os.format() == IOstream::BINARY)
if (os.format() == IOstreamOption::BINARY)
{
fireInt_t ivalue(lst.size());
@ -267,7 +267,7 @@ void Foam::fileFormats::FIRECore::putFireLabels
const label start
)
{
if (os.format() == IOstream::BINARY)
if (os.format() == IOstreamOption::BINARY)
{
fireInt_t ivalue(count);
@ -307,7 +307,7 @@ void Foam::fileFormats::FIRECore::putFirePoint
const point& value
)
{
if (os.format() == IOstream::BINARY)
if (os.format() == IOstreamOption::BINARY)
{
fireReal_t fvalue[3];
fvalue[0] = value.x();
@ -336,7 +336,7 @@ void Foam::fileFormats::FIRECore::putFireString
const std::string& value
)
{
if (os.format() == IOstream::BINARY)
if (os.format() == IOstreamOption::BINARY)
{
long len(value.size());

View File

@ -183,7 +183,7 @@ void Foam::glTF::scene::write(Ostream& os)
// Write binary file
// Note: using stdStream
OFstream bin(binFile, IOstream::BINARY);
OFstream bin(binFile, IOstreamOption::BINARY);
auto& osbin = bin.stdStream();
label totalBytes = 0;

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -92,7 +92,9 @@ int Foam::fileFormats::STLCore::detectBinaryHeader
// Handle compressed (.gz) or uncompressed input files
ifstreamPointer isPtr(filename);
const bool unCompressed(IOstream::UNCOMPRESSED == isPtr.whichCompression());
const bool unCompressed =
(IOstreamOption::UNCOMPRESSED == isPtr.whichCompression());
auto& is = *isPtr;
if (!is.good())
@ -158,7 +160,8 @@ Foam::fileFormats::STLCore::readBinaryHeader
// Handle compressed (.gz) or uncompressed input files
{
ifstreamPointer isPtr(filename);
unCompressed = (IOstream::UNCOMPRESSED == isPtr.whichCompression());
unCompressed =
(IOstreamOption::UNCOMPRESSED == isPtr.whichCompression());
// Take ownership
streamPtr.reset(isPtr.release());