From d65fd4e93f26ba45540ea15d16a3cbfdc78df23e Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Thu, 19 Oct 2006 12:30:59 +0000 Subject: [PATCH] Made wxStreamBase::IsOk() virtual; Overrride in file streams to test foe base class and for correctly opened files. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42114 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/strmbase.tex | 2 +- include/wx/stream.h | 2 +- include/wx/wfstream.h | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/latex/wx/strmbase.tex b/docs/latex/wx/strmbase.tex index dc7a184b51..adf12c7911 100644 --- a/docs/latex/wx/strmbase.tex +++ b/docs/latex/wx/strmbase.tex @@ -85,7 +85,7 @@ In that cases, GetSize returns $0$ so you should always test its return value. \membersection{wxStreamBase::IsOk}\label{wxstreambaseisok} -\constfunc{bool}{IsOk}{\void} +\constfunc{virtual bool}{IsOk}{\void} Returns true if no error occurred on the stream. diff --git a/include/wx/stream.h b/include/wx/stream.h index c26638a68b..652c40481f 100644 --- a/include/wx/stream.h +++ b/include/wx/stream.h @@ -58,7 +58,7 @@ public: // error testing wxStreamError GetLastError() const { return m_lasterror; } - bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; } + virtual bool IsOk() const { return GetLastError() == wxSTREAM_NO_ERROR; } bool operator!() const { return !IsOk(); } // reset the stream state diff --git a/include/wx/wfstream.h b/include/wx/wfstream.h index 79feb44fe4..63c90a0961 100644 --- a/include/wx/wfstream.h +++ b/include/wx/wfstream.h @@ -39,7 +39,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return IsOk(); } - bool IsOk() const { return m_file->IsOpened(); } + virtual bool IsOk() const { return (wxStreamBase::IsOk() && m_file->IsOpened()); } bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: @@ -69,7 +69,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return IsOk(); } - bool IsOk() const { return m_file->IsOpened(); } + virtual bool IsOk() const { return (wxStreamBase::IsOk() && m_file->IsOpened()); } bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: @@ -140,7 +140,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return IsOk(); } - bool IsOk() const { return m_file->IsOpened(); } + virtual bool IsOk() const { return (wxStreamBase::IsOk() && m_file->IsOpened()); } bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: @@ -170,7 +170,7 @@ public: wxFileOffset GetLength() const; bool Ok() const { return IsOk(); } - bool IsOk() const { return m_file->IsOpened(); } + virtual bool IsOk() const { return (wxStreamBase::IsOk() && m_file->IsOpened()); } bool IsSeekable() const { return m_file->GetKind() == wxFILE_KIND_DISK; } protected: -- 2.45.2