2 * Copyright 2013, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Ingo Weinhold <ingo_weinhold@gmx.de>
8 #ifndef _MERGED_DIRECTORY_H
9 #define _MERGED_DIRECTORY_H
12 #include <EntryList.h>
13 #include <ObjectList.h>
19 class BMergedDirectory
: public BEntryList
{
21 // policy how to handle equally named entries in different
31 BPolicy policy
= B_ALWAYS_FIRST
);
32 virtual ~BMergedDirectory();
36 BPolicy
Policy() const;
37 void SetPolicy(BPolicy policy
);
39 status_t
AddDirectory(BDirectory
* directory
);
40 status_t
AddDirectory(const char* path
);
42 virtual status_t
GetNextEntry(BEntry
* entry
,
43 bool traverse
= false);
44 virtual status_t
GetNextRef(entry_ref
* ref
);
45 virtual int32
GetNextDirents(struct dirent
* direntBuffer
,
47 int32 maxEntries
= INT_MAX
);
48 virtual status_t
Rewind();
49 virtual int32
CountEntries();
52 virtual bool ShallPreferFirstEntry(const entry_ref
& entry1
,
53 int32 index1
, const entry_ref
& entry2
,
55 // always invoked with index1 < index2
58 typedef BObjectList
<BDirectory
> DirectoryList
;
62 void _FindBestEntry(dirent
* direntBuffer
);
65 DirectoryList fDirectories
;
67 int32 fDirectoryIndex
;
68 EntryNameSet
* fVisitedEntries
;
72 #endif // _MERGED_DIRECTORY_H