2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
5 #ifndef LOCATABLE_ENTRY_H
6 #define LOCATABLE_ENTRY_H
10 #include <Referenceable.h>
11 #include <util/DoublyLinkedList.h>
12 #include <util/OpenHashTable.h>
15 enum locatable_entry_state
{
16 LOCATABLE_ENTRY_UNLOCATED
,
17 LOCATABLE_ENTRY_LOCATED_IMPLICITLY
,
18 LOCATABLE_ENTRY_LOCATED_EXPLICITLY
22 class LocatableDirectory
;
26 class LocatableEntryOwner
{
28 virtual ~LocatableEntryOwner();
30 virtual bool Lock() = 0;
31 virtual void Unlock() = 0;
33 virtual void LocatableEntryUnused(LocatableEntry
* entry
) = 0;
37 class LocatableEntry
: public BReferenceable
,
38 public DoublyLinkedListLinkImpl
<LocatableEntry
> {
40 LocatableEntry(LocatableEntryOwner
* owner
,
41 LocatableDirectory
* parent
);
44 LocatableDirectory
* Parent() const { return fParent
; }
45 virtual const char* Name() const = 0;
47 // mutable (requires locking)
48 locatable_entry_state
State() const { return fState
; }
49 virtual bool GetLocatedPath(BString
& _path
) const = 0;
50 virtual void SetLocatedPath(const BString
& path
,
54 virtual void LastReferenceReleased();
57 LocatableEntryOwner
* fOwner
;
58 LocatableDirectory
* fParent
;
59 locatable_entry_state fState
;
62 LocatableEntry
* fNext
;
66 typedef DoublyLinkedList
<LocatableEntry
> LocatableEntryList
;
69 #endif // LOCATABLE_ENTRY_H