2006-06-21 17:49:16 +04:00
|
|
|
/*
|
2007-05-04 20:59:23 +04:00
|
|
|
* Copyright 2002-2007, Haiku, Inc. All Rights Reserved.
|
2006-06-21 17:49:16 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2002-08-12 11:24:02 +04:00
|
|
|
#ifndef _STATABLE_H
|
|
|
|
#define _STATABLE_H
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2002-07-09 16:24:59 +04:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/stat.h>
|
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
struct node_ref;
|
|
|
|
class BVolume;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
|
|
|
|
class BStatable {
|
2006-06-21 17:49:16 +04:00
|
|
|
public:
|
2007-05-05 09:46:08 +04:00
|
|
|
#if __GNUC__ > 3
|
2007-05-04 20:59:23 +04:00
|
|
|
virtual ~BStatable();
|
2007-05-05 09:46:08 +04:00
|
|
|
#endif
|
2007-05-04 20:59:23 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
virtual status_t GetStat(struct stat *st) const = 0;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
bool IsFile() const;
|
|
|
|
bool IsDirectory() const;
|
|
|
|
bool IsSymLink() const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetNodeRef(node_ref *ref) const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetOwner(uid_t *owner) const;
|
|
|
|
status_t SetOwner(uid_t owner);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetGroup(gid_t *group) const;
|
|
|
|
status_t SetGroup(gid_t group);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetPermissions(mode_t *perms) const;
|
|
|
|
status_t SetPermissions(mode_t perms);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetSize(off_t *size) const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetModificationTime(time_t *mtime) const;
|
|
|
|
status_t SetModificationTime(time_t mtime);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetCreationTime(time_t *ctime) const;
|
|
|
|
status_t SetCreationTime(time_t ctime);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetAccessTime(time_t *atime) const;
|
|
|
|
status_t SetAccessTime(time_t atime);
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
status_t GetVolume(BVolume *vol) const;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
private:
|
|
|
|
friend class BEntry;
|
|
|
|
friend class BNode;
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
virtual void _OhSoStatable1();
|
|
|
|
virtual void _OhSoStatable2();
|
|
|
|
virtual void _OhSoStatable3();
|
|
|
|
uint32 _reserved[4];
|
2002-07-09 16:24:59 +04:00
|
|
|
|
2006-06-21 17:49:16 +04:00
|
|
|
virtual status_t set_stat(struct stat &st, uint32 what) = 0;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
2002-08-12 11:24:02 +04:00
|
|
|
#endif // _STATABLE_H
|