30ENUM(IntegrationItem, ENTRY, MIMETYPE, ICON);
37 std::set<IntegrationItem> m_set_integrations;
38 std::set<std::string> m_set_categories;
41 [[maybe_unused]] std::string
const& get_name()
const {
return m_name; }
42 [[maybe_unused]]
Value<fs::path> const& get_path_file_icon()
const {
return m_path_file_icon; }
43 [[maybe_unused]] std::set<IntegrationItem>
const& get_integrations()
const {
return m_set_integrations; }
44 [[maybe_unused]] std::set<std::string>
const& get_categories()
const {
return m_set_categories; }
45 [[maybe_unused]]
void set_name(std::string_view str_name) { m_name = str_name; }
46 [[maybe_unused]]
void set_integrations(std::set<IntegrationItem>
const& set_integrations) { m_set_integrations = set_integrations; }
47 [[maybe_unused]]
void set_categories(std::set<std::string>
const& set_categories) { m_set_categories = set_categories; }
58 , m_path_file_icon(std::unexpected(
"m_path_file_icon is undefined"))
59 , m_set_integrations()
72 return_if(str_raw_json.empty(), Error(
"W::Empty json data"));
76 desktop.m_name = Pop(db(
"name").
template value<std::string>());
78 desktop.m_path_file_icon = db(
"icon").template value<std::string>();
80 for(
auto&& item : db(
"integrations").value<std::vector<std::string>>().or_default())
82 desktop.m_set_integrations.insert(Pop(IntegrationItem::from_string(item)));
85 auto db_categories = Pop(db(
"categories").
template value<std::vector<std::string>>());
86 std::ranges::for_each(db_categories, [&](
auto&& e){ desktop.m_set_categories.insert(e); });
99 ss << stream_raw_json.rdbuf();
112 db(
"name") = desktop.m_name;
113 db(
"integrations") = desktop.m_set_integrations;
114 if (desktop.m_path_file_icon)
116 db(
"icon") = Pop(desktop.m_path_file_icon);
118 db(
"categories") = desktop.m_set_categories;
A type-safe wrapper around nlohmann::json for database operations.
friend Value< std::string > serialize(Desktop const &desktop) noexcept
Serializes a Desktop class into a json string.
Desktop()
Construct a new Desktop:: Desktop object.
friend Value< Desktop > deserialize(std::string_view raw_json) noexcept
Deserializes JSON string into a Binds object.
A database that interfaces with nlohmann json.
Custom enumeration class.
Enhanced error handling framework built on std::expected.
Desktop integration configuration management.
Value< std::string > serialize(Desktop const &desktop) noexcept
Serializes a Desktop class into a json string.
Value< Desktop > deserialize(std::string_view str_raw_json) noexcept
Deserializes a string into a Desktop class.
Value< Db > from_string(S &&s)
Parses a JSON string and creates a Db object.
Enhanced expected type with integrated logging capabilities.