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.

8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #ifndef POST_H
  2. #define POST_H
  3. #include <memory>
  4. #include <vector>
  5. #include <list>
  6. #include <string>
  7. #include "content.h"
  8. #include <chrono>
  9. using namespace std;
  10. using namespace std::chrono;
  11. class Fellow;
  12. /**
  13. * @brief The Post struct
  14. * 定义一次好友发来的请求/数据包
  15. */
  16. class Post
  17. {
  18. public:
  19. static time_point<system_clock, milliseconds> now(){
  20. return time_point_cast<milliseconds>(system_clock::now());
  21. }
  22. decltype(now()) when = Post::now();
  23. vector<char> extra;
  24. string packetNo;
  25. IdType cmdId;
  26. shared_ptr<Fellow> from;
  27. vector<shared_ptr<Content>> contents;
  28. Post()
  29. {
  30. from = make_shared<Fellow>();
  31. }
  32. void addContent(shared_ptr<Content> content)
  33. {
  34. content->setPacketNo(packetNo);
  35. contents.push_back(content);
  36. }
  37. };
  38. #endif // POST_H

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

Contributors (1)