diff options
Diffstat (limited to 'src/libs/clangsupport/filepathcaching.h')
-rw-r--r-- | src/libs/clangsupport/filepathcaching.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/libs/clangsupport/filepathcaching.h b/src/libs/clangsupport/filepathcaching.h index f69b940b15..1ca6522752 100644 --- a/src/libs/clangsupport/filepathcaching.h +++ b/src/libs/clangsupport/filepathcaching.h @@ -40,9 +40,11 @@ namespace ClangBackEnd { class CLANGSUPPORT_EXPORT FilePathCaching final : public FilePathCachingInterface { + friend class CopyableFilePathCaching; using Factory = FilePathStorageSqliteStatementFactory<Sqlite::Database>; using Storage = FilePathStorage<Factory>; using Cache = FilePathCache<Storage>; + public: FilePathCaching(Sqlite::Database &database) : m_factory(database) @@ -60,4 +62,25 @@ private: Cache m_cache{m_storage}; }; +class CLANGSUPPORT_EXPORT CopyableFilePathCaching final : public FilePathCachingInterface +{ + using Factory = FilePathStorageSqliteStatementFactory<Sqlite::Database>; + using Storage = FilePathStorage<Factory>; + using Cache = FilePathCache<Storage>; + +public: + CopyableFilePathCaching(FilePathCaching &cache) + : m_cache(cache.m_cache.clone()) + {} + + FilePathId filePathId(FilePathView filePath) const override; + FilePath filePath(FilePathId filePathId) const override; + DirectoryPathId directoryPathId(Utils::SmallStringView directoryPath) const override; + Utils::PathString directoryPath(DirectoryPathId directoryPathId) const override; + DirectoryPathId directoryPathId(FilePathId filePathId) const override; + +private: + Cache m_cache; +}; + } // namespace ClangBackEnd |