plugify 1.0.0.0
Loading...
Searching...
No Matches
package_manager.hpp
1#pragma once
2
3#include <filesystem>
4#include <functional>
5#include <optional>
6#include <memory>
7#include <plugify_export.h>
8
9namespace plugify {
10 struct Package;
11 struct LocalPackage;
12 struct RemotePackage;
13
18 using PackagePtr = std::shared_ptr<Package>;
19
24 using LocalPackagePtr = std::shared_ptr<LocalPackage>;
25
30 using RemotePackagePtr = std::shared_ptr<RemotePackage>;
31
37 public:
38 virtual ~IPackageManager() = default;
39
44 virtual bool Initialize() = 0;
45
49 virtual void Terminate() = 0;
50
55 virtual bool IsInitialized() const = 0;
56
61 virtual bool Reload() = 0;
62
68 virtual void InstallPackage(std::string_view packageName, std::optional<int32_t> requiredVersion = {}) = 0;
69
74 virtual void InstallPackages(std::span<const std::string> packageNames) = 0;
75
81 virtual void InstallAllPackages(const std::filesystem::path& manifestFilePath, bool reinstall) = 0;
82
88 virtual void InstallAllPackages(const std::string& manifestUrl, bool reinstall) = 0;
89
95 virtual void UpdatePackage(std::string_view packageName, std::optional<int32_t> requiredVersion = {}) = 0;
96
101 virtual void UpdatePackages(std::span<const std::string> packageNames) = 0;
102
106 virtual void UpdateAllPackages() = 0;
107
112 virtual void UninstallPackage(std::string_view packageName) = 0;
113
118 virtual void UninstallPackages(std::span<const std::string> packageNames) = 0;
119
123 virtual void UninstallAllPackages() = 0;
124
130 virtual void SnapshotPackages(const std::filesystem::path& manifestFilePath, bool prettify) = 0;
131
136 virtual bool HasMissedPackages() const = 0;
137
142 virtual bool HasConflictedPackages() const = 0;
143
147 virtual void InstallMissedPackages() = 0;
148
152 virtual void UninstallConflictedPackages() = 0;
153
159 virtual LocalPackagePtr FindLocalPackage(std::string_view packageName) const = 0;
160
166 virtual RemotePackagePtr FindRemotePackage(std::string_view packageName) const = 0;
167
172 virtual std::vector<LocalPackagePtr> GetLocalPackages() const = 0;
173
178 virtual std::vector<RemotePackagePtr> GetRemotePackages() const = 0;
179 };
180
181} // namespace plugify
Interface for the package manager provided to the user, implemented in the core.
virtual void UpdateAllPackages()=0
Update all installed packages.
virtual void UninstallPackages(std::span< const std::string > packageNames)=0
Uninstall multiple packages.
virtual void UninstallConflictedPackages()=0
Uninstall conflicted packages.
virtual bool IsInitialized() const =0
Check if the package manager is initialized.
virtual void UpdatePackages(std::span< const std::string > packageNames)=0
Update multiple packages.
virtual bool HasMissedPackages() const =0
Check if there are missed packages (not installed but required by other packages).
virtual void Terminate()=0
Terminate the package manager.
virtual void UninstallPackage(std::string_view packageName)=0
Uninstall a specific package.
virtual void InstallMissedPackages()=0
Install missed packages.
virtual bool Initialize()=0
Initialize the package manager.
virtual void InstallAllPackages(const std::filesystem::path &manifestFilePath, bool reinstall)=0
Install all packages listed in a manifest file.
virtual bool Reload()=0
Reload the package manager.
virtual void UninstallAllPackages()=0
Uninstall all installed packages.
virtual void InstallPackages(std::span< const std::string > packageNames)=0
Install multiple packages.
virtual bool HasConflictedPackages() const =0
Check if there are conflicted packages (installed with conflicting versions).
virtual std::vector< RemotePackagePtr > GetRemotePackages() const =0
Get a vector of all remote packages.
virtual std::vector< LocalPackagePtr > GetLocalPackages() const =0
Get a vector of all local packages.
virtual void InstallAllPackages(const std::string &manifestUrl, bool reinstall)=0
Install all packages listed in a manifest file from a remote location.
virtual void InstallPackage(std::string_view packageName, std::optional< int32_t > requiredVersion={})=0
Install a package.
virtual void SnapshotPackages(const std::filesystem::path &manifestFilePath, bool prettify)=0
Snapshot the list of installed packages to a manifest file.
virtual RemotePackagePtr FindRemotePackage(std::string_view packageName) const =0
Find a remote package by name.
virtual void UpdatePackage(std::string_view packageName, std::optional< int32_t > requiredVersion={})=0
Update a specific package.
virtual LocalPackagePtr FindLocalPackage(std::string_view packageName) const =0
Find a local package by name.