From d7d9497e31047e9cf1c486865d6cbb7df3441487 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Sun, 14 Apr 2013 16:50:30 +0200 Subject: [PATCH] Add BInstallationLocationInfo --- .../os/package/InstallationLocationInfo.h | 1 + headers/os/package/InstallationLocationInfo.h | 59 ++++++++ src/build/libpackage/Jamfile | 1 + src/kits/package/InstallationLocationInfo.cpp | 131 ++++++++++++++++++ src/kits/package/Jamfile | 1 + 5 files changed, 193 insertions(+) create mode 100644 headers/build/os/package/InstallationLocationInfo.h create mode 100644 headers/os/package/InstallationLocationInfo.h create mode 100644 src/kits/package/InstallationLocationInfo.cpp diff --git a/headers/build/os/package/InstallationLocationInfo.h b/headers/build/os/package/InstallationLocationInfo.h new file mode 100644 index 0000000000..d9e97590f5 --- /dev/null +++ b/headers/build/os/package/InstallationLocationInfo.h @@ -0,0 +1 @@ +#include <../os/package/InstallationLocationInfo.h> diff --git a/headers/os/package/InstallationLocationInfo.h b/headers/os/package/InstallationLocationInfo.h new file mode 100644 index 0000000000..3bdec66666 --- /dev/null +++ b/headers/os/package/InstallationLocationInfo.h @@ -0,0 +1,59 @@ +/* + * Copyright 2013, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _PACKAGE__INSTALLATION_LOCATION_INFO_H_ +#define _PACKAGE__INSTALLATION_LOCATION_INFO_H_ + + +#include + +#include +#include + + +namespace BPackageKit { + + +class BInstallationLocationInfo { +public: + BInstallationLocationInfo(); + ~BInstallationLocationInfo(); + + void Unset(); + + BPackageInstallationLocation Location() const; + void SetLocation( + BPackageInstallationLocation location); + + const node_ref& BaseDirectoryRef() const; + status_t SetBaseDirectoryRef(const node_ref& ref); + + const node_ref& PackagesDirectoryRef() const; + status_t SetPackagesDirectoryRef(const node_ref& ref); + + const BPackageInfoSet& ActivePackageInfos() const; + void SetActivePackageInfos( + const BPackageInfoSet& infos); + + const BPackageInfoSet& InactivePackageInfos() const; + void SetInactivePackageInfos( + const BPackageInfoSet& infos); + + int64 ChangeCount() const; + void SetChangeCount(int64 changeCount); + +private: + BPackageInstallationLocation fLocation; + node_ref fBaseDirectoryRef; + node_ref fPackageDirectoryRef; + BPackageInfoSet fActivePackageInfos; + BPackageInfoSet fInactivePackageInfos; + int64 fChangeCount; +}; + + +} // namespace BPackageKit + + +#endif // _PACKAGE__INSTALLATION_LOCATION_INFO_H_ diff --git a/src/build/libpackage/Jamfile b/src/build/libpackage/Jamfile index 58ce24b42e..65a24be213 100644 --- a/src/build/libpackage/Jamfile +++ b/src/build/libpackage/Jamfile @@ -74,6 +74,7 @@ BuildPlatformSharedLibrary libpackage_build.so Context.cpp DropRepositoryRequest.cpp FetchFileJob.cpp + InstallationLocationInfo.cpp Job.cpp JobQueue.cpp PackageInfo.cpp diff --git a/src/kits/package/InstallationLocationInfo.cpp b/src/kits/package/InstallationLocationInfo.cpp new file mode 100644 index 0000000000..6d67d07078 --- /dev/null +++ b/src/kits/package/InstallationLocationInfo.cpp @@ -0,0 +1,131 @@ +/* + * Copyright 2013, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Ingo Weinhold + */ + + +#include + + +namespace BPackageKit { + + +BInstallationLocationInfo::BInstallationLocationInfo() + : + fLocation(B_PACKAGE_INSTALLATION_LOCATION_ENUM_COUNT), + fBaseDirectoryRef(), + fPackageDirectoryRef(), + fActivePackageInfos(), + fInactivePackageInfos(), + fChangeCount(0) +{ +} + + +BInstallationLocationInfo::~BInstallationLocationInfo() +{ +} + + +void +BInstallationLocationInfo::Unset() +{ + fLocation = B_PACKAGE_INSTALLATION_LOCATION_ENUM_COUNT; + fBaseDirectoryRef = node_ref(); + fPackageDirectoryRef = node_ref(); + fActivePackageInfos.MakeEmpty(); + fInactivePackageInfos.MakeEmpty(); + fChangeCount = 0; +} + + +BPackageInstallationLocation +BInstallationLocationInfo::Location() const +{ + return fLocation; +} + + +void +BInstallationLocationInfo::SetLocation(BPackageInstallationLocation location) +{ + fLocation = location; +} + + +const node_ref& +BInstallationLocationInfo::BaseDirectoryRef() const +{ + return fBaseDirectoryRef; +} + + +status_t +BInstallationLocationInfo::SetBaseDirectoryRef(const node_ref& ref) +{ + fBaseDirectoryRef = ref; + return fBaseDirectoryRef == ref ? B_OK : B_NO_MEMORY; +} + + +const node_ref& +BInstallationLocationInfo::PackagesDirectoryRef() const +{ + return fPackageDirectoryRef; +} + + +status_t +BInstallationLocationInfo::SetPackagesDirectoryRef(const node_ref& ref) +{ + fPackageDirectoryRef = ref; + return fPackageDirectoryRef == ref ? B_OK : B_NO_MEMORY; +} + + +const BPackageInfoSet& +BInstallationLocationInfo::ActivePackageInfos() const +{ + return fActivePackageInfos; +} + + +void +BInstallationLocationInfo::SetActivePackageInfos(const BPackageInfoSet& infos) +{ + fActivePackageInfos = infos; +} + + +const BPackageInfoSet& +BInstallationLocationInfo::InactivePackageInfos() const +{ + return fInactivePackageInfos; +} + + +void +BInstallationLocationInfo::SetInactivePackageInfos(const BPackageInfoSet& infos) +{ + fInactivePackageInfos = infos; +} + + +int64 +BInstallationLocationInfo::ChangeCount() const +{ + return fChangeCount; +} + + +void +BInstallationLocationInfo::SetChangeCount(int64 changeCount) +{ + fChangeCount = changeCount; +} + + +} // namespace BPackageKit diff --git a/src/kits/package/Jamfile b/src/kits/package/Jamfile index 338aceedf7..a3c9bede3d 100644 --- a/src/kits/package/Jamfile +++ b/src/kits/package/Jamfile @@ -53,6 +53,7 @@ SharedLibrary libpackage.so Context.cpp DropRepositoryRequest.cpp FetchFileJob.cpp + InstallationLocationInfo.cpp Job.cpp JobQueue.cpp PackageInfo.cpp