2 * Copyright 2002-2006, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
10 #include <EntryList.h>
11 #include <StorageDefs.h>
19 class BDirectory
: public BNode
, public BEntryList
{
22 BDirectory(const BDirectory
&dir
);
23 BDirectory(const entry_ref
*ref
);
24 BDirectory(const node_ref
*nref
);
25 BDirectory(const BEntry
*entry
);
26 BDirectory(const char *path
);
27 BDirectory(const BDirectory
*dir
, const char *path
);
29 virtual ~BDirectory();
31 status_t
SetTo(const entry_ref
*ref
);
32 status_t
SetTo(const node_ref
*nref
);
33 status_t
SetTo(const BEntry
*entry
);
34 status_t
SetTo(const char *path
);
35 status_t
SetTo(const BDirectory
*dir
, const char *path
);
37 status_t
GetEntry(BEntry
*entry
) const;
39 bool IsRootDirectory() const;
41 status_t
FindEntry(const char *path
, BEntry
*entry
,
42 bool traverse
= false) const;
44 bool Contains(const char *path
, int32 nodeFlags
= B_ANY_NODE
) const;
45 bool Contains(const BEntry
*entry
, int32 nodeFlags
= B_ANY_NODE
) const;
47 status_t
GetStatFor(const char *path
, struct stat
*st
) const;
49 virtual status_t
GetNextEntry(BEntry
*entry
, bool traverse
= false);
50 virtual status_t
GetNextRef(entry_ref
*ref
);
51 virtual int32
GetNextDirents(dirent
*buf
, size_t bufSize
,
52 int32 count
= INT_MAX
);
53 virtual status_t
Rewind();
54 virtual int32
CountEntries();
56 status_t
CreateDirectory(const char *path
, BDirectory
*dir
);
57 status_t
CreateFile(const char *path
, BFile
*file
,
58 bool failIfExists
= false);
59 status_t
CreateSymLink(const char *path
, const char *linkToPath
,
62 BDirectory
&operator=(const BDirectory
&dir
);
69 status_t
_GetStatFor(const char *path
, struct stat
*st
) const;
70 status_t
_GetStatFor(const char *path
, struct stat_beos
*st
) const;
72 virtual void _ErectorDirectory1();
73 virtual void _ErectorDirectory2();
74 virtual void _ErectorDirectory3();
75 virtual void _ErectorDirectory4();
76 virtual void _ErectorDirectory5();
77 virtual void _ErectorDirectory6();
80 virtual void close_fd();
84 uint32 _reservedData
[7];
88 status_t
create_directory(const char *path
, mode_t mode
);
90 #endif // _DIRECTORY_H