Version: 2.9.4
Public Member Functions | Protected Member Functions
wxStreamBase Class Reference

#include </home/zeitlin/src/wx/github/interface/wx/stream.h>

Inheritance diagram for wxStreamBase:

Detailed Description

このクラスは wxWidgets における大半のストリームクラスの基底クラスです。

It must not be used directly.

Library:  wxBase
Category:  Streams
参照:
wxStreamBuffer

Public Member Functions

 wxStreamBase ()
 Creates a dummy stream object.
virtual ~wxStreamBase ()
 Destructor.
wxStreamError GetLastError () const
 This function returns the last error.
virtual wxFileOffset GetLength () const
 Returns the length of the stream in bytes.
virtual size_t GetSize () const
 This function returns the size of the stream.
virtual bool IsOk () const
 Returns true if no error occurred on the stream.
virtual bool IsSeekable () const
 Returns true if the stream supports seeking to arbitrary offsets.
void Reset (wxStreamError error=wxSTREAM_NO_ERROR)
 Resets the stream state.
bool operator! () const
 Returns the opposite of IsOk().

Protected Member Functions

virtual wxFileOffset OnSysSeek (wxFileOffset pos, wxSeekMode mode)
 Internal function.
virtual wxFileOffset OnSysTell () const
 Internal function.

List of all members.


Constructor & Destructor Documentation

wxStreamBase::wxStreamBase ( )

Creates a dummy stream object.

It doesn't do anything.

virtual wxStreamBase::~wxStreamBase ( ) [virtual]

Destructor.


Member Function Documentation

wxStreamError wxStreamBase::GetLastError ( ) const

This function returns the last error.

virtual wxFileOffset wxStreamBase::GetLength ( ) const [virtual]

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 wxInvalidOffset.

Since:
2.5.4
virtual size_t wxStreamBase::GetSize ( ) const [virtual]

This function returns the size of the stream.

For example, for a file it is the size of the file.

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.

Reimplemented in wxCountingOutputStream.

virtual bool wxStreamBase::IsOk ( ) const [virtual]

Returns true if no error occurred on the stream.

参照:
GetLastError()

Reimplemented in wxFSInputStream, wxFFileOutputStream, wxFileOutputStream, wxFileInputStream, wxFFileInputStream, wxFFileStream, and wxFileStream.

virtual bool wxStreamBase::IsSeekable ( ) const [virtual]

Returns true if the stream supports seeking to arbitrary offsets.

virtual wxFileOffset wxStreamBase::OnSysSeek ( wxFileOffset  pos,
wxSeekMode  mode 
) [protected, virtual]

Internal function.

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

Parameters:
posOffset to seek to.
modeOne of the wxSeekMode enumeration values.
Returns:
The new stream position or wxInvalidOffset on error.
virtual wxFileOffset wxStreamBase::OnSysTell ( ) const [protected, virtual]

Internal function.

It is called when the stream needs to know the real position.

Returns:
The current stream position.
bool wxStreamBase::operator! ( ) const

Returns the opposite of IsOk().

You can use this function to test the validity of the stream as if it was a pointer:

            bool DoSomething(wxInputStream& stream)
            {
                wxInt32 data;
                if (!stream.Read(&data, 4))
                    return false;
                ...
            }
void wxStreamBase::Reset ( wxStreamError  error = wxSTREAM_NO_ERROR)

Resets the stream state.

By default, resets the stream to good state, i.e. clears any errors. Since wxWidgets 2.9.3 can be also used to explicitly set the state to the specified error (the error argument didn't exist in the previous versions).

参照:
GetLastError()
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines