mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-27 10:02:03 +00:00
3599a831b1
Only the initialize request uses it so far, but this will enable pulling quite a bit of code out of command_line.cc.
23 lines
670 B
C++
23 lines
670 B
C++
#pragma once
|
|
|
|
#include "config.h"
|
|
|
|
#include <unordered_map>
|
|
|
|
// Manages loading caches from file paths for the indexer process.
|
|
struct CacheLoader {
|
|
explicit CacheLoader(Config* config);
|
|
|
|
IndexFile* TryLoad(const std::string& path);
|
|
|
|
// Takes the existing cache or loads the cache at |path|. May return nullptr
|
|
// if the cache does not exist.
|
|
std::unique_ptr<IndexFile> TryTakeOrLoad(const std::string& path);
|
|
|
|
// Takes the existing cache or loads the cache at |path|. Asserts the cache
|
|
// exists.
|
|
std::unique_ptr<IndexFile> TakeOrLoad(const std::string& path);
|
|
|
|
std::unordered_map<std::string, std::unique_ptr<IndexFile>> caches;
|
|
Config* config_;
|
|
}; |