stream classes docs and code fixes (part of patch 924438)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26714 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2004-04-11 20:58:56 +00:00
parent 4c68a10264
commit a84e46f231
6 changed files with 52 additions and 4 deletions

View 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.
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}
@ -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.
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}

View 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.
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}

View 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.
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}

View File

@ -34,7 +34,12 @@ Destructor.
\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}
@ -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.
\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}
@ -54,6 +64,12 @@ Returns the last number of bytes read.
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}}
@ -85,6 +101,16 @@ any states of the stream right away.
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}

View File

@ -45,10 +45,20 @@ stream position.
\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.
\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}

View File

@ -251,7 +251,7 @@ size_t wxFFileInputStream::OnSysRead(void *buffer, size_t size)
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
@ -324,7 +324,7 @@ off_t wxFFileOutputStream::OnSysTell() const
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()