Add BInstallationLocationInfo

This commit is contained in:
Ingo Weinhold
2013-04-14 17:06:26 +02:00
parent b2d96da589
commit d7d9497e31
5 changed files with 193 additions and 0 deletions
@@ -0,0 +1 @@
#include <../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 <Node.h>
#include <package/PackageDefs.h>
#include <package/PackageInfoSet.h>
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_
+1
View File
@@ -74,6 +74,7 @@ BuildPlatformSharedLibrary libpackage_build.so
Context.cpp
DropRepositoryRequest.cpp
FetchFileJob.cpp
InstallationLocationInfo.cpp
Job.cpp
JobQueue.cpp
PackageInfo.cpp
@@ -0,0 +1,131 @@
/*
* Copyright 2013, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Ingo Weinhold <[email protected]>
*/
#include <package/InstallationLocationInfo.h>
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
+1
View File
@@ -53,6 +53,7 @@ SharedLibrary libpackage.so
Context.cpp
DropRepositoryRequest.cpp
FetchFileJob.cpp
InstallationLocationInfo.cpp
Job.cpp
JobQueue.cpp
PackageInfo.cpp