Add BInstallationLocationInfo
This commit is contained in:
@@ -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_
|
||||||
@@ -74,6 +74,7 @@ BuildPlatformSharedLibrary libpackage_build.so
|
|||||||
Context.cpp
|
Context.cpp
|
||||||
DropRepositoryRequest.cpp
|
DropRepositoryRequest.cpp
|
||||||
FetchFileJob.cpp
|
FetchFileJob.cpp
|
||||||
|
InstallationLocationInfo.cpp
|
||||||
Job.cpp
|
Job.cpp
|
||||||
JobQueue.cpp
|
JobQueue.cpp
|
||||||
PackageInfo.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
|
||||||
@@ -53,6 +53,7 @@ SharedLibrary libpackage.so
|
|||||||
Context.cpp
|
Context.cpp
|
||||||
DropRepositoryRequest.cpp
|
DropRepositoryRequest.cpp
|
||||||
FetchFileJob.cpp
|
FetchFileJob.cpp
|
||||||
|
InstallationLocationInfo.cpp
|
||||||
Job.cpp
|
Job.cpp
|
||||||
JobQueue.cpp
|
JobQueue.cpp
|
||||||
PackageInfo.cpp
|
PackageInfo.cpp
|
||||||
|
|||||||
Reference in New Issue
Block a user