Add architecture property to Package

This commit is contained in:
Ingo Weinhold 2011-06-27 06:50:39 +02:00
parent 2ec6e02711
commit eadc3c844d
2 changed files with 33 additions and 0 deletions

View File

@ -19,12 +19,20 @@
#include "Version.h"
const char* const kArchitectureNames[B_PACKAGE_ARCHITECTURE_ENUM_COUNT] = {
"any",
"x86",
"x86_gcc2",
};
Package::Package(PackageDomain* domain, dev_t deviceID, ino_t nodeID)
:
fDomain(domain),
fFileName(NULL),
fName(NULL),
fVersion(NULL),
fArchitecture(B_PACKAGE_ARCHITECTURE_ENUM_COUNT),
fLinkDirectory(NULL),
fFD(-1),
fOpenCount(0),
@ -89,6 +97,18 @@ Package::SetVersion(::Version* version)
}
const char*
Package::ArchitectureName() const
{
if (fArchitecture < 0
|| fArchitecture >= B_PACKAGE_ARCHITECTURE_ENUM_COUNT) {
return NULL;
}
return kArchitectureNames[fArchitecture];
}
void
Package::AddNode(PackageNode* node)
{

View File

@ -6,6 +6,8 @@
#define PACKAGE_H
#include <package/PackageArchitecture.h>
#include <Referenceable.h>
#include <util/DoublyLinkedList.h>
@ -19,6 +21,9 @@
#include "Resolvable.h"
using BPackageKit::BPackageArchitecture;
class PackageDomain;
class PackageLinkDirectory;
class Version;
@ -44,6 +49,13 @@ public:
::Version* Version() const
{ return fVersion; }
void SetArchitecture(
BPackageArchitecture architecture)
{ fArchitecture = architecture; }
BPackageArchitecture Architecture() const
{ return fArchitecture; }
const char* ArchitectureName() const;
void SetLinkDirectory(
PackageLinkDirectory* linkDirectory)
{ fLinkDirectory = linkDirectory; }
@ -72,6 +84,7 @@ private:
char* fFileName;
char* fName;
::Version* fVersion;
BPackageArchitecture fArchitecture;
PackageLinkDirectory* fLinkDirectory;
int fFD;
uint32 fOpenCount;