Network/TcpClient: Make TcpClient a Stream

Former-commit-id: 2176748166ae84b609d5a336495e6ff3550a765d
This commit is contained in:
Lynix
2015-11-23 18:22:12 +01:00
parent 6829863d81
commit 4721bf80c3
6 changed files with 93 additions and 10 deletions

View File

@@ -31,7 +31,6 @@
namespace Nz
{
File::File() :
Stream(OpenMode_NotOpen),
m_impl(nullptr)
{
}
@@ -75,6 +74,8 @@ namespace Nz
m_impl->Close();
delete m_impl;
m_impl = nullptr;
m_openMode = OpenMode_NotOpen;
}
}
@@ -208,20 +209,18 @@ namespace Nz
if (m_filePath.IsEmpty())
return false;
if (openMode != 0)
m_openMode = openMode;
if (m_openMode == 0)
if (openMode == OpenMode_NotOpen)
return false;
std::unique_ptr<FileImpl> impl(new FileImpl(this));
if (!impl->Open(m_filePath, m_openMode))
if (!impl->Open(m_filePath, openMode))
{
ErrorFlags flags(ErrorFlag_Silent); // Silencieux par défaut
NazaraError("Failed to open \"" + m_filePath + "\": " + Error::GetLastSystemError());
return false;
}
m_openMode = openMode;
m_impl = impl.release();
if (m_openMode & OpenMode_Text)