#ifndef _NOT_OWNING_ENTRY_REF_H
#define _NOT_OWNING_ENTRY_REF_H
#include <Entry.h>
#include <Node.h>
namespace BPrivate {
class NotOwningEntryRef : public entry_ref {
public:
NotOwningEntryRef()
{
}
NotOwningEntryRef(dev_t device, ino_t directory, const char* name)
{
SetTo(device, directory, name);
}
NotOwningEntryRef(const node_ref& directoryRef, const char* name)
{
SetTo(directoryRef, name);
}
NotOwningEntryRef(const entry_ref& other)
{
*this = other;
}
~NotOwningEntryRef()
{
name = NULL;
}
NotOwningEntryRef& SetTo(dev_t device, ino_t directory, const char* name)
{
this->device = device;
this->directory = directory;
this->name = const_cast<char*>(name);
return *this;
}
NotOwningEntryRef& SetTo(const node_ref& directoryRef, const char* name)
{
return SetTo(directoryRef.device, directoryRef.node, name);
}
node_ref DirectoryNodeRef() const
{
return node_ref(device, directory);
}
NotOwningEntryRef& SetDirectoryNodeRef(const node_ref& directoryRef)
{
device = directoryRef.device;
directory = directoryRef.node;
return *this;
}
NotOwningEntryRef& operator=(const entry_ref& other)
{
return SetTo(other.device, other.directory, other.name);
}
};
}
using ::BPrivate::NotOwningEntryRef;
#endif