BEntryOperationEngineBase::Entry: Add node_ref+path c'tor

This commit is contained in:
Ingo Weinhold 2014-06-10 21:14:27 +02:00
parent d44d8207a8
commit 9680cf0bce
2 changed files with 31 additions and 6 deletions

View File

@ -17,6 +17,7 @@ class BEntry;
class BPath;
struct entry_ref;
struct node_ref;
namespace BPrivate {
@ -35,6 +36,8 @@ public:
const char* path = NULL);
Entry(const BEntry& entry);
Entry(const entry_ref& entryRef);
Entry(const node_ref& directoryRef,
const char* path = NULL);
~Entry();
status_t GetPath(BPath& buffer, const char*& _path)
@ -46,6 +49,7 @@ private:
const char* fPath;
const BEntry* fEntry;
const entry_ref* fEntryRef;
const node_ref* fDirectoryRef;
};

View File

@ -19,18 +19,20 @@ BEntryOperationEngineBase::Entry::Entry(const char* path)
fDirectory(NULL),
fPath(path),
fEntry(NULL),
fEntryRef(NULL)
fEntryRef(NULL),
fDirectoryRef(NULL)
{
}
BEntryOperationEngineBase::Entry::Entry(const BDirectory& directory, const char* path)
BEntryOperationEngineBase::Entry::Entry(const BDirectory& directory,
const char* path)
:
fDirectory(&directory),
fPath(path),
fEntry(NULL),
fEntryRef(NULL)
fEntryRef(NULL),
fDirectoryRef(NULL)
{
}
@ -40,7 +42,8 @@ BEntryOperationEngineBase::Entry::Entry(const BEntry& entry)
fDirectory(NULL),
fPath(NULL),
fEntry(&entry),
fEntryRef(NULL)
fEntryRef(NULL),
fDirectoryRef(NULL)
{
}
@ -50,7 +53,20 @@ BEntryOperationEngineBase::Entry::Entry(const entry_ref& entryRef)
fDirectory(NULL),
fPath(NULL),
fEntry(NULL),
fEntryRef(&entryRef)
fEntryRef(&entryRef),
fDirectoryRef(NULL)
{
}
BEntryOperationEngineBase::Entry::Entry(const node_ref& directoryRef,
const char* path)
:
fDirectory(NULL),
fPath(path),
fEntry(NULL),
fEntryRef(NULL),
fDirectoryRef(&directoryRef)
{
}
@ -72,6 +88,11 @@ BEntryOperationEngineBase::Entry::GetPath(BPath& buffer, const char*& _path)
error = buffer.SetTo(fDirectory, fPath);
} else if (fEntryRef != NULL) {
error = buffer.SetTo(fEntryRef);
} else if (fDirectoryRef != NULL) {
BDirectory directory;
error = directory.SetTo(fDirectoryRef);
if (error == B_OK)
error = buffer.SetTo(&directory, fPath);
} else if (fPath != NULL) {
_path = fPath;
return B_OK;