SQL_C_WXCHAR should be used rather than SQL_C_CHAR to ensure transparent
behavior between Unicode and non-unicode builds
- BLOB example added to samples\db (thanks to Casey ODonnell)
+- use wxStream::GetLength() instead of deprecated GetSize()
All (GUI):
% 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::IsOk}\label{wxstreambaseisok}
-\constfunc{wxStreamError}{IsOk}{\void}
+\membersection{wxStreamBase::GetLength}\label{wxstreambasegetlength}
-Returns true if no error occurred on the stream.
+\constfunc{wxFileOffset}{GetLength}{\void}
-\wxheading{See also}
+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}
-\helpref{GetLastError}{wxstreambasegetlasterror}
\membersection{wxStreamBase::GetLastError}\label{wxstreambasegetlasterror}
\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}
+
+\deprecated{\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{wxStreamError}{IsOk}{\void}
+
+Returns true if no error occurred on the stream.
+
+\wxheading{See also}
+
+\helpref{GetLastError}{wxstreambasegetlasterror}
+
+
\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}.
-\membersection{wxStreamBase::GetSize}\label{wxstreambasegetsize}
-
-\constfunc{size\_t}{GetSize}{\void}
-
-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.
public:
wxMemoryInputStream(const void *data, size_t length);
virtual ~wxMemoryInputStream();
- virtual size_t GetSize() const { return m_length; }
+ virtual wxFileOffset GetLength() const { return m_length; }
virtual bool Eof() const;
char Peek();
// if data is !NULL it must be allocated with malloc()
wxMemoryOutputStream(void *data = NULL, size_t length = 0);
virtual ~wxMemoryOutputStream();
- virtual size_t GetSize() const { return m_o_streambuf->GetLastAccess(); }
+ virtual wxFileOffset GetLength() const { return m_o_streambuf->GetLastAccess(); }
size_t CopyTo(void *buffer, size_t len) const;
m_pos = 0;
}
- virtual size_t GetSize() const { return m_str.length(); }
+ virtual wxFileOffset GetLength() const { return m_str.length(); }
protected:
virtual wxFileOffset OnSysSeek(wxFileOffset ofs, wxSeekMode mode);
void Reset() { m_lasterror = wxSTREAM_NO_ERROR; }
// this doesn't make sense for all streams, always test its return value
- virtual size_t GetSize() const { return 0; }
+ virtual size_t GetSize() const;
+ virtual wxFileOffset GetLength() const { return wxInvalidOffset; }
#if WXWIN_COMPATIBILITY_2_2
// deprecated, for compatibility only
public:
wxCountingOutputStream();
- size_t GetSize() const;
+ wxFileOffset GetLength() const;
bool Ok() const { return true; }
protected:
char Peek() { return m_parent_i_stream->Peek(); }
- size_t GetSize() const { return m_parent_i_stream->GetSize(); }
+ wxFileOffset GetLength() const { return m_parent_i_stream->GetLength(); }
wxInputStream *GetFilterInputStream() const { return m_parent_i_stream; }
wxFilterOutputStream(wxOutputStream& stream);
virtual ~wxFilterOutputStream();
- size_t GetSize() const { return m_parent_o_stream->GetSize(); }
+ wxFileOffset GetLength() const { return m_parent_o_stream->GetLength(); }
wxOutputStream *GetFilterOutputStream() const { return m_parent_o_stream; }
void Sync();
- size_t GetSize() const;
+ wxFileOffset GetLength() const;
// the buffer given to the stream will be deleted by it
void SetOutputStreamBuffer(wxStreamBuffer *buffer);
wxFileInputStream(int fd);
~wxFileInputStream();
- size_t GetSize() const;
+ wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
// { return wxOutputStream::Write(buffer, size); }
void Sync();
- size_t GetSize() const;
+ wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
wxFFileInputStream(FILE *file);
~wxFFileInputStream();
- size_t GetSize() const;
+ wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
// { return wxOutputStream::Write(buffer, size); }
void Sync();
- size_t GetSize() const;
+ wxFileOffset GetLength() const;
bool Ok() const { return m_file->IsOpened(); }
// Remember that archive must be local file accesible via fopen, fread functions!
~wxZipInputStream();
- virtual size_t GetSize() const {return m_Size;}
+ virtual wxFileOffset GetLength() const {return m_Size;}
virtual bool Eof() const;
protected:
virtual wxFileOffset OnSysTell() const {return m_Pos;}
private:
- size_t m_Size;
+ wxFileOffset m_Size;
wxFileOffset m_Pos;
// this void* is handle of archive . I'm sorry it is void and not proper
virtual ~wxZlibInputStream();
char Peek() { return wxInputStream::Peek(); }
- size_t GetSize() const { return wxInputStream::GetSize(); }
+ wxFileOffset GetLength() const { return wxInputStream::GetLength(); }
static bool CanHandleGZip();
virtual ~wxZlibOutputStream();
void Sync() { DoFlush(false); }
- size_t GetSize() const { return (size_t)m_pos; }
+ wxFileOffset GetLength() const { return m_pos; }
static bool CanHandleGZip();
{
}
+size_t wxStreamBase::GetSize() const
+{
+ wxFileOffset length = GetLength();
+ return length == wxInvalidOffset ? 0 : (size_t)length;
+}
+
wxFileOffset wxStreamBase::OnSysSeek(wxFileOffset WXUNUSED(seek), wxSeekMode WXUNUSED(mode))
{
return wxInvalidOffset;
m_currentPos = 0;
}
-size_t wxCountingOutputStream::GetSize() const
+wxFileOffset wxCountingOutputStream::GetLength() const
{
return m_lastcount;
}
return m_parent_o_stream->TellO();
}
-size_t wxBufferedOutputStream::GetSize() const
+wxFileOffset wxBufferedOutputStream::GetLength() const
{
- return m_parent_o_stream->GetSize() + m_o_streambuf->GetIntPosition();
+ return m_parent_o_stream->GetLength() + m_o_streambuf->GetIntPosition();
}
void wxBufferedOutputStream::SetOutputStreamBuffer(wxStreamBuffer *buffer)
delete m_file;
}
-size_t wxFileInputStream::GetSize() const
+wxFileOffset wxFileInputStream::GetLength() const
{
return m_file->Length();
}
m_file->Flush();
}
-size_t wxFileOutputStream::GetSize() const
+wxFileOffset wxFileOutputStream::GetLength() const
{
return m_file->Length();
}
delete m_file;
}
-size_t wxFFileInputStream::GetSize() const
+wxFileOffset wxFFileInputStream::GetLength() const
{
return m_file->Length();
}
m_file->Flush();
}
-size_t wxFFileOutputStream::GetSize() const
+wxFileOffset wxFFileOutputStream::GetLength() const
{
return m_file->Length();
}
m_lasterror = wxSTREAM_READ_ERROR;
return;
}
- m_Size = (size_t)zinfo.uncompressed_size;
+ m_Size = zinfo.uncompressed_size;
}
bool wxZipInputStream::Eof() const
{
- wxASSERT_MSG( m_Pos <= (wxFileOffset)m_Size,
+ wxASSERT_MSG( m_Pos <= m_Size,
_T("wxZipInputStream: invalid current position") );
- return m_Pos >= (wxFileOffset)m_Size;
+ return m_Pos >= m_Size;
}
size_t wxZipInputStream::OnSysRead(void *buffer, size_t bufsize)
{
- wxASSERT_MSG( m_Pos <= (wxFileOffset)m_Size,
+ wxASSERT_MSG( m_Pos <= m_Size,
_T("wxZipInputStream: invalid current position") );
- if ( m_Pos >= (wxFileOffset)m_Size )
+ if ( m_Pos >= m_Size )
{
m_lasterror = wxSTREAM_EOF;
return 0;
}
- if (m_Pos + bufsize > m_Size)
+ if (m_Pos + bufsize > m_Size + (size_t)0)
bufsize = m_Size - m_Pos;
unzReadCurrentFile((unzFile)m_Archive, buffer, bufsize);
class wxPyCBInputStream : public wxInputStream {
public:
~wxPyCBInputStream();
- virtual size_t GetSize() const;
+ virtual wxFileOffset GetLength() const;
// factory function
static wxPyCBInputStream* create(PyObject *py, bool block=true);
}
-size_t wxPyCBInputStream::GetSize() const {
+wxFileOffset wxPyCBInputStream::GetLength() const {
wxPyCBInputStream* self = (wxPyCBInputStream*)this; // cast off const
if (m_seek && m_tell) {
wxFileOffset temp = self->OnSysTell();
return ret;
}
else
- return 0;
+ return wxInvalidOffset;
}