sckstrm.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/sckstrm.h
  3. // Purpose: wxSocket*Stream
  4. // Author: Guilhem Lavaux
  5. // Modified by:
  6. // Created: 17/07/97
  7. // Copyright: (c)
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef __SCK_STREAM_H__
  11. #define __SCK_STREAM_H__
  12. #include "wx/stream.h"
  13. #if wxUSE_SOCKETS && wxUSE_STREAMS
  14. #include "wx/socket.h"
  15. class WXDLLIMPEXP_NET wxSocketOutputStream : public wxOutputStream
  16. {
  17. public:
  18. wxSocketOutputStream(wxSocketBase& s);
  19. virtual ~wxSocketOutputStream();
  20. protected:
  21. wxSocketBase *m_o_socket;
  22. size_t OnSysWrite(const void *buffer, size_t bufsize);
  23. // socket streams are both un-seekable and size-less streams:
  24. wxFileOffset OnSysTell() const
  25. { return wxInvalidOffset; }
  26. wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode))
  27. { return wxInvalidOffset; }
  28. wxDECLARE_NO_COPY_CLASS(wxSocketOutputStream);
  29. };
  30. class WXDLLIMPEXP_NET wxSocketInputStream : public wxInputStream
  31. {
  32. public:
  33. wxSocketInputStream(wxSocketBase& s);
  34. virtual ~wxSocketInputStream();
  35. protected:
  36. wxSocketBase *m_i_socket;
  37. size_t OnSysRead(void *buffer, size_t bufsize);
  38. // socket streams are both un-seekable and size-less streams:
  39. wxFileOffset OnSysTell() const
  40. { return wxInvalidOffset; }
  41. wxFileOffset OnSysSeek(wxFileOffset WXUNUSED(pos), wxSeekMode WXUNUSED(mode))
  42. { return wxInvalidOffset; }
  43. wxDECLARE_NO_COPY_CLASS(wxSocketInputStream);
  44. };
  45. class WXDLLIMPEXP_NET wxSocketStream : public wxSocketInputStream,
  46. public wxSocketOutputStream
  47. {
  48. public:
  49. wxSocketStream(wxSocketBase& s);
  50. virtual ~wxSocketStream();
  51. wxDECLARE_NO_COPY_CLASS(wxSocketStream);
  52. };
  53. #endif
  54. // wxUSE_SOCKETS && wxUSE_STREAMS
  55. #endif
  56. // __SCK_STREAM_H__