summaryrefslogtreecommitdiffstats
path: root/src/disk_interface.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/disk_interface.h')
-rw-r--r--src/disk_interface.h29
1 files changed, 14 insertions, 15 deletions
diff --git a/src/disk_interface.h b/src/disk_interface.h
index 145e089..b75f1f6 100644
--- a/src/disk_interface.h
+++ b/src/disk_interface.h
@@ -17,7 +17,6 @@
#include <map>
#include <string>
-using namespace std;
#include "timestamp.h"
@@ -35,8 +34,8 @@ struct FileReader {
/// Read and store in given string. On success, return Okay.
/// On error, return another Status and fill |err|.
- virtual Status ReadFile(const string& path, string* contents,
- string* err) = 0;
+ virtual Status ReadFile(const std::string& path, std::string* contents,
+ std::string* err) = 0;
};
/// Interface for accessing the disk.
@@ -46,25 +45,25 @@ struct FileReader {
struct DiskInterface: public FileReader {
/// stat() a file, returning the mtime, or 0 if missing and -1 on
/// other errors.
- virtual TimeStamp Stat(const string& path, string* err) const = 0;
+ virtual TimeStamp Stat(const std::string& path, std::string* err) const = 0;
/// Create a directory, returning false on failure.
- virtual bool MakeDir(const string& path) = 0;
+ virtual bool MakeDir(const std::string& path) = 0;
/// Create a file, with the specified name and contents
/// Returns true on success, false on failure
- virtual bool WriteFile(const string& path, const string& contents) = 0;
+ virtual bool WriteFile(const std::string& path, const std::string& contents) = 0;
/// Remove the file named @a path. It behaves like 'rm -f path' so no errors
/// are reported if it does not exists.
/// @returns 0 if the file has been removed,
/// 1 if the file does not exist, and
/// -1 if an error occurs.
- virtual int RemoveFile(const string& path) = 0;
+ virtual int RemoveFile(const std::string& path) = 0;
/// Create all the parent directories for path; like mkdir -p
/// `basename path`.
- bool MakeDirs(const string& path);
+ bool MakeDirs(const std::string& path);
};
/// Implementation of DiskInterface that actually hits the disk.
@@ -75,11 +74,11 @@ struct RealDiskInterface : public DiskInterface {
#endif
{}
virtual ~RealDiskInterface() {}
- virtual TimeStamp Stat(const string& path, string* err) const;
- virtual bool MakeDir(const string& path);
- virtual bool WriteFile(const string& path, const string& contents);
- virtual Status ReadFile(const string& path, string* contents, string* err);
- virtual int RemoveFile(const string& path);
+ virtual TimeStamp Stat(const std::string& path, std::string* err) const;
+ virtual bool MakeDir(const std::string& path);
+ virtual bool WriteFile(const std::string& path, const std::string& contents);
+ virtual Status ReadFile(const std::string& path, std::string* contents, std::string* err);
+ virtual int RemoveFile(const std::string& path);
/// Whether stat information can be cached. Only has an effect on Windows.
void AllowStatCache(bool allow);
@@ -89,10 +88,10 @@ struct RealDiskInterface : public DiskInterface {
/// Whether stat information can be cached.
bool use_cache_;
- typedef map<string, TimeStamp> DirCache;
+ typedef std::map<std::string, TimeStamp> DirCache;
// TODO: Neither a map nor a hashmap seems ideal here. If the statcache
// works out, come up with a better data structure.
- typedef map<string, DirCache> Cache;
+ typedef std::map<std::string, DirCache> Cache;
mutable Cache cache_;
#endif
};