openMSX
FileContext.hh
Go to the documentation of this file.
1 #ifndef FILECONTEXT_HH
2 #define FILECONTEXT_HH
3 
4 #include "string_view.hh"
5 #include <vector>
6 
7 namespace openmsx {
8 
9 class FileContext final
10 {
11 public:
12  FileContext() = default;
13  FileContext(std::vector<std::string>&& paths,
14  std::vector<std::string>&& savePaths);
15 
16  std::string resolve (string_view filename) const;
17  std::string resolveCreate(string_view filename) const;
18 
19  std::vector<std::string> getPaths() const;
20  bool isUserContext() const;
21 
22  template<typename Archive>
23  void serialize(Archive& ar, unsigned version);
24 
25 private:
26  std::vector<std::string> paths;
27  std::vector<std::string> savePaths;
28 };
29 
36 
37 } // namespace openmsx
38 
39 #endif
std::string resolveCreate(string_view filename) const
Definition: FileContext.cc:84
FileContext userDataFileContext(string_view subDir)
Definition: FileContext.cc:170
FileContext configFileContext(string_view path, string_view hwDescr, string_view userName)
Definition: FileContext.cc:141
FileContext preferSystemFileContext()
Definition: FileContext.cc:154
FileContext systemFileContext()
Definition: FileContext.cc:148
std::string resolve(string_view filename) const
Definition: FileContext.cc:76
bool isUserContext() const
Definition: FileContext.cc:108
FileContext userFileContext(string_view savePath)
Definition: FileContext.cc:160
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
FileContext currentDirFileContext()
Definition: FileContext.cc:176
This class implements a (close approximation) of the std::string_view class.
Definition: string_view.hh:16
std::vector< std::string > getPaths() const
Definition: FileContext.cc:103
void serialize(Archive &ar, unsigned version)
Definition: FileContext.cc:114