// FileStatus.h #ifndef FileStatus_H #define FileStatus_H // David Adams // August 2002 // // Class to provide easy access to the status of a file. #include #include class FileStatusImp; class FileStatus { public: // typedefs typedef long size_type; typedef long Time; private: // data // Implementation. FileStatusImp* m_pimp; public: // functions // Constructor from name. FileStatus(std::string name =""); // Constructor from directory and name. // Name used is dirname/filename. FileStatus(std::string dirname, std::string filename); // Copy. FileStatus(const FileStatus&); // Assignment. FileStatus& operator=(const FileStatus& rhs); // Destructor. ~FileStatus(); // Update the status. int update(); // Return the file name as specified. // Either name or dirname/name. std::string name() const; // Does the file exist? bool exists() const; // Is this a regular file? bool is_regular() const; // Is this a directory? bool is_directory() const; // Is this special (not regular or directory). bool is_special() const; // Is this file user readable? bool is_readable() const; // Is this file user writeable? bool is_writeable() const; // Is this file user executable? bool is_executable() const; // Is this file world writeable? bool is_world_writeable() const; // Size of the file in bytes. // Zero if the file is not regular. size_type size() const; // Time of last modification. Time modtime() const; // Time of last access. Time acctime() const; // Is this file a symlink (soft link). bool is_symlink() const; }; std::ostream& operator<<(std::ostream& lhs, const FileStatus& rhs); bool operator==(const FileStatus& lhs, const FileStatus& rhs); #endif