Restore the "GPL licensing not permitted" in GLUT license headers.
[haiku.git] / headers / build / os / storage / Directory.h
blob73ce37cddc5e16216d94366de0f006b823c82699
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the MIT License.
4 //---------------------------------------------------------------------
5 /*!
6 \file Directory.h
7 BDirectory interface declaration.
8 */
10 #ifndef _DIRECTORY_H
11 #define _DIRECTORY_H
13 #include <Node.h>
14 #include <EntryList.h>
15 #include <StorageDefs.h>
18 class BFile;
19 class BSymLink;
21 /*!
22 \class BDirectory
23 \brief A directory in the filesystem
25 Provides an interface for manipulating directories and their contents.
27 \author <a href='mailto:bonefish@users.sf.net'>Ingo Weinhold</a>
28 \author <a href="mailto:tylerdauwalder@users.sf.net">Tyler Dauwalder</a>
30 \version 0.0.0
32 class BDirectory : public BNode, public BEntryList {
33 public:
34 BDirectory();
35 BDirectory(const BDirectory &dir);
36 BDirectory(const entry_ref *ref);
37 BDirectory(const node_ref *nref);
38 BDirectory(const BEntry *entry);
39 BDirectory(const char *path);
40 BDirectory(const BDirectory *dir, const char *path);
42 virtual ~BDirectory();
44 status_t SetTo(const entry_ref *ref);
45 status_t SetTo(const node_ref *nref);
46 status_t SetTo(const BEntry *entry);
47 status_t SetTo(const char *path);
48 status_t SetTo(const BDirectory *dir, const char *path);
50 status_t GetEntry(BEntry *entry) const;
52 status_t FindEntry(const char *path, BEntry *entry,
53 bool traverse = false) const;
55 bool Contains(const char *path, int32 nodeFlags = B_ANY_NODE) const;
56 bool Contains(const BEntry *entry, int32 nodeFlags = B_ANY_NODE) const;
58 status_t GetStatFor(const char *path, struct stat *st) const;
60 virtual status_t GetNextEntry(BEntry *entry, bool traverse = false);
61 virtual status_t GetNextRef(entry_ref *ref);
62 virtual int32 GetNextDirents(dirent *buf, size_t bufSize,
63 int32 count = INT_MAX);
64 virtual status_t Rewind();
65 virtual int32 CountEntries();
67 status_t CreateDirectory(const char *path, BDirectory *dir);
68 status_t CreateFile(const char *path, BFile *file,
69 bool failIfExists = false);
70 status_t CreateSymLink(const char *path, const char *linkToPath,
71 BSymLink *link);
73 BDirectory &operator=(const BDirectory &dir);
75 private:
76 friend class BNode;
78 virtual void _ErectorDirectory1();
79 virtual void _ErectorDirectory2();
80 virtual void _ErectorDirectory3();
81 virtual void _ErectorDirectory4();
82 virtual void _ErectorDirectory5();
83 virtual void _ErectorDirectory6();
85 private:
86 virtual void close_fd();
87 int get_fd() const;
89 status_t set_dir_fd(int fd);
91 private:
92 uint32 _reservedData[7];
93 int fDirFd;
94 node_ref fDirNodeRef;
96 friend class BEntry;
97 friend class BFile;
101 // C functions
103 status_t create_directory(const char *path, mode_t mode);
106 #endif // _DIRECTORY_H