2011-01-22 01:18:58 +03:00
|
|
|
/*
|
2014-06-17 11:46:48 +04:00
|
|
|
* Copyright 2011-2014, Haiku, Inc. All Rights Reserved.
|
2011-01-22 01:18:58 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-01-28 02:17:03 +03:00
|
|
|
#ifndef _PACKAGE__PACKAGE_ROSTER_H_
|
|
|
|
#define _PACKAGE__PACKAGE_ROSTER_H_
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
|
|
|
#include <Entry.h>
|
2011-01-24 23:48:03 +03:00
|
|
|
#include <FindDirectory.h>
|
2011-01-22 01:18:58 +03:00
|
|
|
#include <Path.h>
|
|
|
|
|
2011-07-17 01:19:00 +04:00
|
|
|
#include <package/PackageDefs.h>
|
|
|
|
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-07-16 18:36:36 +04:00
|
|
|
class BStringList;
|
2011-01-24 23:48:03 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
namespace BPackageKit {
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
struct BRepositoryConfigVisitor {
|
|
|
|
virtual ~BRepositoryConfigVisitor()
|
2011-01-22 01:18:58 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual status_t operator()(const BEntry& entry) = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-04-14 19:04:33 +04:00
|
|
|
class BInstallationLocationInfo;
|
2011-07-17 01:19:00 +04:00
|
|
|
class BPackageInfoSet;
|
2011-01-25 20:07:27 +03:00
|
|
|
class BRepositoryCache;
|
|
|
|
class BRepositoryConfig;
|
2019-08-08 04:18:57 +03:00
|
|
|
class BPackageInfo;
|
2011-01-24 23:48:03 +03:00
|
|
|
|
|
|
|
|
2014-06-17 11:46:48 +04:00
|
|
|
// watchable events
|
|
|
|
enum {
|
|
|
|
B_WATCH_PACKAGE_INSTALLATION_LOCATIONS = 0x0001,
|
|
|
|
// de-/activation of packages in standard installation locations
|
|
|
|
};
|
|
|
|
|
|
|
|
// notification message "event" field values
|
|
|
|
enum {
|
|
|
|
B_INSTALLATION_LOCATION_PACKAGES_CHANGED,
|
|
|
|
// "location": int32
|
|
|
|
// the installation location
|
|
|
|
// (B_PACKAGE_INSTALLATION_LOCATION_{SYSTEM,HOME}
|
|
|
|
// "change count": int64
|
|
|
|
// the installation location change count
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
class BPackageRoster {
|
2011-01-22 01:18:58 +03:00
|
|
|
public:
|
2011-01-25 20:07:27 +03:00
|
|
|
BPackageRoster();
|
|
|
|
~BPackageRoster();
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2019-03-01 16:58:24 +03:00
|
|
|
bool IsRebootNeeded();
|
|
|
|
|
2011-01-24 23:48:03 +03:00
|
|
|
status_t GetCommonRepositoryCachePath(BPath* path,
|
|
|
|
bool create = false) const;
|
|
|
|
status_t GetUserRepositoryCachePath(BPath* path,
|
|
|
|
bool create = false) const;
|
|
|
|
|
2011-01-22 01:18:58 +03:00
|
|
|
status_t GetCommonRepositoryConfigPath(BPath* path,
|
|
|
|
bool create = false) const;
|
|
|
|
status_t GetUserRepositoryConfigPath(BPath* path,
|
|
|
|
bool create = false) const;
|
|
|
|
|
2011-07-16 18:36:36 +04:00
|
|
|
status_t GetRepositoryNames(BStringList& names);
|
2011-01-24 23:48:03 +03:00
|
|
|
|
2011-01-22 01:18:58 +03:00
|
|
|
status_t VisitCommonRepositoryConfigs(
|
2011-01-25 20:07:27 +03:00
|
|
|
BRepositoryConfigVisitor& visitor);
|
2011-01-22 01:18:58 +03:00
|
|
|
status_t VisitUserRepositoryConfigs(
|
2011-01-25 20:07:27 +03:00
|
|
|
BRepositoryConfigVisitor& visitor);
|
2011-01-22 01:18:58 +03:00
|
|
|
|
2011-01-24 23:48:03 +03:00
|
|
|
status_t GetRepositoryCache(const BString& name,
|
2011-01-25 20:07:27 +03:00
|
|
|
BRepositoryCache* repositoryCache);
|
2011-01-24 23:48:03 +03:00
|
|
|
status_t GetRepositoryConfig(const BString& name,
|
2011-01-25 20:07:27 +03:00
|
|
|
BRepositoryConfig* repositoryConfig);
|
2011-07-17 01:19:00 +04:00
|
|
|
|
2013-04-14 19:04:33 +04:00
|
|
|
status_t GetInstallationLocationInfo(
|
|
|
|
BPackageInstallationLocation location,
|
|
|
|
BInstallationLocationInfo& _info);
|
2011-07-17 01:19:00 +04:00
|
|
|
status_t GetActivePackages(
|
|
|
|
BPackageInstallationLocation location,
|
|
|
|
BPackageInfoSet& packageInfos);
|
|
|
|
|
2019-08-08 04:18:57 +03:00
|
|
|
status_t IsPackageActive(
|
|
|
|
BPackageInstallationLocation location,
|
|
|
|
const BPackageInfo info, bool* active);
|
|
|
|
|
2014-06-17 11:46:48 +04:00
|
|
|
status_t StartWatching(const BMessenger& target,
|
|
|
|
uint32 eventMask);
|
|
|
|
status_t StopWatching(const BMessenger& target);
|
|
|
|
|
2011-01-22 01:18:58 +03:00
|
|
|
private:
|
2011-01-24 23:48:03 +03:00
|
|
|
status_t _GetRepositoryPath(BPath* path, bool create,
|
|
|
|
directory_which whichDir) const;
|
2011-01-22 01:18:58 +03:00
|
|
|
status_t _VisitRepositoryConfigs(const BPath& path,
|
2011-01-25 20:07:27 +03:00
|
|
|
BRepositoryConfigVisitor& visitor);
|
2011-01-22 01:18:58 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-25 20:07:27 +03:00
|
|
|
} // namespace BPackageKit
|
2011-01-22 01:18:58 +03:00
|
|
|
|
|
|
|
|
2011-01-28 02:17:03 +03:00
|
|
|
#endif // _PACKAGE__PACKAGE_ROSTER_H_
|