// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/defs.h"
+#endif
+
+#if wxUSE_STREAMS
+
#include <ctype.h>
#include <wx/stream.h>
#include <wx/datstrm.h>
#include <wx/objstrm.h>
-#ifdef __BORLANDC__
-#pragma hdrstop
-#endif
-
#define BUF_TEMP_SIZE 10000
// ----------------------------------------------------------------------------
}
GetFromBuffer(&c, 1);
+
m_stream->m_lastcount = 1;
return c;
}
return *this;
}
-wxInputStream& wxInputStream::operator>>(short& i)
+wxInputStream& wxInputStream::operator>>(signed short& i)
{
- long l;
+ signed long l;
*this >> l;
- i = (short)l;
+ i = (signed short)l;
return *this;
}
-wxInputStream& wxInputStream::operator>>(int& i)
+wxInputStream& wxInputStream::operator>>(signed int& i)
{
- long l;
+ signed long l;
*this >> l;
- i = (short)l;
+ i = (signed int)l;
return *this;
}
-wxInputStream& wxInputStream::operator>>(long& i)
+wxInputStream& wxInputStream::operator>>(signed long& i)
{
/* I only implemented a simple integer parser */
- int c, sign;
+ int c;
+ int sign;
while (isspace( c = GetC() ) )
/* Do nothing */ ;
if (c == '-') {
sign = -1;
c = GetC();
- } else
+ } else if (c == '+') {
+ sign = 1;
+ c = GetC();
+ } else {
sign = 1;
+ }
while (isdigit(c)) {
i = i*10 + c;
return *this;
}
+wxInputStream& wxInputStream::operator>>(unsigned short& i)
+{
+ unsigned long l;
+
+ *this >> l;
+ i = (unsigned short)l;
+ return *this;
+}
+
+wxInputStream& wxInputStream::operator>>(unsigned int& i)
+{
+ unsigned long l;
+
+ *this >> l;
+ i = (unsigned int)l;
+ return *this;
+}
+
+wxInputStream& wxInputStream::operator>>(unsigned long& i)
+{
+ /* I only implemented a simple integer parser */
+ int c;
+
+ while (isspace( c = GetC() ) )
+ /* Do nothing */ ;
+
+ i = 0;
+ if (!isdigit(c)) {
+ InputStreamBuffer()->WriteBack(c);
+ return *this;
+ }
+
+ while (isdigit(c)) {
+ i = i*10 + c;
+ c = GetC();
+ }
+
+ return *this;
+}
+
wxInputStream& wxInputStream::operator>>(double& f)
{
/* I only implemented a simple float parser */
if (c == '-') {
sign = -1;
c = GetC();
- } else
+ } else if (c == '+') {
sign = 1;
+ c = GetC();
+ } else {
+ sign = 1;
+ }
while (isdigit(c)) {
f = f*10 + (c - '0');
return Write(&c, 1);
}
-wxOutputStream& wxOutputStream::operator<<(short i)
+wxOutputStream& wxOutputStream::operator<<(signed short i)
{
- wxString strint;
+ signed long l = (signed long)i;
+ return *this << l;
+}
- strint.Printf(_T("%i"), i);
- return *this << strint;
+wxOutputStream& wxOutputStream::operator<<(signed int i)
+{
+ signed long l = (signed long)i;
+ return *this << l;
}
-wxOutputStream& wxOutputStream::operator<<(int i)
+wxOutputStream& wxOutputStream::operator<<(signed long i)
{
- wxString strint;
+ wxString strlong;
+ strlong.Printf(_T("%ld"), i);
+ return *this << strlong;
+}
- strint.Printf(_T("%i"), i);
- return *this << strint;
+wxOutputStream& wxOutputStream::operator<<(unsigned short i)
+{
+ unsigned long l = (unsigned long)i;
+ return *this << l;
}
-wxOutputStream& wxOutputStream::operator<<(long i)
+wxOutputStream& wxOutputStream::operator<<(unsigned int i)
{
- wxString strlong;
+ unsigned long l = (unsigned long)i;
+ return *this << l;
+}
- strlong.Printf(_T("%i"), i);
+wxOutputStream& wxOutputStream::operator<<(unsigned long i)
+{
+ wxString strlong;
+ strlong.Printf(_T("%lu"), i);
return *this << strlong;
}
return stream.Write("\n", 1);
#endif
}
+
+#endif
+ // wxUSE_STREAMS