5 #include <msp/time/timestamp.h>
20 typedef __uint64 FileSize;
22 typedef unsigned long long FileSize;
26 Holds file information.
43 Time::TimeStamp mtime;
44 mutable OwnerInfo owner_info;
50 Stat &operator=(const Stat &);
53 FileType get_type() const { return type; }
54 bool is_regular() const { return type==REGULAR; }
55 bool is_directory() const { return type==DIRECTORY; }
56 bool is_symlink() const { return type==SYMLINK; }
57 FileSize get_size() const { return size; }
58 FileSize get_alloc_size() const { return alloc_size; }
59 const Time::TimeStamp &get_modify_time() const { return mtime; }
60 const std::string &get_owner() const;
61 const std::string &get_group() const;
63 operator bool() const { return exists; }
65 /// Returns a Stat object describing a file.
66 static Stat stat(const Path &);
67 static Stat lstat(const Path &);
70 /// Convenience wrapper for Stat::stat
71 inline Stat stat(const Path &path)
72 { return Stat::stat(path); }
74 /// Convenience wrapper for Stat::lstat
75 inline Stat lstat(const Path &path)
76 { return Stat::lstat(path); }
78 /// Tests for existence of a file
79 bool exists(const Path &path);
81 /// Tests whether a path refers to an existing regular file
82 inline bool is_reg(const Path &path)
83 { return stat(path).is_regular(); }
85 /// Tests whether a path refers to an existing directory
86 inline bool is_dir(const Path &path)
87 { return stat(path).is_directory(); }
89 /// Tests whether a path refers to a symbolic link
90 inline bool is_link(const Path &path)
91 { return lstat(path).is_symlink(); }