mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make treatment of stream allocators more uniform (issue #532)
- use allocator class to wrap the stream pointers instead of passing them into ISstream, OSstream and using a dynamic cast to delete then. This is especially important if we will have a bidirectional stream (can't delete twice!). STYLE: - file stream constructors with std::string (C++11) - for rewind, explicit about in|out direction. This is not currently important, but avoids surprises with any future bidirectional access. - combined string streams in StringStream.H header. Similar to <sstream> include that has both input and output string streams.
This commit is contained in:
@ -24,7 +24,6 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ensightReadFile.H"
|
||||
#include <sstream>
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -24,7 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "NASCore.H"
|
||||
#include "IStringStream.H"
|
||||
#include "StringStream.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -27,7 +27,7 @@ License
|
||||
#include "ListOps.H"
|
||||
#include "clock.H"
|
||||
#include "PackedBoolList.H"
|
||||
#include "IStringStream.H"
|
||||
#include "StringStream.H"
|
||||
#include "OSspecific.H"
|
||||
|
||||
|
||||
|
||||
@ -89,9 +89,9 @@ int Foam::fileFormats::STLCore::detectBinaryHeader
|
||||
)
|
||||
{
|
||||
bool compressed = false;
|
||||
autoPtr<istream> streamPtr
|
||||
autoPtr<std::istream> streamPtr
|
||||
(
|
||||
new ifstream(filename.c_str(), std::ios::binary)
|
||||
new std::ifstream(filename, std::ios::binary)
|
||||
);
|
||||
|
||||
// If the file is compressed, decompress it before further checking.
|
||||
@ -100,7 +100,7 @@ int Foam::fileFormats::STLCore::detectBinaryHeader
|
||||
compressed = true;
|
||||
streamPtr.reset(new igzstream((filename + ".gz").c_str()));
|
||||
}
|
||||
istream& is = streamPtr();
|
||||
std::istream& is = streamPtr();
|
||||
|
||||
if (!is.good())
|
||||
{
|
||||
@ -165,9 +165,9 @@ Foam::fileFormats::STLCore::readBinaryHeader
|
||||
bool compressed = false;
|
||||
nTrisEstimated = 0;
|
||||
|
||||
autoPtr<istream> streamPtr
|
||||
autoPtr<std::istream> streamPtr
|
||||
(
|
||||
new ifstream(filename.c_str(), std::ios::binary)
|
||||
new std::ifstream(filename, std::ios::binary)
|
||||
);
|
||||
|
||||
// If the file is compressed, decompress it before reading.
|
||||
@ -176,7 +176,7 @@ Foam::fileFormats::STLCore::readBinaryHeader
|
||||
compressed = true;
|
||||
streamPtr.reset(new igzstream((filename + ".gz").c_str()));
|
||||
}
|
||||
istream& is = streamPtr();
|
||||
std::istream& is = streamPtr();
|
||||
|
||||
if (!is.good())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user