2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2013, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
15 #include <util/DoublyLinkedList.h>
16 #include <util/OpenHashTable.h>
22 class TeamFileManagerSettings
;
30 status_t
Init(bool targetIsLocal
);
32 bool Lock() { return fLock
.Lock(); }
33 void Unlock() { fLock
.Unlock(); }
35 LocatableFile
* GetTargetFile(const BString
& directory
,
36 const BString
& relativePath
);
37 // returns a reference
38 LocatableFile
* GetTargetFile(const BString
& path
);
39 // returns a reference
40 void TargetEntryLocated(const BString
& path
,
41 const BString
& locatedPath
);
43 LocatableFile
* GetSourceFile(const BString
& directory
,
44 const BString
& relativePath
);
45 // returns a reference
46 LocatableFile
* GetSourceFile(const BString
& path
);
47 // returns a reference
48 status_t
SourceEntryLocated(const BString
& path
,
49 const BString
& locatedPath
);
51 status_t
LoadSourceFile(LocatableFile
* file
,
52 SourceFile
*& _sourceFile
);
53 // returns a reference
55 status_t
LoadLocationMappings(TeamFileManagerSettings
*
57 status_t
SaveLocationMappings(TeamFileManagerSettings
*
62 struct EntryHashDefinition
;
64 struct SourceFileEntry
;
65 struct SourceFileHashDefinition
;
67 typedef BOpenHashTable
<EntryHashDefinition
> LocatableEntryTable
;
68 typedef DoublyLinkedList
<LocatableEntry
> DeadEntryList
;
69 typedef BOpenHashTable
<SourceFileHashDefinition
> SourceFileTable
;
70 typedef std::map
<BString
, BString
> LocatedFileMap
;
72 friend struct SourceFileEntry
;
76 SourceFileEntry
* _LookupSourceFile(const BString
& path
);
77 void _SourceFileUnused(SourceFileEntry
* entry
);
78 bool _LocateFileIfMapped(const BString
& sourcePath
,
83 Domain
* fTargetDomain
;
84 Domain
* fSourceDomain
;
85 SourceFileTable
* fSourceFiles
;
87 LocatedFileMap fSourceLocationMappings
;
92 #endif // FILE_MANAGER_H