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