2012-06-21 22:50:05 +08:00
|
|
|
#ifndef __COMMON_PACKAGE_MANAGER_H__
|
|
|
|
#define __COMMON_PACKAGE_MANAGER_H__
|
|
|
|
|
|
|
|
#include "IPackageManager.h"
|
|
|
|
#include "PackageInfo.h"
|
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
class CommonPackageManager: public IPackageManager
|
|
|
|
{
|
|
|
|
public:
|
2013-01-16 20:47:06 +08:00
|
|
|
std::vector<int> GetInstalledVersions();
|
|
|
|
bool CheckVersionInstalled(int version, int platform, int cpu_id);
|
|
|
|
bool InstallVersion(int version, int platform, int cpu_id);
|
|
|
|
std::string GetPackagePathByVersion(int version, int platform, int cpu_id);
|
2012-06-21 22:50:05 +08:00
|
|
|
virtual ~CommonPackageManager();
|
|
|
|
|
|
|
|
protected:
|
2013-01-22 19:53:07 +08:00
|
|
|
static const std::vector<std::pair<int, int> > ArchRatings[];
|
2012-10-02 19:02:04 +08:00
|
|
|
|
2012-06-21 22:50:05 +08:00
|
|
|
static std::vector<std::pair<int, int> > InitArmRating();
|
|
|
|
static std::vector<std::pair<int, int> > InitIntelRating();
|
2013-01-22 19:53:07 +08:00
|
|
|
static std::vector<std::pair<int, int> > InitMipsRating();
|
2012-10-02 19:02:04 +08:00
|
|
|
|
2013-01-16 20:47:06 +08:00
|
|
|
bool IsVersionCompatible(int target_version, int package_version);
|
2012-06-21 22:50:05 +08:00
|
|
|
int GetHardwareRating(int platform, int cpu_id, const std::vector<std::pair<int, int> >& group);
|
2012-10-02 19:02:04 +08:00
|
|
|
|
2012-06-21 22:50:05 +08:00
|
|
|
virtual bool InstallPackage(const PackageInfo& package) = 0;
|
2012-10-02 19:02:04 +08:00
|
|
|
virtual std::vector<PackageInfo> GetInstalledPackages() = 0;
|
2012-06-21 22:50:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-01-16 20:47:06 +08:00
|
|
|
#endif
|