1/* 2 * Copyright 2002-2014 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 15struct node_ref; 16struct stat_beos; 17class BVolume; 18 19 20class BStatable { 21public: 22#if __GNUC__ > 3 23 virtual ~BStatable(); 24#endif 25 26private: 27 virtual status_t _GetStat(struct stat_beos* stat) const = 0; 28 // provided for BeOS compatibility 29 30public: 31 virtual status_t GetStat(struct stat* stat) const = 0; 32 33 bool IsFile() const; 34 bool IsDirectory() const; 35 bool IsSymLink() const; 36 37 status_t GetNodeRef(node_ref* ref) const; 38 39 status_t GetOwner(uid_t* owner) const; 40 status_t SetOwner(uid_t owner); 41 42 status_t GetGroup(gid_t* group) const; 43 status_t SetGroup(gid_t group); 44 45 status_t GetPermissions(mode_t* permissions) const; 46 status_t SetPermissions(mode_t permissions); 47 48 status_t GetSize(off_t* size) const; 49 50 status_t GetModificationTime(time_t* mtime) const; 51 status_t SetModificationTime(time_t mtime); 52 53 status_t GetCreationTime(time_t* ctime) const; 54 status_t SetCreationTime(time_t ctime); 55 56 status_t GetAccessTime(time_t* atime) const; 57 status_t SetAccessTime(time_t atime); 58 59 status_t GetVolume(BVolume* volume) const; 60 61 class Private; 62 63private: 64 friend class BEntry; 65 friend class BNode; 66 friend class Private; 67 68 virtual void _OhSoStatable2(); 69 virtual void _OhSoStatable3(); 70 uint32 _reserved[4]; 71 72 virtual status_t set_stat(struct stat &st, uint32 what) = 0; 73}; 74 75#endif // _STATABLE_H 76