1// Entry.cpp 2 3#include "Entry.h" 4 5#include "Directory.h" 6#include "FDManager.h" 7#include "Path.h" 8#include "Volume.h" 9#include "VolumeManager.h" 10 11// #pragma mark - 12 13// Entry 14 15// constructor 16Entry::Entry(Volume* volume, Directory* directory, const char* name, Node* node) 17 : fVolume(volume), 18 fDirectory(directory), 19 fName(name), 20 fNode(node), 21 fDirEntryLink() 22{ 23} 24 25// destructor 26Entry::~Entry() 27{ 28} 29 30// InitCheck 31status_t 32Entry::InitCheck() const 33{ 34 return (fName.GetLength() > 0 ? B_OK : B_NO_MEMORY); 35} 36 37// GetVolume 38Volume* 39Entry::GetVolume() const 40{ 41 return fVolume; 42} 43 44// GetDirectory 45Directory* 46Entry::GetDirectory() const 47{ 48 return fDirectory; 49} 50 51// GetEntryRef 52NoAllocEntryRef 53Entry::GetEntryRef() const 54{ 55 return NoAllocEntryRef(fVolume->GetID(), fDirectory->GetID(), 56 fName.GetString()); 57} 58 59// GetVolumeID 60dev_t 61Entry::GetVolumeID() const 62{ 63 return fVolume->GetID(); 64} 65 66// GetDirectoryID 67ino_t 68Entry::GetDirectoryID() const 69{ 70 return fDirectory->GetID(); 71} 72 73// GetName 74const char* 75Entry::GetName() const 76{ 77 return fName.GetString(); 78} 79 80// GetNode 81Node* 82Entry::GetNode() const 83{ 84 return fNode; 85} 86 87// GetPath 88status_t 89Entry::GetPath(Path* path) 90{ 91 return VolumeManager::GetDefault()->GetPath(this, path); 92} 93 94// Exists 95bool 96Entry::Exists() const 97{ 98 NoAllocEntryRef entryRef(GetEntryRef()); 99 BEntry bEntry; 100 return (FDManager::SetEntry(&bEntry, &entryRef) == B_OK && bEntry.Exists()); 101} 102 103// IsActualEntry 104bool 105Entry::IsActualEntry() const 106{ 107 return (fName.GetLength() > 0 && fName != "." && fName != ".."); 108} 109