5#include <nlohmann/json.hpp>
48std::filesystem::path
odCacheDirectory(
const std::filesystem::path& data_dir);
62std::filesystem::path
odCacheFilePath(
const std::filesystem::path& data_dir,
73 nlohmann::json entries);
92 std::vector<std::filesystem::path>
deleted;
94 std::vector<std::pair<std::filesystem::path, std::string>>
failed;
std::string sanitizeFirmwareVersion(std::string_view version)
Reduces a firmware version to the characters a file name may hold.
Definition od_cache.cc:62
std::string trimObjectString(std::string_view raw)
Removes the padding of a string read from the object dictionary.
Definition od_cache.cc:74
constexpr int kOdCacheFormatVersion
Definition od_cache.h:12
std::filesystem::path odCacheDirectory(const std::filesystem::path &data_dir)
The folder of the object dictionary cache: <data-dir>/od-cache.
Definition od_cache.cc:83
std::filesystem::path odCacheFilePath(const std::filesystem::path &data_dir, const OdCacheIdentity &identity)
Returns the path of the object dictionary cache file of a device.
Definition od_cache.cc:87
nlohmann::json makeOdCacheDocument(const OdCacheIdentity &identity, nlohmann::json entries)
Builds the content of a cache file.
Definition od_cache.cc:95
OdCacheClearResult clearOdCache(const std::filesystem::path &data_dir)
Deletes every object dictionary cache file in the data directory.
Definition od_cache.cc:117
bool odCacheDocumentMatches(const nlohmann::json &document, const OdCacheIdentity &identity)
Tells whether a cache file applies to a device.
Definition od_cache.cc:104
The outcome of clearOdCache().
Definition od_cache.h:90
std::vector< std::pair< std::filesystem::path, std::string > > failed
The cache files that could not be deleted, each with the reason.
Definition od_cache.h:94
std::vector< std::filesystem::path > deleted
The cache files that were deleted.
Definition od_cache.h:92
uint32_t product_code
Definition od_cache.h:19
uint32_t vendor_id
Definition od_cache.h:18
std::string firmware_version
Definition od_cache.h:20