15 #ifndef NINJA_DISK_INTERFACE_H_ 16 #define NINJA_DISK_INTERFACE_H_ 37 virtual Status ReadFile(
const std::string& path, std::string* contents,
38 std::string* err) = 0;
48 virtual TimeStamp Stat(
const std::string& path, std::string* err)
const = 0;
51 virtual bool MakeDir(
const std::string& path) = 0;
55 virtual bool WriteFile(
const std::string& path,
56 const std::string& contents) = 0;
63 virtual int RemoveFile(
const std::string& path) = 0;
67 bool MakeDirs(
const std::string& path);
78 virtual TimeStamp Stat(
const std::string& path, std::string* err)
const;
79 virtual bool MakeDir(
const std::string& path);
80 virtual bool WriteFile(
const std::string& path,
const std::string& contents);
81 virtual Status ReadFile(
const std::string& path, std::string* contents,
83 virtual int RemoveFile(
const std::string& path);
93 typedef std::map<std::string, TimeStamp> DirCache;
96 typedef std::map<std::string, DirCache> Cache;
101 #endif // NINJA_DISK_INTERFACE_H_ virtual bool MakeDir(const std::string &path)
Create a directory, returning false on failure.
virtual bool WriteFile(const std::string &path, const std::string &contents)=0
Create a file, with the specified name and contents Returns true on success, false on failure...
virtual int RemoveFile(const std::string &path)=0
Remove the file named path.
virtual TimeStamp Stat(const std::string &path, std::string *err) const
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
Interface for accessing the disk.
virtual bool MakeDir(const std::string &path)=0
Create a directory, returning false on failure.
virtual bool WriteFile(const std::string &path, const std::string &contents)
Create a file, with the specified name and contents Returns true on success, false on failure...
Implementation of DiskInterface that actually hits the disk.
Status
Result of ReadFile.
virtual Status ReadFile(const std::string &path, std::string *contents, std::string *err)
Read and store in given string.
virtual Status ReadFile(const std::string &path, std::string *contents, std::string *err)=0
Read and store in given string.
bool MakeDirs(const std::string &path)
Create all the parent directories for path; like mkdir -p basename path.
void AllowStatCache(bool allow)
Whether stat information can be cached. Only has an effect on Windows.
virtual ~RealDiskInterface()
virtual TimeStamp Stat(const std::string &path, std::string *err) const =0
stat() a file, returning the mtime, or 0 if missing and -1 on other errors.
virtual int RemoveFile(const std::string &path)
Remove the file named path.
Interface for reading files from disk.