| 1 | % ----------------------------------------------------------------------------- |
| 2 | % wxStreamBase |
| 3 | % ----------------------------------------------------------------------------- |
| 4 | \section{\class{wxStreamBase}}\label{wxstreambase} |
| 5 | |
| 6 | This class is the base class of most stream related classes in wxWidgets. It must |
| 7 | not be used directly. |
| 8 | |
| 9 | \wxheading{Derived from} |
| 10 | |
| 11 | None |
| 12 | |
| 13 | \wxheading{Include files} |
| 14 | |
| 15 | <wx/stream.h> |
| 16 | |
| 17 | \wxheading{See also} |
| 18 | |
| 19 | \helpref{wxStreamBuffer}{wxstreambuffer} |
| 20 | |
| 21 | % ----------------------------------------------------------------------------- |
| 22 | % Members |
| 23 | % ----------------------------------------------------------------------------- |
| 24 | \latexignore{\rtfignore{\wxheading{Members}}} |
| 25 | |
| 26 | % ----------- |
| 27 | % ctor & dtor |
| 28 | % ----------- |
| 29 | |
| 30 | |
| 31 | \membersection{wxStreamBase::wxStreamBase}\label{wxstreambasector} |
| 32 | |
| 33 | \func{}{wxStreamBase}{\void} |
| 34 | |
| 35 | Creates a dummy stream object. It doesn't do anything. |
| 36 | |
| 37 | |
| 38 | \membersection{wxStreamBase::\destruct{wxStreamBase}}\label{wxstreambasedtor} |
| 39 | |
| 40 | \func{}{\destruct{wxStreamBase}}{\void} |
| 41 | |
| 42 | Destructor. |
| 43 | |
| 44 | |
| 45 | \membersection{wxStreamBase::GetLength}\label{wxstreambasegetlength} |
| 46 | |
| 47 | \constfunc{wxFileOffset}{GetLength}{\void} |
| 48 | |
| 49 | Returns the length of the stream in bytes. If the length cannot be determined |
| 50 | (this is always the case for socket streams for example), returns |
| 51 | \texttt{wxInvalidOffset}. |
| 52 | |
| 53 | \newsince{2.5.4} |
| 54 | |
| 55 | |
| 56 | \membersection{wxStreamBase::GetLastError}\label{wxstreambasegetlasterror} |
| 57 | |
| 58 | \constfunc{wxStreamError}{GetLastError}{\void} |
| 59 | |
| 60 | This function returns the last error. |
| 61 | |
| 62 | \twocolwidtha{5cm} |
| 63 | \begin{twocollist}\itemsep=0pt |
| 64 | \twocolitem{{\bf wxSTREAM\_NO\_ERROR}}{No error occurred.} |
| 65 | \twocolitem{{\bf wxSTREAM\_EOF}}{An End-Of-File occurred.} |
| 66 | \twocolitem{{\bf wxSTREAM\_WRITE\_ERROR}}{A generic error occurred on the last write call.} |
| 67 | \twocolitem{{\bf wxSTREAM\_READ\_ERROR}}{A generic error occurred on the last read call.} |
| 68 | \end{twocollist} |
| 69 | |
| 70 | |
| 71 | \membersection{wxStreamBase::GetSize}\label{wxstreambasegetsize} |
| 72 | |
| 73 | \constfunc{size\_t}{GetSize}{\void} |
| 74 | |
| 75 | \helpref{GetLength}{wxstreambasegetlength} |
| 76 | |
| 77 | This function returns the size of the stream. For example, for a file it is the |
| 78 | size of the file. |
| 79 | |
| 80 | \wxheading{Warning} |
| 81 | |
| 82 | There are streams which do not have size by definition, such as socket streams. |
| 83 | In that cases, GetSize returns $0$ so you should always test its return value. |
| 84 | |
| 85 | |
| 86 | \membersection{wxStreamBase::IsOk}\label{wxstreambaseisok} |
| 87 | |
| 88 | \constfunc{bool}{IsOk}{\void} |
| 89 | |
| 90 | Returns true if no error occurred on the stream. |
| 91 | |
| 92 | \wxheading{See also} |
| 93 | |
| 94 | \helpref{GetLastError}{wxstreambasegetlasterror} |
| 95 | |
| 96 | |
| 97 | \membersection{wxStreamBase::IsSeekable}\label{wxstreambaseisseekable} |
| 98 | |
| 99 | \constfunc{bool}{IsSeekable}{\void} |
| 100 | |
| 101 | Returns true if the streams supports seeking to arbitrary offsets. |
| 102 | |
| 103 | |
| 104 | \membersection{wxStreamBase::OnSysRead}\label{wxstreambaseonsysread} |
| 105 | |
| 106 | \func{size\_t}{OnSysRead}{\param{void*}{ buffer}, \param{size\_t}{ bufsize}} |
| 107 | |
| 108 | Internal function. It is called when the stream wants to read data of the |
| 109 | specified size. It should return the size that was actually read. |
| 110 | |
| 111 | |
| 112 | \membersection{wxStreamBase::OnSysSeek}\label{wxstreambaseonsysseek} |
| 113 | |
| 114 | \func{off\_t}{OnSysSeek}{\param{off\_t}{ pos}, \param{wxSeekMode}{ mode}} |
| 115 | |
| 116 | Internal function. It is called when the stream needs to change the |
| 117 | current position. |
| 118 | |
| 119 | |
| 120 | \membersection{wxStreamBase::OnSysTell}\label{wxstreambaseonsystell} |
| 121 | |
| 122 | \constfunc{off\_t}{OnSysTell}{\void} |
| 123 | |
| 124 | Internal function. Is is called when the stream needs to know the |
| 125 | real position. |
| 126 | |
| 127 | |
| 128 | \membersection{wxStreamBase::OnSysWrite}\label{wxstreambaseonsyswrite} |
| 129 | |
| 130 | \func{size\_t}{OnSysWrite}{\param{const void *}{buffer}, \param{size\_t}{ bufsize}} |
| 131 | |
| 132 | See \helpref{OnSysRead}{wxstreambaseonsysread}. |
| 133 | |