+ struct OwnerInfo
+ {
+ std::string owner;
+ std::string group;
+ };
+
+ bool exists = false;
+ FileType type = UNKNOWN;
+ FileSize size = 0;
+ FileSize alloc_size = 0;
+ Time::TimeStamp mtime;
+ mutable OwnerInfo owner_info;
+ Private *priv = nullptr;
+
+public:
+ Stat() = default;
+ Stat(const Stat &);
+ Stat &operator=(const Stat &);
+ ~Stat();
+
+ FileType get_type() const { return type; }
+ bool is_regular() const { return type==REGULAR; }
+ bool is_directory() const { return type==DIRECTORY; }
+ bool is_symlink() const { return type==SYMLINK; }
+ FileSize get_size() const { return size; }
+ FileSize get_alloc_size() const { return alloc_size; }
+ const Time::TimeStamp &get_modify_time() const { return mtime; }
+ const std::string &get_owner() const;
+ const std::string &get_group() const;
+
+ operator bool() const { return exists; }
+
+ /// Returns a Stat object describing a file.
+ static Stat stat(const Path &);
+ static Stat lstat(const Path &);
+};
+
+/// Convenience wrapper for Stat::stat
+inline Stat stat(const Path &path)
+{ return Stat::stat(path); }
+
+/// Convenience wrapper for Stat::lstat
+inline Stat lstat(const Path &path)
+{ return Stat::lstat(path); }