1 /* 2 * Copyright 2002-2007, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _STATABLE_H 6 #define _STATABLE_H 7 8 9 #include <SupportDefs.h> 10 11 #include <sys/types.h> 12 #include <sys/stat.h> 13 14 struct node_ref; 15 class BVolume; 16 17 18 class BStatable { 19 public: 20 #if __GNUC__ > 3 21 virtual ~BStatable(); 22 #endif 23 24 virtual status_t GetStat(struct stat *st) const = 0; 25 26 bool IsFile() const; 27 bool IsDirectory() const; 28 bool IsSymLink() const; 29 30 status_t GetNodeRef(node_ref *ref) const; 31 32 status_t GetOwner(uid_t *owner) const; 33 status_t SetOwner(uid_t owner); 34 35 status_t GetGroup(gid_t *group) const; 36 status_t SetGroup(gid_t group); 37 38 status_t GetPermissions(mode_t *perms) const; 39 status_t SetPermissions(mode_t perms); 40 41 status_t GetSize(off_t *size) const; 42 43 status_t GetModificationTime(time_t *mtime) const; 44 status_t SetModificationTime(time_t mtime); 45 46 status_t GetCreationTime(time_t *ctime) const; 47 status_t SetCreationTime(time_t ctime); 48 49 status_t GetAccessTime(time_t *atime) const; 50 status_t SetAccessTime(time_t atime); 51 52 status_t GetVolume(BVolume *vol) const; 53 54 private: 55 friend class BEntry; 56 friend class BNode; 57 58 virtual void _OhSoStatable1(); 59 virtual void _OhSoStatable2(); 60 virtual void _OhSoStatable3(); 61 uint32 _reserved[4]; 62 63 virtual status_t set_stat(struct stat &st, uint32 what) = 0; 64 }; 65 66 #endif // _STATABLE_H 67