5#include "gui/dsp/plugin_descriptor.h"
6#include "utils/serialization.h"
14namespace zrythm::gui::old_dsp::plugins
29 static std::unique_ptr<CachedPluginDescriptors>
read_or_new ();
50 z_warning (e.what ());
54 static constexpr int get_format_major_version () {
return 6; }
55 static constexpr int get_format_minor_version () {
return 0; }
56 static constexpr auto get_document_type ()
58 return "CachedPluginDescriptors"sv;
69 std::vector<std::unique_ptr<PluginDescriptor>>
78 contains_sha1 (std::string_view sha1,
bool check_valid,
bool check_blacklisted);
80 bool contains_valid_sha1 (
auto sha1)
85 bool contains_blacklisted_sha1 (
auto sha1)
95 void blacklist (std::string_view sha1,
bool serialize);
110 static constexpr auto kDescriptorsKey =
"descriptors"sv;
111 static constexpr auto kBlacklistedSha1sKey =
"blacklistedSha1s"sv;
117 { utils::serialization::kDocumentTypeKey, get_document_type () },
118 { utils::serialization::kFormatMajorKey, get_format_major_version () },
119 { utils::serialization::kFormatMinorKey, get_format_minor_version () },
124 friend void from_json (
const nlohmann::json &j, CachedPluginDescriptors &p);
131 static void delete_file ();
133 static fs::path get_file_path ();
Descriptors to be cached.
std::vector< std::unique_ptr< PluginDescriptor > > descriptors_
Valid descriptors.
std::vector< std::unique_ptr< PluginDescriptor > > get_valid_descriptors_for_sha1(std::string_view sha1)
Returns found non-blacklisted descriptors.
void serialize_to_file()
Serializes the cached descriptors to the standard file.
void serialize_to_file_no_throw()
Wrapper over serialize_to_file that ignores exceptions.
static std::unique_ptr< CachedPluginDescriptors > read_or_new()
Returns a new instance with the cache pre-filled from the cache file, or an empty instance if there i...
std::vector< std::string > blacklisted_sha1s_
Blacklisted hashes, to skip when scanning.
bool contains_sha1(std::string_view sha1, bool check_valid, bool check_blacklisted)
Returns whether the given sha1 is in the cache.
void add(const PluginDescriptor &descr, bool serialize)
Appends a descriptor to the cache.
void blacklist(std::string_view sha1, bool serialize)
Appends a descriptor to the cache.
void clear()
Clears the descriptors and removes the cache file.
bool is_blacklisted(std::string_view sha1)
Returns if the plugin with the given sha1 is blacklisted or not.
The PluginDescriptor class provides a set of static utility functions and member functions to work wi...
Base class for exceptions in Zrythm.