module.cc 695 B

123456789101112131415161718192021222324252627282930313233343536
  1. #include <string>
  2. #include <vector>
  3. #include "main.hpp"
  4. namespace flyfish {
  5. class PreviewHistory {
  6. public:
  7. void push(PreviewFile file) {
  8. items_.push_back(std::move(file));
  9. }
  10. std::size_t readyCount() const {
  11. std::size_t count = 0;
  12. for (const auto& item : items_) {
  13. if (item.status == PreviewStatus::Ready) {
  14. ++count;
  15. }
  16. }
  17. return count;
  18. }
  19. private:
  20. std::vector<PreviewFile> items_;
  21. };
  22. PreviewHistory createHistory() {
  23. PreviewHistory history;
  24. for (auto file : createPreviewQueue({"invoice.ofd", "table.xlsx", "module.cc"})) {
  25. file.status = PreviewStatus::Ready;
  26. history.push(file);
  27. }
  28. return history;
  29. }
  30. } // namespace flyfish