1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/host_file_opener.h Wed Feb 03 00:15:16 2021 +0100
1.3 @@ -0,0 +1,36 @@
1.4 +#pragma once
1.5 +
1.6 +#include <map>
1.7 +
1.8 +#include "opener_resource.h"
1.9 +
1.10 +
1.11 +
1.12 +/* Collection types. */
1.13 +
1.14 +typedef std::map<fileid_t, const char *> FilePaths;
1.15 +typedef std::pair<fileid_t, const char *> FilePathEntry;
1.16 +
1.17 +
1.18 +
1.19 +/* Support for providing access to files. */
1.20 +
1.21 +class HostFileOpener : public OpenerResource
1.22 +{
1.23 +protected:
1.24 + FilePaths _paths;
1.25 +
1.26 + /* Configurable methods. */
1.27 +
1.28 + virtual fileid_t get_fileid(const char *path);
1.29 +
1.30 + virtual Accessor *make_accessor(fileid_t fileid);
1.31 +
1.32 +public:
1.33 + explicit HostFileOpener(Accessing *accessing, Paging *paging, Pages *pages)
1.34 + : OpenerResource(accessing, paging, pages)
1.35 + {
1.36 + }
1.37 +};
1.38 +
1.39 +// vim: tabstop=4 expandtab shiftwidth=4