* wxMemory*Stream link problem fix.

* wxData*Stream update.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@264 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Guilhem Lavaux
1998-07-14 16:35:50 +00:00
parent 79c3e0e1ae
commit 0cd9bfe8da
3 changed files with 14 additions and 42 deletions

View File

@@ -43,6 +43,8 @@ class wxInputStream: virtual public wxObject {
virtual bool Eof() const = 0;
virtual size_t LastRead() const = 0;
wxInputStream& operator>>(wxOutputStream& out) { return Read(out); }
};
class wxOutputStream: virtual public wxObject {
@@ -63,12 +65,6 @@ class wxOutputStream: virtual public wxObject {
virtual void Sync() {}
};
class wxStream: virtual public wxInputStream, virtual public wxOutputStream {
public:
wxStream() {}
virtual ~wxStream() { }
};
/*
* "Filter" streams
*/
@@ -83,6 +79,8 @@ class wxFilterInputStream: public wxInputStream {
{ return m_parent_i_stream->Read(buffer, size); }
virtual off_t SeekI(off_t pos, wxSeekMode mode = wxFromStart)
{ return m_parent_i_stream->SeekI(pos, mode); }
virtual off_t TellI() const
{ return m_parent_i_stream->TellI(); }
virtual bool Eof() const { return m_parent_i_stream->Eof(); }
virtual size_t LastRead() const { return m_parent_i_stream->LastRead(); }
@@ -101,6 +99,8 @@ class wxFilterOutputStream: public wxOutputStream {
{ return m_parent_o_stream->Write(buffer, size); }
virtual off_t SeekO(off_t pos, wxSeekMode mode = wxFromStart)
{ return m_parent_o_stream->SeekO(pos, mode); }
virtual off_t TellO() const
{ return m_parent_o_stream->TellO(); }
virtual bool Bad() const { return m_parent_o_stream->Bad(); }
virtual size_t LastWrite() const { return m_parent_o_stream->LastWrite(); }

View File

@@ -44,9 +44,6 @@ unsigned long wxDataInputStream::Read32()
{
char buf[4];
if (!m_parent_i_stream)
return 0;
Read(buf, 4);
return (unsigned long)buf[0] |
@@ -59,9 +56,6 @@ unsigned short wxDataInputStream::Read16()
{
char buf[2];
if (!m_parent_i_stream)
return 0;
Read(buf, 2);
return (unsigned short)buf[0] |
@@ -72,9 +66,6 @@ unsigned char wxDataInputStream::Read8()
{
char buf;
if (!m_parent_i_stream)
return 0;
Read(&buf, 1);
return (unsigned char)buf;
}
@@ -87,9 +78,6 @@ double wxDataInputStream::ReadDouble()
#if USE_APPLE_IEEE
char buf[10];
if (!m_parent_i_stream)
return 0.0;
Read(buf, 10);
return ConvertFromIeeeExtended((unsigned char *)buf);
#else
@@ -101,9 +89,6 @@ wxString wxDataInputStream::ReadLine()
{
char i_strg[255];
if (!m_parent_i_stream)
return "";
// TODO: Implement ReadLine
return i_strg;
}
@@ -114,9 +99,6 @@ wxString wxDataInputStream::ReadString()
char *string;
unsigned long len;
if (!m_parent_i_stream)
return "";
len = Read32();
string = new char[len+1];
@@ -142,9 +124,6 @@ void wxDataOutputStream::Write32(unsigned long i)
{
char buf[4];
if (!m_parent_o_stream)
return;
buf[0] = i & 0xff;
buf[1] = (i >> 8) & 0xff;
buf[2] = (i >> 16) & 0xff;
@@ -156,9 +135,6 @@ void wxDataOutputStream::Write16(unsigned short i)
{
char buf[2];
if (!m_parent_o_stream)
return;
buf[0] = i & 0xff;
buf[1] = (i >> 8) & 0xff;
Write(buf, 2);
@@ -166,9 +142,6 @@ void wxDataOutputStream::Write16(unsigned short i)
void wxDataOutputStream::Write8(unsigned char i)
{
if (!m_parent_o_stream)
return;
Write(&i, 1);
}
@@ -180,17 +153,11 @@ void wxDataOutputStream::WriteLine(const wxString& line)
wxString tmp_string = line + '\n';
#endif
if (!m_parent_o_stream)
return;
Write((const char *) tmp_string, tmp_string.Length());
}
void wxDataOutputStream::WriteString(const wxString& string)
{
if (!m_parent_o_stream)
return;
Write32(string.Length());
Write((const char *) string, string.Length());
}
@@ -202,9 +169,6 @@ void wxDataOutputStream::WriteDouble(double d)
{
char buf[10];
if (!m_parent_o_stream)
return;
#if USE_APPLE_IEEE
ConvertToIeeeExtended(d, (unsigned char *)buf);
#else

View File

@@ -75,6 +75,10 @@ wxMemoryInputStream::wxMemoryInputStream(const char *data, size_t len)
m_iolimit = 1;
}
wxMemoryInputStream::~wxMemoryInputStream()
{
}
wxInputStream& wxMemoryInputStream::Read(void *buffer, size_t size)
{
if (m_iolimit == 2) {
@@ -133,6 +137,10 @@ wxMemoryOutputStream::wxMemoryOutputStream(char *data, size_t len)
m_iolimit = 2;
}
wxMemoryOutputStream::~wxMemoryOutputStream()
{
}
wxOutputStream& wxMemoryOutputStream::Write(const void *buffer, size_t size)
{
if (m_iolimit == 1) {