1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
4 //---------------------------------------------------------------------
7 BDirectory interface declaration.
14 #include <EntryList.h>
15 #include <StorageDefs.h>
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>
32 class BDirectory
: public BNode
, public BEntryList
{
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
,
73 BDirectory
&operator=(const BDirectory
&dir
);
78 virtual void _ErectorDirectory1();
79 virtual void _ErectorDirectory2();
80 virtual void _ErectorDirectory3();
81 virtual void _ErectorDirectory4();
82 virtual void _ErectorDirectory5();
83 virtual void _ErectorDirectory6();
86 virtual void close_fd();
89 status_t
set_dir_fd(int fd
);
92 uint32 _reservedData
[7];
103 status_t
create_directory(const char *path
, mode_t mode
);
106 #endif // _DIRECTORY_H