* Doc updates
* Fixes about socket, stream core, a superfluous stream. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1670 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
5e1962f77f
commit
7f42cff13e
@ -191,6 +191,7 @@ $$\image{14cm;0cm}{wxclass.ps}$$
|
||||
\input strlist.tex
|
||||
\input strmbase.tex
|
||||
\input stream.tex
|
||||
\input strmmem.tex
|
||||
\input sysclevt.tex
|
||||
\input settings.tex
|
||||
\input tab.tex
|
||||
|
@ -94,3 +94,6 @@ writing data, he has to delete the stream to close it.
|
||||
|
||||
An initialized write-only stream.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxOutputStream}{wxoutputstream}
|
||||
|
@ -30,11 +30,18 @@ TRUE, if the connection is established, else FALSE.
|
||||
|
||||
Creates a new input stream on the the specified path. You can use all but seek
|
||||
functionnality of wxStream. Seek isn't available on all stream. For example,
|
||||
http or ftp streams doesn't deal with it.
|
||||
http or ftp streams doesn't deal with it. Other functions like StreamSize and
|
||||
Tell aren't available for the moment for this sort of stream.
|
||||
You will be notified when the EOF is reached by an error.
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
Returns the initialized stream. You will have to delete it yourself.
|
||||
Returns the initialized stream. You will have to delete it yourself once you
|
||||
don't use it anymore. The destructor closes the network connection.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
\helpref{wxInputStream}{wxinputstream}
|
||||
|
||||
% ----------------------------------------------------------------------------
|
||||
\membersection{wxProtocol::Abort}\label{wxprotoabort}
|
||||
@ -43,7 +50,9 @@ Returns the initialized stream. You will have to delete it yourself.
|
||||
|
||||
Abort the current stream.
|
||||
|
||||
\it{WARNING: It is advised to destroy the input stream instead of aborting the stream this way.}
|
||||
\wxheading{Warning}
|
||||
|
||||
It is advised to destroy the input stream instead of aborting the stream this way.
|
||||
|
||||
\wxheading{Return value}
|
||||
|
||||
@ -89,4 +98,3 @@ Sets the authentication user. It is mainly useful when FTP is used.
|
||||
\func{void}{SetPassword}{\param{const wxString\&}{ user}}
|
||||
|
||||
Sets the authentication password. It is mainly useful when FTP is used.
|
||||
|
||||
|
@ -48,6 +48,16 @@ functionnalities of a ``normal'' stream.
|
||||
\wxheading{Warning}
|
||||
|
||||
The "read\_write" mode may not work: it isn't completely finished.
|
||||
You can create "memory" streams by this way:
|
||||
\begin{verbatim}
|
||||
wxStreamBuffer *sb = new wxStreamBuffer(wxStreamBuffer::read)
|
||||
wxInputStream *input = new wxInputStream(sb);
|
||||
|
||||
sb->Fixed(FALSE); // It can change the size of the buffer.
|
||||
|
||||
// input is now a read-only memory stream.
|
||||
\end{verbatim}
|
||||
But you should care about destroying the stream buffer \it{YOURSELF}.
|
||||
|
||||
\wxheading{See also}
|
||||
|
||||
|
@ -84,5 +84,5 @@ current position in the stream. See \helpref{wxStreamBuffer::Seek}{wxstreambuffe
|
||||
\constfunc{off_t}{OnSysTell}{\void}
|
||||
|
||||
Internal function. Is is called when the stream buffer needs to know the
|
||||
current position in the stream.
|
||||
real position in the stream.
|
||||
|
||||
|
@ -27,10 +27,4 @@ class wxMemoryOutputStream: public wxOutputStream {
|
||||
virtual ~wxMemoryOutputStream();
|
||||
};
|
||||
|
||||
class wxMemoryStream: public wxMemoryInputStream, public wxMemoryOutputStream {
|
||||
public:
|
||||
wxMemoryStream(char *data = NULL, size_t length = 0);
|
||||
virtual ~wxMemoryStream();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -328,6 +328,7 @@ bool wxFTP::Abort(void)
|
||||
wxInputStream *wxFTP::GetInputStream(const wxString& path)
|
||||
{
|
||||
wxString tmp_str;
|
||||
size_t calc_size;
|
||||
|
||||
if (!SendCommand("TYPE I", '2'))
|
||||
return NULL;
|
||||
|
@ -358,6 +358,7 @@ bool wxSocketBase::Close()
|
||||
wxSocketBase& wxSocketBase::Read(char* buffer, size_t nbytes)
|
||||
{
|
||||
m_lcount = GetPushback(buffer, nbytes, FALSE);
|
||||
nbytes -= m_lcount;
|
||||
|
||||
// If we have got the whole needed buffer or if we don't want to
|
||||
// wait then it returns immediately.
|
||||
|
@ -285,6 +285,9 @@ size_t wxStreamBuffer::Read(void *buffer, size_t size)
|
||||
{
|
||||
wxASSERT(m_stream != NULL);
|
||||
|
||||
if (m_mode == write)
|
||||
return 0;
|
||||
|
||||
// ------------------
|
||||
// Buffering disabled
|
||||
// ------------------
|
||||
@ -334,6 +337,9 @@ size_t wxStreamBuffer::Read(wxStreamBuffer *s_buf)
|
||||
char buf[BUF_TEMP_SIZE];
|
||||
size_t s = 0, bytes_read = BUF_TEMP_SIZE;
|
||||
|
||||
if (m_mode == write)
|
||||
return 0;
|
||||
|
||||
while (bytes_read == BUF_TEMP_SIZE) {
|
||||
bytes_read = Read(buf, bytes_read);
|
||||
bytes_read = s_buf->Write(buf, bytes_read);
|
||||
@ -346,6 +352,9 @@ size_t wxStreamBuffer::Write(const void *buffer, size_t size)
|
||||
{
|
||||
wxASSERT(m_stream != NULL);
|
||||
|
||||
if (m_mode == read)
|
||||
return 0;
|
||||
|
||||
// ------------------
|
||||
// Buffering disabled
|
||||
// ------------------
|
||||
@ -392,6 +401,9 @@ size_t wxStreamBuffer::Write(wxStreamBuffer *sbuf)
|
||||
char buf[BUF_TEMP_SIZE];
|
||||
size_t s = 0, bytes_count = BUF_TEMP_SIZE, b_count2;
|
||||
|
||||
if (m_mode == read)
|
||||
return 0;
|
||||
|
||||
while (bytes_count == BUF_TEMP_SIZE) {
|
||||
b_count2 = sbuf->Read(buf, bytes_count);
|
||||
bytes_count = Write(buf, b_count2);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#endif
|
||||
#include <wx/stream.h>
|
||||
#include <wx/wfstream.h>
|
||||
#include <wx/mstream.h>
|
||||
|
||||
#include "mmfile.h"
|
||||
|
||||
@ -44,16 +43,18 @@ wxMMediaFile::wxMMediaFile(wxInputStream& is, bool preload, bool seekable)
|
||||
m_tmpfname((char *)NULL), m_mfname((char *)NULL),
|
||||
m_seekable(seekable)
|
||||
{
|
||||
/*
|
||||
if (preload) {
|
||||
wxMemoryStream *tmpstream = new wxMemoryStream();
|
||||
wxStreamBuffer *streamb = new wxStreamBuffer(wxStreamBuffer::read_write);
|
||||
|
||||
m_o_temp = tmpstream;
|
||||
m_i_temp = tmpstream;
|
||||
streamb->Fixed(FALSE);
|
||||
streamb->Flushable(FALSE);
|
||||
|
||||
m_o_temp = new wxOutputStream(streamb);
|
||||
m_i_temp = new wxInputStream(streamb);
|
||||
|
||||
m_o_temp->Write(is);
|
||||
streamb->ResetBuffer();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
wxMMediaFile::wxMMediaFile(const wxString& fname)
|
||||
@ -75,16 +76,18 @@ void wxMMediaFile::SetFile(wxInputStream& str, bool preload, bool seekable)
|
||||
m_ostream = NULL;
|
||||
m_seekable = seekable;
|
||||
|
||||
/*
|
||||
if (preload) {
|
||||
wxMemoryStream *tmpstream = new wxMemoryStream();
|
||||
wxStreamBuffer *streamb = new wxStreamBuffer(wxStreamBuffer::read_write);
|
||||
|
||||
m_i_temp = tmpstream;
|
||||
m_o_temp = tmpstream;
|
||||
streamb->Fixed(FALSE);
|
||||
streamb->Flushable(FALSE);
|
||||
|
||||
m_o_temp->Write(str);
|
||||
m_o_temp = new wxOutputStream(streamb);
|
||||
m_i_temp = new wxInputStream(streamb);
|
||||
|
||||
m_o_temp->Write(is);
|
||||
streamb->ResetBuffer();
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void wxMMediaFile::SetFile(wxOutputStream& str, bool seekable)
|
||||
@ -113,7 +116,9 @@ void wxMMediaFile::CleanUpPrevious()
|
||||
if (m_ostream)
|
||||
m_ostream->Write(*m_i_temp);
|
||||
|
||||
delete m_i_temp; // Only one delete because m_tmpo* and m_tmpi* are linked
|
||||
delete m_i_temp->StreamBuffer();
|
||||
delete m_i_temp;
|
||||
delete m_o_temp;
|
||||
|
||||
if (m_tmpfname)
|
||||
wxRemoveFile(m_tmpfname);
|
||||
|
@ -1,3 +1,12 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Name: sndpcm.cpp
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
// Created: 1998
|
||||
// Updated: 1999
|
||||
// Copyright: (C) 1997, 1998, 1999, Guilhem Lavaux
|
||||
// License: wxWindows license
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "sndpcm.h"
|
||||
#endif
|
||||
@ -106,9 +115,11 @@ void wxSoundPcmCodec::InputSwapAndSign16()
|
||||
} else {
|
||||
while (StreamOk()) {
|
||||
temp = GET();
|
||||
temp2 = GET();
|
||||
PUT(temp ^ signer1);
|
||||
if (!StreamOk()) {
|
||||
m_in_sound->WriteBack(temp);
|
||||
m_in_sound->WriteBack(temp2);
|
||||
break;
|
||||
}
|
||||
PUT(GET() ^ signer2);
|
||||
@ -164,6 +175,7 @@ void wxSoundPcmCodec::OutputSwapAndSign16()
|
||||
PUT(temp ^ signer1);
|
||||
if (!StreamOk()) {
|
||||
m_in_sound->WriteBack(temp);
|
||||
m_in_sound->WriteBack(temp2);
|
||||
break;
|
||||
}
|
||||
PUT(temp2 ^ signer2);
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "mmfile.h"
|
||||
#include "wx/string.h"
|
||||
#include "wx/window.h"
|
||||
#include "wx/frame.h"
|
||||
|
||||
///
|
||||
typedef enum {
|
||||
|
Loading…
Reference in New Issue
Block a user