1 // Entry.h 2 3 #ifndef ENTRY_H 4 #define ENTRY_H 5 6 #include <fs_interface.h> 7 #include <SupportDefs.h> 8 9 #include "DLList.h" 10 #include "String.h" 11 12 class AllocationInfo; 13 class Directory; 14 class EntryIterator; 15 class Node; 16 17 class Entry : public DLListLinkImpl<Entry> { 18 public: 19 Entry(const char *name, Node *node = NULL, Directory *parent = NULL); 20 ~Entry(); 21 22 status_t InitCheck() const; 23 24 inline void SetParent(Directory *parent) { fParent = parent; } 25 Directory *GetParent() const { return fParent; } 26 27 // inline void SetNode(Node *node) { fNode = node; } 28 status_t Link(Node *node); 29 status_t Unlink(); 30 Node *GetNode() const { return fNode; } 31 32 status_t SetName(const char *newName); 33 inline const char *GetName() const { return fName.GetString(); } 34 35 // inline Volume *GetVolume() const { return fVolume; } 36 37 inline DLListLink<Entry> *GetReferrerLink() { return &fReferrerLink; } 38 39 // entry iterator management 40 void AttachEntryIterator(EntryIterator *iterator); 41 void DetachEntryIterator(EntryIterator *iterator); 42 inline DLList<EntryIterator> *GetEntryIteratorList() 43 { return &fIterators; } 44 45 // debugging 46 void GetAllocationInfo(AllocationInfo &info); 47 48 private: 49 Directory *fParent; 50 Node *fNode; 51 String fName; 52 DLListLink<Entry> fReferrerLink; 53 // iterator management 54 DLList<EntryIterator> fIterators; 55 }; 56 57 // GetNodeReferrerLink 58 class GetNodeReferrerLink { 59 private: 60 typedef DLListLink<Entry> Link; 61 62 public: 63 inline Link *operator()(Entry *entry) const 64 { 65 return entry->GetReferrerLink(); 66 } 67 }; 68 69 #endif // ENTRY_H 70