diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C index f1c97306ed..9bada0e9a9 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.C @@ -37,7 +37,7 @@ namespace Foam // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname) +Foam::Detail::IFstreamAllocator::IFstreamAllocator(const fileName& pathname) : allocatedPtr_(nullptr), compression_(IOstream::UNCOMPRESSED) @@ -61,7 +61,6 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname) } delete allocatedPtr_; - allocatedPtr_ = new igzstream((pathname + ".gz").c_str()); if (allocatedPtr_->good()) @@ -74,7 +73,7 @@ Foam::IFstreamAllocator::IFstreamAllocator(const fileName& pathname) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::IFstreamAllocator::~IFstreamAllocator() +Foam::Detail::IFstreamAllocator::~IFstreamAllocator() { deallocate(); } @@ -82,7 +81,7 @@ Foam::IFstreamAllocator::~IFstreamAllocator() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::IFstreamAllocator::deallocate() +void Foam::Detail::IFstreamAllocator::deallocate() { if (allocatedPtr_) { @@ -101,7 +100,7 @@ Foam::IFstream::IFstream versionNumber version ) : - IFstreamAllocator(pathname), + Detail::IFstreamAllocator(pathname), ISstream ( *allocatedPtr_, @@ -135,12 +134,6 @@ Foam::IFstream::IFstream } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::IFstream::~IFstream() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // std::istream& Foam::IFstream::stdStream() diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H index 34f7c7c948..d3a60388e2 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H +++ b/src/OpenFOAM/db/IOstreams/Fstreams/IFstream.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,7 +25,7 @@ Class Foam::IFstream Description - Input from file stream, using a ISstream + Input from file stream, using an ISstream SourceFiles IFstream.C @@ -47,8 +47,11 @@ using std::ifstream; namespace Foam { +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class IFstreamAllocator Declaration + Class Detail::IFstreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- A std::istream with the ability to handle compressed files @@ -82,6 +85,8 @@ protected: }; +} // end namespace Detail + /*---------------------------------------------------------------------------*\ Class IFstream Declaration @@ -89,7 +94,7 @@ protected: class IFstream : - public IFstreamAllocator, + public Detail::IFstreamAllocator, public ISstream { public: @@ -110,18 +115,18 @@ public: //- Destructor - ~IFstream(); + ~IFstream() = default; // Member Functions - // Access + // Access //- Read/write access to the name of the stream using ISstream::name; - // STL stream + // STL stream //- Access to underlying std::istream virtual std::istream& stdStream(); @@ -133,17 +138,17 @@ public: virtual void rewind(); - // Print + // Print //- Print description of IOstream to Ostream virtual void print(Ostream& os) const; - // Member operators + // Member Operators //- Return a non-const reference to const IFstream // Needed for read-constructors where the stream argument is temporary: - // e.g. thing thisThing(IFstream("thingFileName")()); + // e.g. thing thisThing(IFstream("fileName")()); IFstream& operator()() const; }; diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C index 8c005c4a31..5061fe83fc 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C +++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,10 +34,9 @@ namespace Foam defineTypeNameAndDebug(OFstream, 0); } - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::OFstreamAllocator::OFstreamAllocator +Foam::Detail::OFstreamAllocator::OFstreamAllocator ( const fileName& pathname, IOstream::compressionType compression, @@ -100,13 +99,13 @@ Foam::OFstreamAllocator::OFstreamAllocator } -Foam::OFstreamAllocator::~OFstreamAllocator() +Foam::Detail::OFstreamAllocator::~OFstreamAllocator() { deallocate(); } -void Foam::OFstreamAllocator::deallocate() +void Foam::Detail::OFstreamAllocator::deallocate() { if (allocatedPtr_) { @@ -127,7 +126,7 @@ Foam::OFstream::OFstream const bool append ) : - OFstreamAllocator(pathname, compression, append), + Detail::OFstreamAllocator(pathname, compression, append), OSstream ( *allocatedPtr_, @@ -160,12 +159,6 @@ Foam::OFstream::OFstream } -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::OFstream::~OFstream() -{} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // std::ostream& Foam::OFstream::stdStream() diff --git a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H index 732fd69010..adb4bf77e2 100644 --- a/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H +++ b/src/OpenFOAM/db/IOstreams/Fstreams/OFstream.H @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation - \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. + \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -25,7 +25,7 @@ Class Foam::OFstream Description - Output to file stream, using a OSstream + Output to file stream, using an OSstream SourceFiles OFstream.C @@ -47,8 +47,11 @@ using std::ofstream; namespace Foam { +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class OFstreamAllocator Declaration + Class Detail::OFstreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- A std::ostream with the ability to handle compressed files @@ -84,6 +87,8 @@ protected: }; +} // end namespace Detail + /*---------------------------------------------------------------------------*\ Class OFstream Declaration @@ -91,7 +96,7 @@ protected: class OFstream : - public OFstreamAllocator, + public Detail::OFstreamAllocator, public OSstream { public: @@ -114,18 +119,18 @@ public: //- Destructor - ~OFstream(); + ~OFstream() = default; // Member functions - // Access + // Access //- Read/write access to the name of the stream using OSstream::name; - // STL stream + // STL stream //- Access to underlying std::ostream virtual std::ostream& stdStream(); @@ -134,7 +139,7 @@ public: virtual const std::ostream& stdStream() const; - // Print + // Print //- Print description of IOstream to Ostream void print(Ostream& os) const; diff --git a/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.H b/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.H index 83f75c642a..08ae90e8e7 100644 --- a/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.H +++ b/src/OpenFOAM/db/IOstreams/StringStreams/StringStream.H @@ -44,8 +44,11 @@ SourceFiles namespace Foam { +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class StringStreamAllocator Declaration + Class Detail::StringStreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- Allocator for variants of a std stringstream @@ -96,6 +99,8 @@ public: } }; +} // end of namespace Detail + /*---------------------------------------------------------------------------*\ Class IStringStream Declaration @@ -104,10 +109,10 @@ public: //- Input from string buffer, using a ISstream class IStringStream : - public StringStreamAllocator, + public Detail::StringStreamAllocator, public ISstream { - typedef StringStreamAllocator allocator_type; + typedef Detail::StringStreamAllocator allocator_type; public: @@ -181,10 +186,10 @@ public: //- Output to string buffer, using a OSstream class OStringStream : - public StringStreamAllocator, + public Detail::StringStreamAllocator, public OSstream { - typedef StringStreamAllocator allocator_type; + typedef Detail::StringStreamAllocator allocator_type; public: diff --git a/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H b/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H index 6b9688b73a..50899066b3 100644 --- a/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H +++ b/src/OpenFOAM/db/IOstreams/hashes/OSHA1stream.H @@ -27,9 +27,6 @@ Class Description An output stream for calculating SHA1 digests. -SourceFiles - OSHA1stream.C - \*---------------------------------------------------------------------------*/ #ifndef OSHA1stream_H @@ -43,9 +40,6 @@ SourceFiles namespace Foam { -class osha1stream; -class OSHA1stream; - /*---------------------------------------------------------------------------*\ Class osha1stream Declaration \*---------------------------------------------------------------------------*/ @@ -65,36 +59,30 @@ class osha1stream SHA1 sha1_; protected: - // Protected members - - //- Put sequence of characters - virtual std::streamsize xsputn(const char* str, std::streamsize n) - { - sha1_.append(str, n); - return n; - } + //- Put sequence of characters + virtual std::streamsize xsputn(const char* s, std::streamsize n) + { + sha1_.append(s, n); + return n; + } public: - // Constructors - - //- Construct null - sha1buf() - {} + //- Construct null + sha1buf() + {} - // Public member functions - - //- Full access to the sha1 - inline SHA1& sha1() - { - return sha1_; - } + //- Full access to the sha1 + inline SHA1& sha1() + { + return sha1_; + } }; - // Private data + // Private Data //- Reference to the underlying buffer sha1buf buf_; @@ -127,8 +115,11 @@ public: }; +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class OSHA1streamAllocator Declaration + Class Detail::OSHA1streamAllocator Declaration \*---------------------------------------------------------------------------*/ //- Allocator for an osha1stream @@ -136,7 +127,7 @@ class OSHA1streamAllocator { protected: - // Protected data + // Protected Data typedef osha1stream stream_type; @@ -179,6 +170,8 @@ public: }; +} // end of namespace Detail + /*---------------------------------------------------------------------------*\ Class OSHA1stream Declaration @@ -187,17 +180,17 @@ public: //- The output stream for calculating SHA1 digests class OSHA1stream : - public OSHA1streamAllocator, + public Detail::OSHA1streamAllocator, public OSstream { - typedef OSHA1streamAllocator allocator_type; + typedef Detail::OSHA1streamAllocator allocator_type; // Private Member Functions - //- Disallow default bitwise copy construct + //- No copy construct OSHA1stream(const OSHA1stream&) = delete; - //- Disallow default bitwise assignment + //- No copy assignment void operator=(const OSHA1stream&) = delete; public: diff --git a/src/OpenFOAM/db/IOstreams/hashes/base64Layer.C b/src/OpenFOAM/db/IOstreams/hashes/base64Layer.C index 5e055c1ca1..88237abb2a 100644 --- a/src/OpenFOAM/db/IOstreams/hashes/base64Layer.C +++ b/src/OpenFOAM/db/IOstreams/hashes/base64Layer.C @@ -110,6 +110,7 @@ Foam::base64Layer::base64Layer(std::ostream& os) // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + Foam::base64Layer::~base64Layer() { close(); diff --git a/src/OpenFOAM/db/IOstreams/memory/IListStream.H b/src/OpenFOAM/db/IOstreams/memory/IListStream.H index c6a28558f1..c6c5300cc4 100644 --- a/src/OpenFOAM/db/IOstreams/memory/IListStream.H +++ b/src/OpenFOAM/db/IOstreams/memory/IListStream.H @@ -47,8 +47,11 @@ See Also namespace Foam { +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class IListStreamAllocator Declaration + Class Detail::IListStreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- An stream/stream-buffer input allocator with List storage @@ -118,6 +121,8 @@ public: } }; +} // end namespace Detail + /*---------------------------------------------------------------------------*\ Class IListStream Declaration @@ -126,10 +131,10 @@ public: //- An ISstream with internal List storage class IListStream : - public IListStreamAllocator, + public Detail::IListStreamAllocator, public ISstream { - typedef IListStreamAllocator allocator_type; + typedef Detail::IListStreamAllocator allocator_type; public: diff --git a/src/OpenFOAM/db/IOstreams/memory/OCountStream.H b/src/OpenFOAM/db/IOstreams/memory/OCountStream.H index bd171b6ec3..a7f0aae83f 100644 --- a/src/OpenFOAM/db/IOstreams/memory/OCountStream.H +++ b/src/OpenFOAM/db/IOstreams/memory/OCountStream.H @@ -134,8 +134,11 @@ public: }; +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class OCountStreamAllocator Declaration + Class Detail::OCountStreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- An stream/stream-buffer allocator for counting @@ -189,6 +192,8 @@ public: } }; +} // end of namespace Detail + /*---------------------------------------------------------------------------*\ Class OCountStream Declaration @@ -197,10 +202,10 @@ public: //- An output stream for calculating byte counts class OCountStream : - public OCountStreamAllocator, + public Detail::OCountStreamAllocator, public OSstream { - typedef OCountStreamAllocator allocator_type; + typedef Detail::OCountStreamAllocator allocator_type; public: @@ -225,7 +230,7 @@ public: {} - // Member functions + // Member Functions //- Rewind the stream, reset the count, clearing any old errors virtual void rewind() diff --git a/src/OpenFOAM/db/IOstreams/memory/OListStream.H b/src/OpenFOAM/db/IOstreams/memory/OListStream.H index c7d35f1aa4..249413ff5c 100644 --- a/src/OpenFOAM/db/IOstreams/memory/OListStream.H +++ b/src/OpenFOAM/db/IOstreams/memory/OListStream.H @@ -53,8 +53,11 @@ See Also namespace Foam { +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class OListStreamAllocator Declaration + Class Detail::OListStreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- An stream/stream-buffer output allocator with DynamicList-like storage @@ -358,6 +361,8 @@ public: } }; +} // end of namespace Detail + /*---------------------------------------------------------------------------*\ Class OListStream Declaration @@ -366,10 +371,10 @@ public: //- An OSstream attached to a List class OListStream : - public OListStreamAllocator, + public Detail::OListStreamAllocator, public OSstream { - typedef OListStreamAllocator allocator_type; + typedef Detail::OListStreamAllocator allocator_type; public: diff --git a/src/OpenFOAM/db/IOstreams/memory/UIListStream.H b/src/OpenFOAM/db/IOstreams/memory/UIListStream.H index 2ddeeea500..4e6df766b7 100644 --- a/src/OpenFOAM/db/IOstreams/memory/UIListStream.H +++ b/src/OpenFOAM/db/IOstreams/memory/UIListStream.H @@ -109,8 +109,11 @@ public: }; +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class UIListStreamAllocator Declaration + Class Detail::UIListStreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- An stream/stream-buffer input allocator for a externally allocated list @@ -188,6 +191,8 @@ public: } }; +} // end of namespace Detail + /*---------------------------------------------------------------------------*\ Class UIListStream Declaration @@ -195,10 +200,10 @@ public: class UIListStream : - public UIListStreamAllocator, + public Detail::UIListStreamAllocator, public ISstream { - typedef UIListStreamAllocator allocator_type; + typedef Detail::UIListStreamAllocator allocator_type; public: @@ -260,7 +265,7 @@ public: {} - // Member functions + // Member Functions //- Return the current get position in the buffer std::streampos pos() const @@ -279,7 +284,7 @@ public: virtual void print(Ostream& os) const; - // Member operators + // Member Operators //- A non-const reference to const Istream // Needed for read-constructors where the stream argument is temporary diff --git a/src/OpenFOAM/db/IOstreams/memory/UOListStream.H b/src/OpenFOAM/db/IOstreams/memory/UOListStream.H index 45e3dda0ed..3e58c94fd3 100644 --- a/src/OpenFOAM/db/IOstreams/memory/UOListStream.H +++ b/src/OpenFOAM/db/IOstreams/memory/UOListStream.H @@ -90,8 +90,11 @@ See Also namespace Foam { +namespace Detail +{ + /*---------------------------------------------------------------------------*\ - Class UOListStreamAllocator Declaration + Class Detail::UOListStreamAllocator Declaration \*---------------------------------------------------------------------------*/ //- An stream/stream-buffer allocator for external buffers @@ -161,6 +164,8 @@ public: } }; +} // end of namespace Detail + /*---------------------------------------------------------------------------*\ Class UOListStream Declaration @@ -169,10 +174,10 @@ public: //- An OSstream attached to an unallocated external buffer class UOListStream : - public UOListStreamAllocator, + public Detail::UOListStreamAllocator, public OSstream { - typedef UOListStreamAllocator allocator_type; + typedef Detail::UOListStreamAllocator allocator_type; public: @@ -241,7 +246,7 @@ public: {} - // Member functions + // Member Functions //- Rewind the stream, clearing any old errors virtual void rewind()