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.

history.h 1.0 kB

8 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #ifndef HISTORY_H
  2. #define HISTORY_H
  3. #include "fellow.h"
  4. #include <memory>
  5. #include <vector>
  6. #include "content.h"
  7. #include "post.h"
  8. #include <sqlite3.h>
  9. #include <unordered_map>
  10. using namespace std;
  11. struct HistoryRecord{
  12. time_point<steady_clock, milliseconds> when;
  13. shared_ptr<Fellow> who;
  14. shared_ptr<Content> what;
  15. };
  16. //日志记录
  17. //完成代码
  18. //调试代码
  19. //加入model,合并model功能
  20. //加入engine自动记录
  21. //按好友、日期查询最近记录
  22. //更新文件path
  23. /**
  24. * @brief The History class 以Content为单位,记录和查询聊天记录
  25. * 还只是个半成品~
  26. */
  27. class History
  28. {
  29. public:
  30. History();
  31. public:
  32. bool init(const string& dbPath);
  33. void unInit();
  34. public:
  35. void add(const HistoryRecord &record);
  36. vector<HistoryRecord> query(const string& selection, const vector<string> &args);
  37. private:
  38. unique_ptr<Fellow> getFellow(int id);
  39. int findFellowId(const string& ip);
  40. private:
  41. sqlite3* mDb = nullptr;
  42. };
  43. #endif // HISTORY_H

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

Contributors (1)