mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-04 13:13:25 +03:00
0032352: Coding Rules - clean up code from compatibility hacks with pre-C++11 compilers
Removed usage of std::auto_ptr. opencascade::std workarounds for VS2008 have been dropped, when possible. OCCT_NO_RVALUE_REFERENCE workaround for VS2008 has been removed.
This commit is contained in:
@@ -39,7 +39,7 @@ Standard_Boolean OSD_CachedFileSystem::IsSupportedPath (const TCollection_AsciiS
|
||||
// function : IsOpenIStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean OSD_CachedFileSystem::IsOpenIStream (const opencascade::std::shared_ptr<std::istream>& theStream) const
|
||||
Standard_Boolean OSD_CachedFileSystem::IsOpenIStream (const std::shared_ptr<std::istream>& theStream) const
|
||||
{
|
||||
return myLinkedFS->IsOpenIStream (theStream);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ Standard_Boolean OSD_CachedFileSystem::IsOpenIStream (const opencascade::std::sh
|
||||
// function : IsOpenOStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean OSD_CachedFileSystem::IsOpenOStream (const opencascade::std::shared_ptr<std::ostream>& theStream) const
|
||||
Standard_Boolean OSD_CachedFileSystem::IsOpenOStream (const std::shared_ptr<std::ostream>& theStream) const
|
||||
{
|
||||
return myLinkedFS->IsOpenOStream (theStream);
|
||||
}
|
||||
@@ -57,10 +57,10 @@ Standard_Boolean OSD_CachedFileSystem::IsOpenOStream (const opencascade::std::sh
|
||||
// function : OpenIStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::istream> OSD_CachedFileSystem::OpenIStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theParams,
|
||||
const int64_t theOffset,
|
||||
const opencascade::std::shared_ptr<std::istream>& /*theOldStream*/)
|
||||
std::shared_ptr<std::istream> OSD_CachedFileSystem::OpenIStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theParams,
|
||||
const int64_t theOffset,
|
||||
const std::shared_ptr<std::istream>& /*theOldStream*/)
|
||||
{
|
||||
if (myStream.Url != theUrl)
|
||||
{
|
||||
@@ -75,8 +75,8 @@ opencascade::std::shared_ptr<std::istream> OSD_CachedFileSystem::OpenIStream (co
|
||||
// function : OpenOStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::ostream> OSD_CachedFileSystem::OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode)
|
||||
std::shared_ptr<std::ostream> OSD_CachedFileSystem::OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode)
|
||||
{
|
||||
return myLinkedFS->OpenOStream (theUrl, theMode);
|
||||
}
|
||||
@@ -85,10 +85,10 @@ opencascade::std::shared_ptr<std::ostream> OSD_CachedFileSystem::OpenOStream (co
|
||||
// function : OpenStreamBuffer
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::streambuf> OSD_CachedFileSystem::OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
int64_t* theOutBufSize)
|
||||
std::shared_ptr<std::streambuf> OSD_CachedFileSystem::OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
int64_t* theOutBufSize)
|
||||
{
|
||||
if ((theMode & std::ios::out) == std::ios::out)
|
||||
{
|
||||
|
@@ -38,24 +38,24 @@ public:
|
||||
Standard_EXPORT virtual Standard_Boolean IsSupportedPath (const TCollection_AsciiString& theUrl) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns TRUE if current input stream is opened for reading operations.
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenIStream (const opencascade::std::shared_ptr<std::istream>& theStream) const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenIStream (const std::shared_ptr<std::istream>& theStream) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns TRUE if current output stream is opened for writing operations.
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenOStream (const opencascade::std::shared_ptr<std::ostream>& theStream) const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenOStream (const std::shared_ptr<std::ostream>& theStream) const Standard_OVERRIDE;
|
||||
|
||||
//! Opens stream for specified file URL for reading operations or returns previously created stream pointing to the same URL.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::istream> OpenIStream
|
||||
Standard_EXPORT virtual std::shared_ptr<std::istream> OpenIStream
|
||||
(const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theParams,
|
||||
const int64_t theOffset,
|
||||
const opencascade::std::shared_ptr<std::istream>& theOldStream) Standard_OVERRIDE;
|
||||
const std::shared_ptr<std::istream>& theOldStream) Standard_OVERRIDE;
|
||||
|
||||
//! Opens stream for specified file URL for writing operations (std::ostream) by calling parent's method.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::ostream> OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual std::shared_ptr<std::ostream> OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Opens stream buffer for specified file URL.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::streambuf> OpenStreamBuffer
|
||||
Standard_EXPORT virtual std::shared_ptr<std::streambuf> OpenStreamBuffer
|
||||
(const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset = 0,
|
||||
@@ -66,9 +66,9 @@ protected:
|
||||
// Auxiliary structure to save shared stream with path to it.
|
||||
struct OSD_CachedStream
|
||||
{
|
||||
TCollection_AsciiString Url;
|
||||
opencascade::std::shared_ptr<std::istream> Stream;
|
||||
opencascade::std::shared_ptr<std::streambuf> StreamBuf;
|
||||
TCollection_AsciiString Url;
|
||||
std::shared_ptr<std::istream> Stream;
|
||||
std::shared_ptr<std::streambuf> StreamBuf;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
|
@@ -78,15 +78,15 @@ void OSD_FileSystem::RemoveDefaultProtocol (const Handle(OSD_FileSystem)& theFil
|
||||
// function : openIStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::istream> OSD_FileSystem::OpenIStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
const opencascade::std::shared_ptr<std::istream>& theOldStream)
|
||||
std::shared_ptr<std::istream> OSD_FileSystem::OpenIStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
const std::shared_ptr<std::istream>& theOldStream)
|
||||
{
|
||||
Standard_ASSERT_RAISE (theOffset >= -1, "Incorrect negative stream position during stream opening");
|
||||
|
||||
opencascade::std::shared_ptr<std::istream> aNewStream;
|
||||
opencascade::std::shared_ptr<OSD_IStreamBuffer> anOldStream = opencascade::std::dynamic_pointer_cast<OSD_IStreamBuffer> (theOldStream);
|
||||
std::shared_ptr<std::istream> aNewStream;
|
||||
std::shared_ptr<OSD_IStreamBuffer> anOldStream = std::dynamic_pointer_cast<OSD_IStreamBuffer> (theOldStream);
|
||||
if (anOldStream.get() != NULL
|
||||
&& theUrl.IsEqual (anOldStream->Url().c_str())
|
||||
&& IsOpenIStream (anOldStream))
|
||||
@@ -104,10 +104,10 @@ opencascade::std::shared_ptr<std::istream> OSD_FileSystem::OpenIStream (const TC
|
||||
}
|
||||
if (aNewStream.get() == NULL)
|
||||
{
|
||||
opencascade::std::shared_ptr<std::streambuf> aFileBuf = OpenStreamBuffer (theUrl, theMode | std::ios_base::in);
|
||||
std::shared_ptr<std::streambuf> aFileBuf = OpenStreamBuffer (theUrl, theMode | std::ios_base::in);
|
||||
if (aFileBuf.get() == NULL)
|
||||
{
|
||||
return opencascade::std::shared_ptr<std::istream>();
|
||||
return std::shared_ptr<std::istream>();
|
||||
}
|
||||
|
||||
aNewStream.reset (new OSD_IStreamBuffer (theUrl.ToCString(), aFileBuf));
|
||||
@@ -123,14 +123,14 @@ opencascade::std::shared_ptr<std::istream> OSD_FileSystem::OpenIStream (const TC
|
||||
// function : OpenOStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::ostream> OSD_FileSystem::OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode)
|
||||
std::shared_ptr<std::ostream> OSD_FileSystem::OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode)
|
||||
{
|
||||
opencascade::std::shared_ptr<std::ostream> aNewStream;
|
||||
opencascade::std::shared_ptr<std::streambuf> aFileBuf = OpenStreamBuffer (theUrl, theMode | std::ios_base::out);
|
||||
std::shared_ptr<std::ostream> aNewStream;
|
||||
std::shared_ptr<std::streambuf> aFileBuf = OpenStreamBuffer (theUrl, theMode | std::ios_base::out);
|
||||
if (aFileBuf.get() == NULL)
|
||||
{
|
||||
return opencascade::std::shared_ptr<std::ostream>();
|
||||
return std::shared_ptr<std::ostream>();
|
||||
}
|
||||
|
||||
aNewStream.reset(new OSD_OStreamBuffer (theUrl.ToCString(), aFileBuf));
|
||||
|
@@ -42,10 +42,10 @@ public:
|
||||
virtual Standard_Boolean IsSupportedPath (const TCollection_AsciiString& theUrl) const = 0;
|
||||
|
||||
//! Returns TRUE if current input stream is opened for reading operations.
|
||||
virtual Standard_Boolean IsOpenIStream (const opencascade::std::shared_ptr<std::istream>& theStream) const = 0;
|
||||
virtual Standard_Boolean IsOpenIStream (const std::shared_ptr<std::istream>& theStream) const = 0;
|
||||
|
||||
//! Returns TRUE if current output stream is opened for writing operations.
|
||||
virtual Standard_Boolean IsOpenOStream(const opencascade::std::shared_ptr<std::ostream>& theStream) const = 0;
|
||||
virtual Standard_Boolean IsOpenOStream(const std::shared_ptr<std::ostream>& theStream) const = 0;
|
||||
|
||||
//! Opens stream for specified file URL for reading operations (std::istream).
|
||||
//! Default implementation create a stream from file buffer returned by OSD_FileSystem::OpenFileBuffer().
|
||||
@@ -55,19 +55,19 @@ public:
|
||||
//! -1 would keep seek position undefined (in case of re-using theOldStream)
|
||||
//! @param theOldStream [in] a pointer to existing stream pointing to theUrl to be reused (without re-opening)
|
||||
//! @return pointer to newly created opened stream, to theOldStream if it can be reused or NULL in case of failure.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::istream> OpenIStream
|
||||
Standard_EXPORT virtual std::shared_ptr<std::istream> OpenIStream
|
||||
(const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset = 0,
|
||||
const opencascade::std::shared_ptr<std::istream>& theOldStream = opencascade::std::shared_ptr<std::istream>());
|
||||
const std::shared_ptr<std::istream>& theOldStream = std::shared_ptr<std::istream>());
|
||||
|
||||
//! Opens stream for specified file URL for writing operations (std::ostream).
|
||||
//! Default implementation create a stream from file buffer returned by OSD_FileSystem::OpenFileBuffer().
|
||||
//! @param theUrl [in] path to open
|
||||
//! @param theMode [in] flags describing the requested output mode for the stream (std::ios_base::out will be implicitly added)
|
||||
//! @return pointer to newly created opened stream or NULL in case of failure.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::ostream> OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode);
|
||||
Standard_EXPORT virtual std::shared_ptr<std::ostream> OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode);
|
||||
|
||||
//! Opens stream buffer for specified file URL.
|
||||
//! @param theUrl [in] path to open
|
||||
@@ -75,10 +75,10 @@ public:
|
||||
//! @param theOffset [in] expected stream position from the beginning of the buffer (beginning of the stream buffer by default)
|
||||
//! @param theOutBufSize [out] total buffer size (only if buffer is opened for read)
|
||||
//! @return pointer to newly created opened stream buffer or NULL in case of failure.
|
||||
virtual opencascade::std::shared_ptr<std::streambuf> OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset = 0,
|
||||
int64_t* theOutBufSize = NULL) = 0;
|
||||
virtual std::shared_ptr<std::streambuf> OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset = 0,
|
||||
int64_t* theOutBufSize = NULL) = 0;
|
||||
|
||||
//! Constructor.
|
||||
Standard_EXPORT OSD_FileSystem();
|
||||
|
@@ -61,9 +61,9 @@ Standard_Boolean OSD_FileSystemSelector::IsSupportedPath (const TCollection_Asci
|
||||
// function : IsOpenIStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean OSD_FileSystemSelector::IsOpenIStream (const opencascade::std::shared_ptr<std::istream>& theStream) const
|
||||
Standard_Boolean OSD_FileSystemSelector::IsOpenIStream (const std::shared_ptr<std::istream>& theStream) const
|
||||
{
|
||||
opencascade::std::shared_ptr<OSD_IStreamBuffer> aFileStream = opencascade::std::dynamic_pointer_cast<OSD_IStreamBuffer> (theStream);
|
||||
std::shared_ptr<OSD_IStreamBuffer> aFileStream = std::dynamic_pointer_cast<OSD_IStreamBuffer> (theStream);
|
||||
if (aFileStream.get() == NULL)
|
||||
{
|
||||
return false;
|
||||
@@ -86,9 +86,9 @@ Standard_Boolean OSD_FileSystemSelector::IsOpenIStream (const opencascade::std::
|
||||
// function : IsOpenOStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean OSD_FileSystemSelector::IsOpenOStream (const opencascade::std::shared_ptr<std::ostream>& theStream) const
|
||||
Standard_Boolean OSD_FileSystemSelector::IsOpenOStream (const std::shared_ptr<std::ostream>& theStream) const
|
||||
{
|
||||
opencascade::std::shared_ptr<OSD_OStreamBuffer> aFileStream = opencascade::std::dynamic_pointer_cast<OSD_OStreamBuffer> (theStream);
|
||||
std::shared_ptr<OSD_OStreamBuffer> aFileStream = std::dynamic_pointer_cast<OSD_OStreamBuffer> (theStream);
|
||||
if (aFileStream.get() == NULL)
|
||||
{
|
||||
return false;
|
||||
@@ -111,68 +111,68 @@ Standard_Boolean OSD_FileSystemSelector::IsOpenOStream (const opencascade::std::
|
||||
// function : OpenIStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::istream> OSD_FileSystemSelector::OpenIStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
const opencascade::std::shared_ptr<std::istream>& theOldStream)
|
||||
std::shared_ptr<std::istream> OSD_FileSystemSelector::OpenIStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
const std::shared_ptr<std::istream>& theOldStream)
|
||||
{
|
||||
for (NCollection_List<Handle(OSD_FileSystem)>::Iterator aProtIter (myProtocols); aProtIter.More(); aProtIter.Next())
|
||||
{
|
||||
const Handle(OSD_FileSystem)& aFileSystem = aProtIter.Value();
|
||||
if (aFileSystem->IsSupportedPath (theUrl))
|
||||
{
|
||||
opencascade::std::shared_ptr<std::istream> aStream = aFileSystem->OpenIStream (theUrl, theMode, theOffset, theOldStream);
|
||||
std::shared_ptr<std::istream> aStream = aFileSystem->OpenIStream (theUrl, theMode, theOffset, theOldStream);
|
||||
if (aStream.get() != NULL)
|
||||
{
|
||||
return aStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
return opencascade::std::shared_ptr<std::istream>();
|
||||
return std::shared_ptr<std::istream>();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OpenOStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::ostream> OSD_FileSystemSelector::OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode)
|
||||
std::shared_ptr<std::ostream> OSD_FileSystemSelector::OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode)
|
||||
{
|
||||
for (NCollection_List<Handle(OSD_FileSystem)>::Iterator aProtIter (myProtocols); aProtIter.More(); aProtIter.Next())
|
||||
{
|
||||
const Handle(OSD_FileSystem)& aFileSystem = aProtIter.Value();
|
||||
if (aFileSystem->IsSupportedPath (theUrl))
|
||||
{
|
||||
opencascade::std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theUrl, theMode);
|
||||
std::shared_ptr<std::ostream> aStream = aFileSystem->OpenOStream (theUrl, theMode);
|
||||
if (aStream.get() != NULL)
|
||||
{
|
||||
return aStream;
|
||||
}
|
||||
}
|
||||
}
|
||||
return opencascade::std::shared_ptr<std::ostream>();
|
||||
return std::shared_ptr<std::ostream>();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
// function : OpenStreamBuffer
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::streambuf> OSD_FileSystemSelector::OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
int64_t* theOutBufSize)
|
||||
std::shared_ptr<std::streambuf> OSD_FileSystemSelector::OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
int64_t* theOutBufSize)
|
||||
{
|
||||
for (NCollection_List<Handle(OSD_FileSystem)>::Iterator aProtIter (myProtocols); aProtIter.More(); aProtIter.Next())
|
||||
{
|
||||
const Handle(OSD_FileSystem)& aFileSystem = aProtIter.Value();
|
||||
if (aFileSystem->IsSupportedPath (theUrl))
|
||||
{
|
||||
opencascade::std::shared_ptr<std::streambuf> aBuf = aFileSystem->OpenStreamBuffer (theUrl, theMode, theOffset, theOutBufSize);
|
||||
std::shared_ptr<std::streambuf> aBuf = aFileSystem->OpenStreamBuffer (theUrl, theMode, theOffset, theOutBufSize);
|
||||
if (aBuf.get() != NULL)
|
||||
{
|
||||
return aBuf;
|
||||
}
|
||||
}
|
||||
}
|
||||
return opencascade::std::shared_ptr<std::streambuf>();
|
||||
return std::shared_ptr<std::streambuf>();
|
||||
}
|
||||
|
@@ -41,24 +41,24 @@ public:
|
||||
Standard_EXPORT virtual bool IsSupportedPath (const TCollection_AsciiString& theUrl) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns TRUE if current input stream is opened for reading operations.
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenIStream (const opencascade::std::shared_ptr<std::istream>& theStream) const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenIStream (const std::shared_ptr<std::istream>& theStream) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns TRUE if current output stream is opened for writing operations.
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenOStream (const opencascade::std::shared_ptr<std::ostream>& theStream) const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenOStream (const std::shared_ptr<std::ostream>& theStream) const Standard_OVERRIDE;
|
||||
|
||||
//! Opens input stream using one of registered protocols.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::istream> OpenIStream
|
||||
Standard_EXPORT virtual std::shared_ptr<std::istream> OpenIStream
|
||||
(const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset = 0,
|
||||
const opencascade::std::shared_ptr<std::istream>& theOldStream = opencascade::std::shared_ptr<std::istream>()) Standard_OVERRIDE;
|
||||
const std::shared_ptr<std::istream>& theOldStream = std::shared_ptr<std::istream>()) Standard_OVERRIDE;
|
||||
|
||||
//! Opens output stream using one of registered protocols.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::ostream> OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode) Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual std::shared_ptr<std::ostream> OpenOStream (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode) Standard_OVERRIDE;
|
||||
|
||||
//! Opens stream buffer using one of registered protocols.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::streambuf> OpenStreamBuffer
|
||||
Standard_EXPORT virtual std::shared_ptr<std::streambuf> OpenStreamBuffer
|
||||
(const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset = 0,
|
||||
|
@@ -31,9 +31,9 @@ Standard_Boolean OSD_LocalFileSystem::IsSupportedPath (const TCollection_AsciiSt
|
||||
// function : IsOpenIStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean OSD_LocalFileSystem::IsOpenIStream (const opencascade::std::shared_ptr<std::istream>& theStream) const
|
||||
Standard_Boolean OSD_LocalFileSystem::IsOpenIStream (const std::shared_ptr<std::istream>& theStream) const
|
||||
{
|
||||
opencascade::std::shared_ptr<OSD_IStreamBuffer> aFileStream = opencascade::std::dynamic_pointer_cast<OSD_IStreamBuffer> (theStream);
|
||||
std::shared_ptr<OSD_IStreamBuffer> aFileStream = std::dynamic_pointer_cast<OSD_IStreamBuffer> (theStream);
|
||||
if (aFileStream.get() == NULL)
|
||||
{
|
||||
return false;
|
||||
@@ -46,9 +46,9 @@ Standard_Boolean OSD_LocalFileSystem::IsOpenIStream (const opencascade::std::sha
|
||||
// function : IsOpenOStream
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
Standard_Boolean OSD_LocalFileSystem::IsOpenOStream (const opencascade::std::shared_ptr<std::ostream>& theStream) const
|
||||
Standard_Boolean OSD_LocalFileSystem::IsOpenOStream (const std::shared_ptr<std::ostream>& theStream) const
|
||||
{
|
||||
opencascade::std::shared_ptr<OSD_OStreamBuffer> aFileStream = opencascade::std::dynamic_pointer_cast<OSD_OStreamBuffer> (theStream);
|
||||
std::shared_ptr<OSD_OStreamBuffer> aFileStream = std::dynamic_pointer_cast<OSD_OStreamBuffer> (theStream);
|
||||
if (aFileStream.get() == NULL)
|
||||
{
|
||||
return false;
|
||||
@@ -61,16 +61,16 @@ Standard_Boolean OSD_LocalFileSystem::IsOpenOStream (const opencascade::std::sha
|
||||
// function : OpenStreamBuffer
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
opencascade::std::shared_ptr<std::streambuf> OSD_LocalFileSystem::OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
int64_t* theOutBufSize)
|
||||
std::shared_ptr<std::streambuf> OSD_LocalFileSystem::OpenStreamBuffer (const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset,
|
||||
int64_t* theOutBufSize)
|
||||
{
|
||||
Standard_ASSERT_RAISE (theOffset >= 0, "Incorrect negative stream position during stream buffer opening");
|
||||
opencascade::std::shared_ptr<std::filebuf> aNewBuf(new std::filebuf());
|
||||
std::shared_ptr<std::filebuf> aNewBuf(new std::filebuf());
|
||||
if (!OSD_OpenStream (*aNewBuf, TCollection_ExtendedString(theUrl), theMode))
|
||||
{
|
||||
return opencascade::std::shared_ptr<std::streambuf>();
|
||||
return std::shared_ptr<std::streambuf>();
|
||||
}
|
||||
// if buffer is opened for read, find the file size
|
||||
if (theOutBufSize && ((theMode & std::ios::in) != 0))
|
||||
@@ -79,13 +79,13 @@ opencascade::std::shared_ptr<std::streambuf> OSD_LocalFileSystem::OpenStreamBuff
|
||||
if (aNewBuf->pubseekoff ((std::streamoff )theOffset, std::ios_base::beg, std::ios_base::in) < 0)
|
||||
{
|
||||
*theOutBufSize = 0;
|
||||
return opencascade::std::shared_ptr<std::streambuf>();
|
||||
return std::shared_ptr<std::streambuf>();
|
||||
}
|
||||
}
|
||||
else if (theOffset > 0 && aNewBuf->pubseekoff ((std::streamoff )theOffset, std::ios_base::beg,
|
||||
(theMode & std::ios::in) != 0 ? std::ios_base::in : std::ios_base::out) < 0)
|
||||
{
|
||||
return opencascade::std::shared_ptr<std::streambuf>();
|
||||
return std::shared_ptr<std::streambuf>();
|
||||
}
|
||||
return aNewBuf;
|
||||
}
|
||||
|
@@ -29,13 +29,13 @@ public:
|
||||
Standard_EXPORT virtual Standard_Boolean IsSupportedPath (const TCollection_AsciiString& theUrl) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns TRUE if current input stream is opened for reading operations.
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenIStream (const opencascade::std::shared_ptr<std::istream>& theStream) const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenIStream (const std::shared_ptr<std::istream>& theStream) const Standard_OVERRIDE;
|
||||
|
||||
//! Returns TRUE if current output stream is opened for writing operations.
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenOStream (const opencascade::std::shared_ptr<std::ostream>& theStream) const Standard_OVERRIDE;
|
||||
Standard_EXPORT virtual Standard_Boolean IsOpenOStream (const std::shared_ptr<std::ostream>& theStream) const Standard_OVERRIDE;
|
||||
|
||||
//! Opens stream buffer for specified file URL.
|
||||
Standard_EXPORT virtual opencascade::std::shared_ptr<std::streambuf> OpenStreamBuffer
|
||||
Standard_EXPORT virtual std::shared_ptr<std::streambuf> OpenStreamBuffer
|
||||
(const TCollection_AsciiString& theUrl,
|
||||
const std::ios_base::openmode theMode,
|
||||
const int64_t theOffset = 0,
|
||||
|
@@ -179,11 +179,7 @@ protected:
|
||||
}
|
||||
|
||||
private:
|
||||
#if (defined(_MSC_VER) && (_MSC_VER < 1600))
|
||||
std::auto_ptr<IteratorInterface> myPtr;
|
||||
#else
|
||||
std::unique_ptr<IteratorInterface> myPtr;
|
||||
#endif
|
||||
};
|
||||
|
||||
//! Interface class representing functor object.
|
||||
|
@@ -29,7 +29,7 @@ public:
|
||||
|
||||
//! Main constructor.
|
||||
OSD_StreamBuffer (const std::string& theUrl,
|
||||
const opencascade::std::shared_ptr<std::streambuf>& theBuffer)
|
||||
const std::shared_ptr<std::streambuf>& theBuffer)
|
||||
: T (theBuffer.get()), myUrl (theUrl), myBuffer (theBuffer) {}
|
||||
|
||||
//! Return an opened URL.
|
||||
@@ -37,8 +37,8 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
std::string myUrl;
|
||||
opencascade::std::shared_ptr<std::streambuf> myBuffer;
|
||||
std::string myUrl;
|
||||
std::shared_ptr<std::streambuf> myBuffer;
|
||||
};
|
||||
|
||||
typedef OSD_StreamBuffer<std::istream> OSD_IStreamBuffer;
|
||||
|
Reference in New Issue
Block a user