#define MSP_FS_STAT_H_
#include <string>
+#include <msp/core/inttypes.h>
#include <msp/time/timestamp.h>
#include "path.h"
SYMLINK
};
-#ifdef MSVC
-typedef __uint64 FileSize;
-#else
-typedef unsigned long long FileSize;
-#endif
+typedef UInt64 FileSize;
/**
Holds file information.
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; }
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 &);