You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ifeiqview.h 1.1 kB

8 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef IFEIQVIEW_H
  2. #define IFEIQVIEW_H
  3. #include <memory>
  4. #include <vector>
  5. #include <chrono>
  6. using namespace std;
  7. using namespace std::chrono;
  8. #include "fellow.h"
  9. #include "content.h"
  10. #include "filetask.h"
  11. #include "post.h"
  12. enum class ViewEventType {
  13. FELLOW_UPDATE,
  14. MESSAGE,
  15. SEND_TIMEO,
  16. };
  17. class ViewEvent
  18. {
  19. public:
  20. virtual ~ViewEvent(){}
  21. public:
  22. decltype(Post::now()) when = Post::now();
  23. ViewEventType what;
  24. };
  25. class FellowViewEvent : public ViewEvent
  26. {
  27. public:
  28. FellowViewEvent(){
  29. what = ViewEventType::FELLOW_UPDATE;
  30. }
  31. shared_ptr<Fellow> fellow;
  32. };
  33. class SendTimeoEvent : public FellowViewEvent
  34. {
  35. public:
  36. SendTimeoEvent(){
  37. what = ViewEventType::SEND_TIMEO;
  38. }
  39. shared_ptr<Content> content;
  40. };
  41. class MessageViewEvent : public FellowViewEvent
  42. {
  43. public:
  44. MessageViewEvent(){
  45. what = ViewEventType::MESSAGE;
  46. }
  47. vector<shared_ptr<Content>> contents;
  48. };
  49. class IFeiqView : public IFileTaskObserver
  50. {
  51. public:
  52. virtual ~IFeiqView(){}
  53. virtual void onEvent(shared_ptr<ViewEvent> event) = 0;
  54. };
  55. #endif // IFEIQVIEW_H

mac下的“飞秋”大多数只是飞鸽传书协议,而且未发现令人满意的开源项目,所以基于c++与qt实现了基础的飞秋协议。

Contributors (1)