]> git.saurik.com Git - wxWidgets.git/commitdiff
stream classes docs and code fixes (part of patch 924438)
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 11 Apr 2004 20:58:56 +0000 (20:58 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 11 Apr 2004 20:58:56 +0000 (20:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/latex/wx/ffilestr.tex
docs/latex/wx/fileistr.tex
docs/latex/wx/fileostr.tex
docs/latex/wx/inputstr.tex
docs/latex/wx/outptstr.tex
src/common/wfstream.cpp

index d686281db847e45f078e3fa76b298db1e5fb1737..c413c1b332753f906202725be5c4865e787ce231 100644 (file)
@@ -15,6 +15,9 @@ reached. This is documented in \helpref{wxFile::Eof}{wxfileeof} and
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekI()}{wxinputstreamseeki} 
+can seek beyond the end of the stream (file) and will thus not return 
+{\it wxInvalidOffset} for that.
 
 \wxheading{Derived from}
 
 
 \wxheading{Derived from}
 
@@ -76,6 +79,9 @@ reached. This is documented in \helpref{wxFile::Eof}{wxfileeof} and
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekO()}{wxoutputstreamseeko} 
+can seek beyond the end of the stream (file) and will thus not return 
+{\it wxInvalidOffset} for that.
 
 \wxheading{Derived from}
 
 
 \wxheading{Derived from}
 
index 865320a1a6a90bbed31589a0d42454a114b6a7f5..5c629ea09a1890ac12b4c9f5277069f233737a6a 100644 (file)
@@ -12,6 +12,9 @@ reached. This is documented in \helpref{wxFile::Eof}{wxfileeof} and
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekI()}{wxinputstreamseeki} 
+can seek beyond the end of the stream (file) and will thus not return 
+{\it wxInvalidOffset} for that.
 
 \wxheading{Derived from}
 
 
 \wxheading{Derived from}
 
index c22c8b61141120ae4e32eaba68fe60d018ddda2f..294a83d1a1423874ed8ed4904ea91d11d703bae6 100644 (file)
@@ -15,6 +15,9 @@ reached. This is documented in \helpref{wxFile::Eof}{wxfileeof} and
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
 classes reflects this difference, i.e. wxFileInputStream will report
 wxSTREAM\_EOF after having read the last byte whereas wxFFileInputStream
 will report wxSTREAM\_EOF after trying to read {\it past} the last byte.
+Related to EOF behavior, note that \helpref{SeekO()}{wxoutputstreamseeko} 
+can seek beyond the end of the stream (file) and will thus not return 
+{\it wxInvalidOffset} for that.
 
 \wxheading{Derived from}
 
 
 \wxheading{Derived from}
 
index daf42acc31ca724ccd4088f6af8441414bb03231..05f45a1884434f9f6b47000bf30e35a87f0a28d0 100644 (file)
@@ -34,7 +34,12 @@ Destructor.
 
 \func{char}{GetC}{\void}
 
 
 \func{char}{GetC}{\void}
 
-Returns the first character in the input queue and removes it.
+Returns the first character in the input queue and removes it, 
+blocking until it appears if necessary.
+
+\wxheading{Note}
+
+If EOF, return value is undefined and LastRead() will return 0 and not 1.
 
 \membersection{wxInputStream::Eof}\label{wxinputstreameof}
 
 
 \membersection{wxInputStream::Eof}\label{wxinputstreameof}
 
@@ -42,6 +47,11 @@ Returns the first character in the input queue and removes it.
 
 Returns true if the end of stream has been reached.
 
 
 Returns true if the end of stream has been reached.
 
+\wxheading{Note}
+
+This cannot be really implemented for all streams and CanRead() is more 
+reliable than Eof().
+
 \membersection{wxInputStream::LastRead}\label{wxinputstreamlastread}
 
 \constfunc{size\_t}{LastRead}{\void}
 \membersection{wxInputStream::LastRead}\label{wxinputstreamlastread}
 
 \constfunc{size\_t}{LastRead}{\void}
@@ -54,6 +64,12 @@ Returns the last number of bytes read.
 
 Returns the first character in the input queue without removing it.
 
 
 Returns the first character in the input queue without removing it.
 
+\wxheading{Note}
+
+Blocks until something appears in the stream if necessary, if nothing
+ever does (i.e. EOF) LastRead() will return 0 (and the return value is
+undefined), otherwise LastRead() returns 1.
+
 \membersection{wxInputStream::Read}
 
 \func{wxInputStream\&}{Read}{\param{void *}{buffer}, \param{size\_t}{ size}}
 \membersection{wxInputStream::Read}
 
 \func{wxInputStream\&}{Read}{\param{void *}{buffer}, \param{size\_t}{ size}}
@@ -85,6 +101,16 @@ any states of the stream right away.
 
 Changes the stream current position.
 
 
 Changes the stream current position.
 
+\wxheading{Parameters}
+
+\docparam{pos}{Offset to seek to.}
+
+\docparam{mode}{One of {\bf wxFromStart}, {\bf wxFromEnd}, {\bf wxFromCurrent}.}
+
+\wxheading{Return value}
+
+The new stream position or wxInvalidOffset on error.
+
 \membersection{wxInputStream::TellI}
 
 \constfunc{off\_t}{TellI}{\void}
 \membersection{wxInputStream::TellI}
 
 \constfunc{off\_t}{TellI}{\void}
index b01a4b9a0f5a5655873ba9a425d1b158cc892fb8..5ebf899fa5a291c4e0c30fda176b69c8475fc0f1 100644 (file)
@@ -45,10 +45,20 @@ stream position.
 
 \membersection{wxOutputStream::SeekO}\label{wxoutputstreamseeko}
 
 
 \membersection{wxOutputStream::SeekO}\label{wxoutputstreamseeko}
 
-\func{off\_t}{SeekO}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode}}
+\func{off\_t}{SeekO}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode = wxFromStart}}
 
 Changes the stream current position.
 
 
 Changes the stream current position.
 
+\wxheading{Parameters}
+
+\docparam{pos}{Offset to seek to.}
+
+\docparam{mode}{One of {\bf wxFromStart}, {\bf wxFromEnd}, {\bf wxFromCurrent}.}
+
+\wxheading{Return value}
+
+The new stream position or wxInvalidOffset on error.
+
 \membersection{wxOutputStream::TellO}
 
 \constfunc{off\_t}{TellO}{\void}
 \membersection{wxOutputStream::TellO}
 
 \constfunc{off\_t}{TellO}{\void}
index 086022626645255f96ddbeedaef1c3d30c3f02d9..a6b287af0c84d5a7cac7d5c505c8871ae817a4e2 100644 (file)
@@ -251,7 +251,7 @@ size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size)
 
 off_t wxFFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
 {
 
 off_t wxFFileInputStream::OnSysSeek(off_t pos, wxSeekMode mode)
 {
-    return ( m_file->Seek(pos, mode) ? pos : wxInvalidOffset );
+    return ( m_file->Seek(pos, mode) ? m_file->Tell() : wxInvalidOffset );
 }
 
 off_t wxFFileInputStream::OnSysTell() const
 }
 
 off_t wxFFileInputStream::OnSysTell() const
@@ -324,7 +324,7 @@ off_t wxFFileOutputStream::OnSysTell() const
 
 off_t wxFFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
 {
 
 off_t wxFFileOutputStream::OnSysSeek(off_t pos, wxSeekMode mode)
 {
-    return ( m_file->Seek(pos, mode) ? pos : wxInvalidOffset );
+    return ( m_file->Seek(pos, mode) ? m_file->Tell() : wxInvalidOffset );
 }
 
 void wxFFileOutputStream::Sync()
 }
 
 void wxFFileOutputStream::Sync()