SimpleHexRequest.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #ifndef SIMPLEHEXREQUEST_H
  2. #define SIMPLEHEXREQUEST_H
  3. #include "OpenMSXConnection.h"
  4. /**
  5. * A set of helper classes if code needs to read openmsx debugables into an array of unsigned chars
  6. * if class A needs to read a given debugable then this schem will suffice
  7. * - Class A inherits from SimpleHexRequestUser
  8. * - Class A can reimplement the DataHexRequestReceived if it wants to react when new data has arrived
  9. * - Class A can reimplement the DataHexRequestCanceled if it wants to react to failures of the request
  10. * - to read the debuggable into the memmory just create a new SimpleHexRequest, fi.
  11. * new SimpleHexRequest("{VDP status regs}",0,16,statusregs, *this);
  12. *
  13. */
  14. class SimpleHexRequestUser
  15. {
  16. protected:
  17. virtual ~SimpleHexRequestUser();
  18. virtual void DataHexRequestReceived();
  19. virtual void DataHexRequestCanceled();
  20. friend class SimpleHexRequest;
  21. };
  22. class SimpleHexRequest : public ReadDebugBlockCommand
  23. {
  24. public:
  25. SimpleHexRequest(const QString& debuggable, unsigned size,
  26. unsigned char* target, SimpleHexRequestUser& user);
  27. SimpleHexRequest(const QString& debuggable, unsigned offset, unsigned size,
  28. unsigned char* target, SimpleHexRequestUser& user);
  29. virtual void replyOk(const QString& message);
  30. virtual void cancel();
  31. unsigned offset;
  32. private:
  33. SimpleHexRequestUser& user;
  34. };
  35. #endif // SIMPLEHEXREQUEST_H