Ninja
Public Member Functions | Public Attributes | List of all members
RealDiskInterface Struct Reference

Implementation of DiskInterface that actually hits the disk. More...

#include <disk_interface.h>

Inheritance diagram for RealDiskInterface:
Inheritance graph
[legend]

Public Member Functions

virtual bool MakeDir (const string &path)
 Create a directory, returning false on failure. More...
 
bool MakeDirs (const string &path)
 Create all the parent directories for path; like mkdir -p basename path. More...
 
virtual string ReadFile (const string &path, string *err)
 Read a file to a string. Fill in |err| on error. More...
 
 RealDiskInterface ()
 
virtual int RemoveFile (const string &path)
 Remove the file named path. More...
 
virtual TimeStamp Stat (const string &path)
 stat() a file, returning the mtime, or 0 if missing and -1 on other errors. More...
 
virtual bool WriteFile (const string &path, const string &contents)
 Create a file, with the specified name and contents Returns true on success, false on failure. More...
 
virtual ~RealDiskInterface ()
 

Public Attributes

bool quiet_
 Whether to print on errors. Used to make a test quieter. More...
 

Detailed Description

Implementation of DiskInterface that actually hits the disk.

Definition at line 57 of file disk_interface.h.

Constructor & Destructor Documentation

RealDiskInterface::RealDiskInterface ( )
inline

Definition at line 58 of file disk_interface.h.

virtual RealDiskInterface::~RealDiskInterface ( )
inlinevirtual

Definition at line 59 of file disk_interface.h.

Member Function Documentation

bool RealDiskInterface::MakeDir ( const string &  path)
virtual

Create a directory, returning false on failure.

Implements DiskInterface.

Definition at line 147 of file disk_interface.cc.

References Error().

bool DiskInterface::MakeDirs ( const string &  path)
inherited

Create all the parent directories for path; like mkdir -p basename path.

Definition at line 59 of file disk_interface.cc.

References DiskInterface::MakeDir(), and DiskInterface::Stat().

Referenced by Builder::StartEdge().

string RealDiskInterface::ReadFile ( const string &  path,
string *  err 
)
virtual

Read a file to a string. Fill in |err| on error.

Implements DiskInterface.

Definition at line 155 of file disk_interface.cc.

int RealDiskInterface::RemoveFile ( const string &  path)
virtual

Remove the file named 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.

Implements DiskInterface.

Definition at line 165 of file disk_interface.cc.

References Error().

TimeStamp RealDiskInterface::Stat ( const string &  path)
virtual

stat() a file, returning the mtime, or 0 if missing and -1 on other errors.

Implements DiskInterface.

Definition at line 78 of file disk_interface.cc.

References Error(), and quiet_.

bool RealDiskInterface::WriteFile ( const string &  path,
const string &  contents 
)
virtual

Create a file, with the specified name and contents Returns true on success, false on failure.

Implements DiskInterface.

Definition at line 123 of file disk_interface.cc.

References Error().

Member Data Documentation

bool RealDiskInterface::quiet_

Whether to print on errors. Used to make a test quieter.

Definition at line 67 of file disk_interface.h.

Referenced by Stat().


The documentation for this struct was generated from the following files: