Files
FWS-PacManage/include/IPackageManager.h
T

55 lines
1.7 KiB
C++

#pragma once
#include <string>
#include <vector>
#include <functional>
// Information about a single package
struct PackageInfo {
std::string name;
std::string version;
std::string description;
std::string repository;
std::string size;
std::string installedSize;
bool installed = false;
bool updateAvailable = false;
};
// Abstract interface for all package manager plugins
class IPackageManager {
public:
virtual ~IPackageManager() = default;
// Identity
virtual std::string getName() const = 0;
virtual std::string getVersion() const = 0;
virtual std::string getDescription() const = 0;
// Capabilities
virtual bool canSearch() const = 0;
virtual bool canInstall() const = 0;
virtual bool canRemove() const = 0;
virtual bool canUpdate() const = 0;
virtual bool canListInstalled() const = 0;
// Operations
virtual std::vector<PackageInfo> search(const std::string& query) = 0;
virtual bool install(const std::string& packageName,
std::function<void(const std::string&)> progressCallback = nullptr) = 0;
virtual bool remove(const std::string& packageName,
std::function<void(const std::string&)> progressCallback = nullptr) = 0;
virtual bool update(const std::string& packageName = "",
std::function<void(const std::string&)> progressCallback = nullptr) = 0;
virtual std::vector<PackageInfo> listInstalled() = 0;
// Check if the package manager is available on the system
virtual bool isAvailable() const = 0;
};
// Plugin entry point types
extern "C" {
IPackageManager* createPlugin();
void destroyPlugin(IPackageManager* plugin);
}