| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/iprofileiconcache.h`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "iprofile.h"cxx . . $ `<file>/src/core/iprofile.h`/ |
| 7 | #include <filesystem> |
| 8 | #include <functional> |
| 9 | #include <optional> |
| 10 | #include <utility> |
| 11 | #include <vector> |
| 12 | |
| 13 | class IProfileIconCachecxx . . $ IProfileIconCache# |
| 14 | { |
| 15 | public: |
| 16 | /// Initialization method. |
| 17 | virtual void initcxx . . $ IProfileIconCache#init(49f6e7a06ebc5aa8).() = 0; |
| 18 | |
| 19 | /// Tries to use an icon from the cache, caching the fallback icon when no icon |
| 20 | /// was cached. If this also fails, it will try to use the fallback default icon. |
| 21 | /// @param info info of the profile to cache the icon for. His iconURL will be |
| 22 | /// updated on success |
| 23 | /// @param fallbackIcon data of the fallback icon to be cached |
| 24 | /// @returns true on success |
| 25 | virtual bool tryOrCachecxx . . $ IProfileIconCache#tryOrCache(55a8732119d590fe).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# &info, |
| 26 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<char> const &fallbackIcon) = 0; |
| 27 | |
| 28 | /// Adds an icon to the cache, overwriting any previous icon for the profile. |
| 29 | /// If this fails or there is no icon data, it will try to use the fallback |
| 30 | /// default icon. |
| 31 | /// @param info info of the profile to cache the icon for. His iconURL will be |
| 32 | /// updated on success |
| 33 | /// @param iconData data of the icon to be cached |
| 34 | /// @returns true on success |
| 35 | virtual bool cachecxx . . $ IProfileIconCache#cache(55a8732119d590fe).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# &info, stdcxx . . $ std/::vectorcxx . . $ std/vector#<char> const &iconData) = 0; |
| 36 | |
| 37 | /// Syncs the cache icon when necessary. |
| 38 | /// @param info info of the profile whose icon will be synced in the cache |
| 39 | /// @return [success, updated] pair. Updated will be true when a new icon is |
| 40 | /// cached. |
| 41 | virtual stdcxx . . $ std/::paircxx . . $ std/pair#<bool, bool> syncCachecxx . . $ IProfileIconCache#syncCache(2154c7156f3f0c8c).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# &info) = 0; |
| 42 | |
| 43 | /// Cleans the profile cached icon on the cache. |
| 44 | virtual void cleancxx . . $ IProfileIconCache#clean(874cae2a8ac0280d).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# &info) = 0; |
| 45 | |
| 46 | virtual ~cxx . . $ IProfileIconCache#`~IProfileIconCache`(ced63f7c635d850d).IProfileIconCachecxx . . $ IProfileIconCache#() = default; |
| 47 | }; |