openMSX
FilePool.hh
Go to the documentation of this file.
1 #ifndef FILEPOOL_HH
2 #define FILEPOOL_HH
3 
4 #include "EventListener.hh"
5 #include "FilePoolCore.hh"
6 #include "StringSetting.hh"
7 #include "Observer.hh"
8 
9 namespace openmsx {
10 
11 class CommandController;
12 class Reactor;
13 class Sha1SumCommand;
14 
15 class FilePool final : private Observer<Setting>, private EventListener
16 {
17 public:
18  FilePool(CommandController& controller, Reactor& reactor);
19  ~FilePool();
20 
25  File getFile(FileType fileType, const Sha1Sum& sha1sum);
26 
31  Sha1Sum getSha1Sum(File& file);
32 
33 private:
34  FilePoolCore::Directories getDirectories() const;
35  void reportProgress(const std::string& message);
36 
37  // Observer<Setting>
38  void update(const Setting& setting) override;
39 
40  // EventListener
41  int signalEvent(const std::shared_ptr<const Event>& event) override;
42 
43 private:
44  FilePoolCore core;
45  StringSetting filePoolSetting;
46  Reactor& reactor;
47  std::unique_ptr<Sha1SumCommand> sha1SumCommand;
48  bool quit = false;
49 };
50 
51 } // namespace openmsx
52 
53 #endif
openmsx::FilePoolCore
Definition: FilePoolCore.hh:38
openmsx::CommandController
Definition: CommandController.hh:18
openmsx::FileType
FileType
Definition: FilePoolCore.hh:22
openmsx::FilePoolCore::Directories
std::vector< Dir > Directories
Definition: FilePoolCore.hh:44
EventListener.hh
openmsx::Setting
Definition: Setting.hh:120
openmsx::FilePool::FilePool
FilePool(CommandController &controller, Reactor &reactor)
Definition: FilePool.cc:44
StringSetting.hh
openmsx::Reactor
Contains the main loop of openMSX.
Definition: Reactor.hh:67
openmsx::StringSetting
Definition: StringSetting.hh:9
openmsx::FilePool::getSha1Sum
Sha1Sum getSha1Sum(File &file)
Calculate sha1sum for the given File object.
Definition: FilePool.cc:72
Observer.hh
openmsx::FilePool::getFile
File getFile(FileType fileType, const Sha1Sum &sha1sum)
Search file with the given sha1sum.
Definition: FilePool.cc:67
FilePoolCore.hh
openmsx::Sha1Sum
This class represents the result of a sha1 calculation (a 160-bit value).
Definition: sha1.hh:20
openmsx::EventListener
Definition: EventListener.hh:11
openmsx::FilePool::~FilePool
~FilePool()
Definition: FilePool.cc:61
openmsx::File
Definition: File.hh:16
openmsx::FilePool
Definition: FilePool.hh:16
openmsx
This file implemented 3 utility functions:
Definition: Autofire.cc:5
openmsx::Observer
Generic Gang-of-Four Observer class, templatized edition.
Definition: Observer.hh:10