Debian Codegraph @

src/core/iprofilestorage.h

raw symbols SCIP
1 // SPDX-License-Identifier: GPL-3.0-or-later
2 // Copyright 2019 Juan Palacios <[email protected]>
3
4 #pragma once
5
6 #include "iprofile.h"
7 #include <filesystem>
8 #include <memory>
9 #include <vector>
10
11 /// Stores profiles into a location.
12 class IProfileStorage
13 {
14 public:
15 /// Initializes the profile storage.
16 /// @param defaultProfile default profile of the application
17 virtual void init(IProfile const &defaultProfile) = 0;
18
19 /// Reads the profiles on the storage.
20 /// @param baseProfile profile used as creation base
21 /// @return loaded profiles
22 virtual std::vector<std::unique_ptr<IProfile>>
23 profiles(IProfile const &baseProfile) = 0;
24
25 /// Loads a profile from the storage.
26 /// @param profile profile to be loaded
27 /// @return true on success
28 virtual bool load(IProfile &profile) = 0;
29
30 /// Saves a profile into the storage.
31 /// @param profile profile to be saved
32 /// @return true on success
33 virtual bool save(IProfile &profile) = 0;
34
35 /// Loads a profile configuration from a file.
36 /// @param profile profile to be loaded
37 /// @param path path to the profile file
38 /// @return true on success
39 virtual bool loadFrom(IProfile &profile,
40 std::filesystem::path const &path) const = 0;
41
42 /// Exports a profile to a profile file.
43 /// @param profile profile to be exported
44 /// @param path path to the target profile file
45 /// @return true on success
46 virtual bool exportTo(IProfile const &profile,
47 std::filesystem::path const &path) const = 0;
48
49 /// Updates the info of a stored profile with new info.
50 /// @param profile profile of the stored profile to be updated
51 /// @param newInfo info to be updated
52 /// @return true on success
53 virtual bool update(IProfile const &profile, IProfile::Info &newInfo) = 0;
54
55 /// Removes a stored profile.
56 /// @param info info of the stored profile to be removed
57 virtual void remove(IProfile::Info &info) = 0;
58
59 virtual ~IProfileStorage() = default;
60 };