| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/ifilecache.h`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include <filesystem> |
| 7 | #include <optional> |
| 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
| 11 | class IFileCachecxx . . $ IFileCache# |
| 12 | { |
| 13 | public: |
| 14 | /// Initializes the file chache. |
| 15 | virtual void initcxx . . $ IFileCache#init(49f6e7a06ebc5aa8).() = 0; |
| 16 | |
| 17 | /// Adds an existing file to the cache. |
| 18 | /// @param path to the file to be cached |
| 19 | /// @param name target name for the cached file |
| 20 | /// @return path to the cached file when succeed |
| 21 | virtual stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path#> |
| 22 | addcxx . . $ IFileCache#add(efab1f07c9a586fc).(stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path, stdcxx . . $ std/::stringcxx . . $ std/string# const &name) = 0; |
| 23 | |
| 24 | /// Adds a new file containing data to the cache. |
| 25 | /// @param data new file data to be cached |
| 26 | /// @param name target name for the cached file |
| 27 | /// @return path to the cached file when succeed |
| 28 | virtual stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path#> addcxx . . $ IFileCache#add(d83eed0e64cf1041).(stdcxx . . $ std/::vectorcxx . . $ std/vector#<char> const &data, |
| 29 | stdcxx . . $ std/::stringcxx . . $ std/string# const &name) = 0; |
| 30 | |
| 31 | /// Removes a cached file. |
| 32 | /// @param name name of the cached file to remove |
| 33 | virtual void removecxx . . $ IFileCache#remove(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &name) = 0; |
| 34 | |
| 35 | /// Gets the path of a file in the cache. |
| 36 | /// @param name name of the file |
| 37 | /// @param defaultPath path to be returned if no file exists on the cache |
| 38 | /// @return path to the file or defaultPath is set and no file with that name exists |
| 39 | /// on the cache |
| 40 | virtual stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path#> |
| 41 | getcxx . . $ IFileCache#get(e718be3153167360).(stdcxx . . $ std/::stringcxx . . $ std/string# const &name, |
| 42 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &defaultPath = ""cxx . . $ std/filesystem/__cxx11/path#path(835bc3a16b770d4d).) const = 0; |
| 43 | |
| 44 | /// Gets the path to the cache. |
| 45 | virtual stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# pathcxx . . $ IFileCache#path(159787a050b29eb0).() const = 0; |
| 46 | |
| 47 | virtual ~cxx . . $ IFileCache#`~IFileCache`(ced63f7c635d850d).IFileCachecxx . . $ IFileCache#() = default; |
| 48 | }; |