diff options
author | Michael Jones <jonesmz@jonesmz.com> | 2018-04-06 01:13:04 (GMT) |
---|---|---|
committer | Michael Jones <jonesmz@jonesmz.com> | 2020-09-30 21:19:11 (GMT) |
commit | a5aae85a3c8a4032ab18b82afe6c77673125d888 (patch) | |
tree | 0a2a857d7c717d15d4d1cf04b3cab414b9e52f21 /src/disk_interface.h | |
parent | ff4f2a0db21b738bba743ad543d8553417aca7b0 (diff) | |
download | Ninja-a5aae85a3c8a4032ab18b82afe6c77673125d888.zip Ninja-a5aae85a3c8a4032ab18b82afe6c77673125d888.tar.gz Ninja-a5aae85a3c8a4032ab18b82afe6c77673125d888.tar.bz2 |
Remove 'using namespace std' from header files, properly namespace all std symbols
Diffstat (limited to 'src/disk_interface.h')
-rw-r--r-- | src/disk_interface.h | 29 |
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 }; |