fdiohandler.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. ///////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/private/fdiohandler.h
  3. // Purpose: declares wxFDIOHandler class
  4. // Author: Vadim Zeitlin
  5. // Created: 2009-08-17
  6. // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
  7. // Licence: wxWindows licence
  8. ///////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_PRIVATE_FDIOHANDLER_H_
  10. #define _WX_PRIVATE_FDIOHANDLER_H_
  11. // ----------------------------------------------------------------------------
  12. // wxFDIOHandler: interface used to process events on file descriptors
  13. // ----------------------------------------------------------------------------
  14. class wxFDIOHandler
  15. {
  16. public:
  17. wxFDIOHandler() { m_regmask = 0; }
  18. // called when descriptor is available for non-blocking read
  19. virtual void OnReadWaiting() = 0;
  20. // called when descriptor is available for non-blocking write
  21. virtual void OnWriteWaiting() = 0;
  22. // called when there is exception on descriptor
  23. virtual void OnExceptionWaiting() = 0;
  24. // called to check if the handler is still valid, only used by
  25. // wxSocketImplUnix currently
  26. virtual bool IsOk() const { return true; }
  27. // get/set the mask of events for which we're currently registered for:
  28. // it's a combination of wxFDIO_{INPUT,OUTPUT,EXCEPTION}
  29. int GetRegisteredEvents() const { return m_regmask; }
  30. void SetRegisteredEvent(int flag) { m_regmask |= flag; }
  31. void ClearRegisteredEvent(int flag) { m_regmask &= ~flag; }
  32. // virtual dtor for the base class
  33. virtual ~wxFDIOHandler() { }
  34. private:
  35. int m_regmask;
  36. wxDECLARE_NO_COPY_CLASS(wxFDIOHandler);
  37. };
  38. #endif // _WX_PRIVATE_FDIOHANDLER_H_