1 // Directory.h 2 3 #ifndef DIRECTORY_H 4 #define DIRECTORY_H 5 6 #include <util/DoublyLinkedList.h> 7 8 #include "Node.h" 9 10 11 class Entry; 12 class File; 13 class SymLink; 14 15 class Directory : public Node { 16 public: 17 Directory(Volume *volume); 18 virtual ~Directory(); 19 20 virtual status_t Link(Entry *entry); 21 virtual status_t Unlink(Entry *entry); 22 23 virtual status_t SetSize(off_t newSize); 24 virtual off_t GetSize() const; 25 26 Directory *GetParent() const; 27 28 status_t CreateDirectory(const char *name, Directory **directory); 29 status_t CreateFile(const char *name, File **file); 30 status_t CreateSymLink(const char *name, const char *path, 31 SymLink **symLink); 32 33 bool IsEmpty() const { return fEntries.IsEmpty(); } 34 35 status_t AddEntry(Entry *entry); 36 status_t CreateEntry(Node *node, const char *name, Entry **entry = NULL); 37 status_t RemoveEntry(Entry *entry); 38 status_t DeleteEntry(Entry *entry); 39 40 status_t FindEntry(const char *name, Entry **entry) const; 41 status_t FindNode(const char *name, Node **node) const; 42 status_t FindAndGetNode(const char *name, Node **node, 43 Entry **entry = NULL) const; 44 45 status_t GetPreviousEntry(Entry **entry) const; 46 status_t GetNextEntry(Entry **entry) const; 47 48 // debugging 49 virtual void GetAllocationInfo(AllocationInfo &info); 50 51 private: 52 status_t _CreateCommon(Node *node, const char *name); 53 54 private: 55 DoublyLinkedList<Entry> fEntries; 56 }; 57 58 #endif // DIRECTORY_H 59