% -----------------------------------------------------------------------------
% wxStreamBase
% -----------------------------------------------------------------------------
\section{\class{wxStreamBase}}\label{wxstreambase}

This class is the base class of most stream related classes in wxWidgets. It must
not be used directly.

\wxheading{Derived from}

None

\wxheading{Include files}

<wx/stream.h>

\wxheading{See also}

\helpref{wxStreamBuffer}{wxstreambuffer}

% -----------------------------------------------------------------------------
% Members
% -----------------------------------------------------------------------------
\latexignore{\rtfignore{\wxheading{Members}}} 

% -----------
% ctor & dtor
% -----------


\membersection{wxStreamBase::wxStreamBase}\label{wxstreambasector}

\func{}{wxStreamBase}{\void}

Creates a dummy stream object. It doesn't do anything.


\membersection{wxStreamBase::\destruct{wxStreamBase}}\label{wxstreambasedtor}

\func{}{\destruct{wxStreamBase}}{\void}

Destructor.


\membersection{wxStreamBase::GetLength}\label{wxstreambasegetlength}

\constfunc{wxFileOffset}{GetLength}{\void}

Returns the length of the stream in bytes. If the length cannot be determined
(this is always the case for socket streams for example), returns 
\texttt{wxInvalidOffset}.

\newsince{2.5.4}


\membersection{wxStreamBase::GetLastError}\label{wxstreambasegetlasterror}

\constfunc{wxStreamError}{GetLastError}{\void}

This function returns the last error.

\twocolwidtha{5cm}
\begin{twocollist}\itemsep=0pt
\twocolitem{{\bf wxSTREAM\_NO\_ERROR}}{No error occurred.}
\twocolitem{{\bf wxSTREAM\_EOF}}{An End-Of-File occurred.}
\twocolitem{{\bf wxSTREAM\_WRITE\_ERROR}}{A generic error occurred on the last write call.}
\twocolitem{{\bf wxSTREAM\_READ\_ERROR}}{A generic error occurred on the last read call.}
\end{twocollist}


\membersection{wxStreamBase::GetSize}\label{wxstreambasegetsize}

\constfunc{size\_t}{GetSize}{\void}

\helpref{GetLength}{wxstreambasegetlength}

This function returns the size of the stream. For example, for a file it is the
size of the file.

\wxheading{Warning}

There are streams which do not have size by definition, such as socket streams.
In that cases, GetSize returns $0$ so you should always test its return value.


\membersection{wxStreamBase::IsOk}\label{wxstreambaseisok}

\constfunc{bool}{IsOk}{\void}

Returns true if no error occurred on the stream.

\wxheading{See also}

\helpref{GetLastError}{wxstreambasegetlasterror}


\membersection{wxStreamBase::IsSeekable}\label{wxstreambaseisok}

\constfunc{bool}{IsSeekable}{\void}

Returns true if the streams supports seeking to arbitrary offsets.


\membersection{wxStreamBase::OnSysRead}\label{wxstreambaseonsysread}

\func{size\_t}{OnSysRead}{\param{void*}{ buffer}, \param{size\_t}{ bufsize}}

Internal function. It is called when the stream wants to read data of the
specified size. It should return the size that was actually read.


\membersection{wxStreamBase::OnSysSeek}\label{wxstreambaseonsysseek}

\func{off\_t}{OnSysSeek}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode}}

Internal function. It is called when the stream needs to change the
current position.


\membersection{wxStreamBase::OnSysTell}\label{wxstreambaseonsystell}

\constfunc{off\_t}{OnSysTell}{\void}

Internal function. Is is called when the stream needs to know the
real position.


\membersection{wxStreamBase::OnSysWrite}\label{wxstreambaseonsyswrite}

\func{size\_t}{OnSysWrite}{\param{void *}{buffer}, \param{size\_t}{ bufsize}}

See \helpref{OnSysRead}{wxstreambaseonsysread}.

