X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Ffs%2Fstat.h;h=8c05771ebe9b85bd27b42fb4e674a4b1a1f5d2b4;hp=0d5f6de184b6f7a725e648119172573125799375;hb=df74f89b175c1579f9383e6dec8ddb821e606642;hpb=e240e074ce15c17d644e378067c2941aefcd5611 diff --git a/source/fs/stat.h b/source/fs/stat.h index 0d5f6de..8c05771 100644 --- a/source/fs/stat.h +++ b/source/fs/stat.h @@ -30,15 +30,26 @@ class Stat private: struct Private; + struct OwnerInfo + { + std::string owner; + std::string group; + }; + + bool exists; FileType type; FileSize size; FileSize alloc_size; Time::TimeStamp mtime; - std::string owner; - std::string group; + mutable OwnerInfo owner_info; + Private *priv; - Stat(); public: + Stat(); + 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; } @@ -46,8 +57,10 @@ public: 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 { return owner; } - const std::string &get_group() const { return group; } + 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 &);