| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/src/core/iprofilemanager.h`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "importable.h"cxx . . $ `<file>/src/core/importable.h`/ |
| 7 | #include "iprofile.h"cxx . . $ `<file>/src/core/iprofile.h`/ |
| 8 | #include <filesystem> |
| 9 | #include <functional> |
| 10 | #include <memory> |
| 11 | #include <optional> |
| 12 | #include <string> |
| 13 | #include <vector> |
| 14 | |
| 15 | class ISysModelcxx . . $ ISysModel#; |
| 16 | |
| 17 | class IProfileManagercxx . . $ IProfileManager# |
| 18 | { |
| 19 | public: |
| 20 | /// Profile manager observers must implement this interface. |
| 21 | class Observercxx . . $ IProfileManager#Observer# |
| 22 | { |
| 23 | public: |
| 24 | /// A new profile was added. |
| 25 | /// @param profileName name of the added profile |
| 26 | virtual void profileAddedcxx . . $ IProfileManager#Observer#profileAdded(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 27 | |
| 28 | /// A profile was removed. |
| 29 | /// @param profileName name of the removed profile |
| 30 | virtual void profileRemovedcxx . . $ IProfileManager#Observer#profileRemoved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 31 | |
| 32 | /// The settings of a profile changed. |
| 33 | /// @param profileName name of the profile that changed |
| 34 | virtual void profileChangedcxx . . $ IProfileManager#Observer#profileChanged(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 35 | |
| 36 | /// The active state of a profile changed. |
| 37 | /// @param profileName name of the profile that changed |
| 38 | /// @param active new active state |
| 39 | virtual void profileActiveChangedcxx . . $ IProfileManager#Observer#profileActiveChanged(a3b17e0268c60856).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, |
| 40 | bool active) = 0; |
| 41 | |
| 42 | /// A profile was saved. |
| 43 | /// @param profileName name of the saved profile |
| 44 | virtual void profileSavedcxx . . $ IProfileManager#Observer#profileSaved(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 45 | |
| 46 | /// The info of a profile changed. |
| 47 | /// @param oldInfo old profile info |
| 48 | /// @param newInfo new profile info |
| 49 | virtual void profileInfoChangedcxx . . $ IProfileManager#Observer#profileInfoChanged(1acf29b044426ccc).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &oldInfo, |
| 50 | IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &newInfo) = 0; |
| 51 | |
| 52 | virtual ~cxx . . $ IProfileManager#Observer#`~Observer`(ced63f7c635d850d).Observercxx . . $ IProfileManager#Observer#() = default; |
| 53 | }; |
| 54 | |
| 55 | /// Adds a new profile manager observer. |
| 56 | /// @param observer new observer to be added |
| 57 | virtual void |
| 58 | addObservercxx . . $ IProfileManager#addObserver(bd1477ff1de9e2eb).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<IProfileManagercxx . . $ IProfileManager#::Observercxx . . $ IProfileManager#Observer#> observer) = 0; |
| 59 | |
| 60 | /// Removes a observer from the profile manager observers |
| 61 | /// @param observer observer to be removed |
| 62 | virtual void |
| 63 | removeObservercxx . . $ IProfileManager#removeObserver(feeb623736561950).(stdcxx . . $ std/::shared_ptrcxx . . $ std/shared_ptr#<IProfileManagercxx . . $ IProfileManager#::Observercxx . . $ IProfileManager#Observer#> const &observer) = 0; |
| 64 | |
| 65 | /// Initialization method. |
| 66 | /// @param model system model to initialize from |
| 67 | virtual void initcxx . . $ IProfileManager#init(2ffe4369e6bd4764).(ISysModelcxx . . $ ISysModel# const &model) = 0; |
| 68 | |
| 69 | /// Available profiles. |
| 70 | /// @return names of the available profiles |
| 71 | virtual stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> profilescxx . . $ IProfileManager#profiles(491c255a7e496038).() const = 0; |
| 72 | |
| 73 | /// Request a profile from the avaiable profiles. |
| 74 | /// @param profileName name of the requested profile |
| 75 | /// @return the named profile when is available |
| 76 | virtual stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::reference_wrappercxx . . $ std/reference_wrapper#<IProfilecxx . . $ IProfile# const>> |
| 77 | profilecxx . . $ IProfileManager#profile(f84880c9a777ebac).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) const = 0; |
| 78 | |
| 79 | /// Request the list of not saved profiles. |
| 80 | /// @return names of the unsaved profiles |
| 81 | virtual stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> unsavedProfilescxx . . $ IProfileManager#unsavedProfiles(491c255a7e496038).() const = 0; |
| 82 | |
| 83 | /// Checks whether a profile is not saved. |
| 84 | /// @param profileName profile name to be checked |
| 85 | /// @return true when the profile is unsaved |
| 86 | virtual bool unsavedcxx . . $ IProfileManager#unsaved(13a55b95a0133754).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) const = 0; |
| 87 | |
| 88 | /// Adds a new profile with the supplied info. |
| 89 | /// @param info info of the profile to be created |
| 90 | virtual void addcxx . . $ IProfileManager#add(7a3f345cc6258353).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &info) = 0; |
| 91 | |
| 92 | /// Adds a clone of a profile with the supplied info. |
| 93 | /// @param cloneInfo info of the resulting profile |
| 94 | /// @param baseProfileName name of the profile to be cloned |
| 95 | virtual void clonecxx . . $ IProfileManager#clone(7d57608c21e2500c).(IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &cloneInfo, |
| 96 | stdcxx . . $ std/::stringcxx . . $ std/string# const &baseProfileName) = 0; |
| 97 | |
| 98 | /// Removes a profile. |
| 99 | /// @param profileName name of the profile to be removed |
| 100 | virtual void removecxx . . $ IProfileManager#remove(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 101 | |
| 102 | /// Changes the active state of a profile. |
| 103 | /// @param profileName name of the profile to be changed |
| 104 | /// @param active new active state |
| 105 | virtual void activatecxx . . $ IProfileManager#activate(a3b17e0268c60856).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, bool active) = 0; |
| 106 | |
| 107 | /// Reset a profile settings to its defaults values. |
| 108 | /// @param profileName name of the profile to be reseted |
| 109 | virtual void resetcxx . . $ IProfileManager#reset(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 110 | |
| 111 | /// Restore a profile from the last saved state. |
| 112 | /// @param profileName name of the profile to be restored |
| 113 | virtual void restorecxx . . $ IProfileManager#restore(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 114 | |
| 115 | /// Updates the info of a profile. |
| 116 | /// @param profileName name of the profile to be updated |
| 117 | /// @param newInfo profile's new info |
| 118 | virtual void updatecxx . . $ IProfileManager#update(eb2b9ce3c3c58e35).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, |
| 119 | IProfilecxx . . $ IProfile#::Infocxx . . $ IProfile#Info# const &newInfo) = 0; |
| 120 | |
| 121 | /// Updates a profile settings from a profile importer. |
| 122 | /// @param profileName name of the profile to be updated |
| 123 | /// @param importer profile importer |
| 124 | virtual void updatecxx . . $ IProfileManager#update(1a91c228bd4123e9).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, |
| 125 | Importablecxx . . $ Importable#::Importercxx . . $ Importable#Importer# &importer) = 0; |
| 126 | |
| 127 | /// Loads a profile settings from a profile file. |
| 128 | /// @param profileName name of the profile to be loaded |
| 129 | /// @param path path to the profile file |
| 130 | /// @return true when the loading was successful |
| 131 | virtual bool loadFromcxx . . $ IProfileManager#loadFrom(19973e5c5433fa0c).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, |
| 132 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path) = 0; |
| 133 | |
| 134 | /// Saves a profile. |
| 135 | /// @param profileName name of the profile to be saved |
| 136 | virtual void savecxx . . $ IProfileManager#save(9c546c94e5fcce4e).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName) = 0; |
| 137 | |
| 138 | /// Exports a profile to a profile file. |
| 139 | /// @param profileName name of the profile to be exported |
| 140 | /// @param path destination path of the exported profile file |
| 141 | /// @return true when the exporting was successful |
| 142 | virtual bool exportTocxx . . $ IProfileManager#exportTo(19973e5c5433fa0c).(stdcxx . . $ std/::stringcxx . . $ std/string# const &profileName, |
| 143 | stdcxx . . $ std/::filesystemcxx . . $ std/filesystem/::pathcxx . . $ std/filesystem/__cxx11/path# const &path) = 0; |
| 144 | |
| 145 | virtual ~cxx . . $ IProfileManager#`~IProfileManager`(49f6e7a06ebc5aa8).IProfileManagercxx . . $ IProfileManager#() = default; |
| 146 | }; |