Backport writeCompression from vanilla 3.0.1

This commit is contained in:
Henrik Rusche 2016-04-14 17:35:02 +02:00
parent cd8b1c6487
commit 02b093974b

View file

@ -27,6 +27,7 @@ Description
#include "IOstream.H" #include "IOstream.H"
#include "error.H" #include "error.H"
#include "Switch.H"
#include <sstream> #include <sstream>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -61,7 +62,14 @@ Foam::IOstream::formatEnum(const word& format)
Foam::IOstream::compressionType Foam::IOstream::compressionType
Foam::IOstream::compressionEnum(const word& compression) Foam::IOstream::compressionEnum(const word& compression)
{ {
if (compression == "uncompressed") // get Switch (bool) value, but allow it to fail
Switch sw(compression, true);
if (sw.valid())
{
return sw ? IOstream::COMPRESSED : IOstream::UNCOMPRESSED;
}
else if (compression == "uncompressed")
{ {
return IOstream::UNCOMPRESSED; return IOstream::UNCOMPRESSED;
} }