xref: /haiku/headers/os/storage/Statable.h (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 /*
2  * Copyright 2002-2006, 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 		virtual status_t GetStat(struct stat *st) const = 0;
21 
22 		bool IsFile() const;
23 		bool IsDirectory() const;
24 		bool IsSymLink() const;
25 
26 		status_t GetNodeRef(node_ref *ref) const;
27 
28 		status_t GetOwner(uid_t *owner) const;
29 		status_t SetOwner(uid_t owner);
30 
31 		status_t GetGroup(gid_t *group) const;
32 		status_t SetGroup(gid_t group);
33 
34 		status_t GetPermissions(mode_t *perms) const;
35 		status_t SetPermissions(mode_t perms);
36 
37 		status_t GetSize(off_t *size) const;
38 
39 		status_t GetModificationTime(time_t *mtime) const;
40 		status_t SetModificationTime(time_t mtime);
41 
42 		status_t GetCreationTime(time_t *ctime) const;
43 		status_t SetCreationTime(time_t ctime);
44 
45 		status_t GetAccessTime(time_t *atime) const;
46 		status_t SetAccessTime(time_t atime);
47 
48 		status_t GetVolume(BVolume *vol) const;
49 
50 	private:
51 		friend class BEntry;
52 		friend class BNode;
53 
54 		virtual	void _OhSoStatable1();
55 		virtual	void _OhSoStatable2();
56 		virtual	void _OhSoStatable3();
57 		uint32 _reserved[4];
58 
59 		virtual	status_t set_stat(struct stat &st, uint32 what) = 0;
60 };
61 
62 #endif // _STATABLE_H
63