2011-02-04 20:43:07 +03:00
|
|
|
/*
|
|
|
|
* Copyright 2009,2011, Haiku, Inc.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _PACKAGE__HPKG__PACKAGE_INFO_ATTRIBUTE_VALUE_H_
|
|
|
|
#define _PACKAGE__HPKG__PACKAGE_INFO_ATTRIBUTE_VALUE_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
|
2013-05-13 03:04:52 +04:00
|
|
|
#include <string.h>
|
|
|
|
|
2011-02-04 20:43:07 +03:00
|
|
|
#include <package/PackageArchitecture.h>
|
|
|
|
#include <package/PackageInfoAttributes.h>
|
|
|
|
#include <package/PackageResolvableOperator.h>
|
2013-06-06 02:16:28 +04:00
|
|
|
#include <package/WritableFileUpdateType.h>
|
2011-02-04 20:43:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
|
|
|
namespace BHPKG {
|
|
|
|
|
|
|
|
|
|
|
|
struct BPackageVersionData {
|
|
|
|
const char* major;
|
|
|
|
const char* minor;
|
|
|
|
const char* micro;
|
2011-06-27 03:53:01 +04:00
|
|
|
const char* preRelease;
|
2013-04-16 02:05:19 +04:00
|
|
|
uint32 revision;
|
2011-02-04 20:43:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct BPackageResolvableData {
|
|
|
|
const char* name;
|
|
|
|
bool haveVersion;
|
2011-06-27 05:47:12 +04:00
|
|
|
bool haveCompatibleVersion;
|
2011-02-04 20:43:07 +03:00
|
|
|
BPackageVersionData version;
|
2011-06-27 05:47:12 +04:00
|
|
|
BPackageVersionData compatibleVersion;
|
2011-02-04 20:43:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct BPackageResolvableExpressionData {
|
|
|
|
const char* name;
|
|
|
|
bool haveOpAndVersion;
|
|
|
|
BPackageResolvableOperator op;
|
|
|
|
BPackageVersionData version;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-06-06 02:16:28 +04:00
|
|
|
struct BGlobalWritableFileInfoData {
|
2013-05-23 23:29:18 +04:00
|
|
|
const char* path;
|
2013-06-06 02:16:28 +04:00
|
|
|
BWritableFileUpdateType updateType;
|
|
|
|
bool isDirectory;
|
2013-05-23 23:29:18 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct BUserSettingsFileInfoData {
|
|
|
|
const char* path;
|
|
|
|
const char* templatePath;
|
2013-06-06 02:16:28 +04:00
|
|
|
bool isDirectory;
|
2013-05-23 23:29:18 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-05-24 05:11:18 +04:00
|
|
|
struct BUserData {
|
|
|
|
const char* name;
|
|
|
|
const char* realName;
|
|
|
|
const char* home;
|
|
|
|
const char* shell;
|
|
|
|
const char* const* groups;
|
|
|
|
size_t groupCount;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-02-04 20:43:07 +03:00
|
|
|
struct BPackageInfoAttributeValue {
|
|
|
|
union {
|
|
|
|
uint64 unsignedInt;
|
|
|
|
const char* string;
|
|
|
|
BPackageVersionData version;
|
|
|
|
BPackageResolvableData resolvable;
|
|
|
|
BPackageResolvableExpressionData resolvableExpression;
|
2013-06-06 02:16:28 +04:00
|
|
|
BGlobalWritableFileInfoData globalWritableFileInfo;
|
2013-05-23 23:29:18 +04:00
|
|
|
BUserSettingsFileInfoData userSettingsFileInfo;
|
2013-05-24 05:11:18 +04:00
|
|
|
BUserData user;
|
2011-02-04 20:43:07 +03:00
|
|
|
};
|
2011-02-12 22:21:37 +03:00
|
|
|
BPackageInfoAttributeID attributeID;
|
2011-02-04 20:43:07 +03:00
|
|
|
|
|
|
|
public:
|
2011-02-12 22:21:37 +03:00
|
|
|
BPackageInfoAttributeValue();
|
2011-02-04 20:43:07 +03:00
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
void SetTo(BPackageInfoAttributeID id,
|
2011-02-04 20:43:07 +03:00
|
|
|
uint8 value);
|
2011-02-12 22:21:37 +03:00
|
|
|
void SetTo(BPackageInfoAttributeID id,
|
2011-02-04 20:43:07 +03:00
|
|
|
const char* value);
|
2011-02-12 22:21:37 +03:00
|
|
|
|
|
|
|
void Clear();
|
2011-02-04 20:43:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
inline
|
2011-02-04 20:43:07 +03:00
|
|
|
BPackageInfoAttributeValue::BPackageInfoAttributeValue()
|
|
|
|
{
|
2011-02-12 22:21:37 +03:00
|
|
|
Clear();
|
2011-02-04 20:43:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
inline void
|
|
|
|
BPackageInfoAttributeValue::SetTo(BPackageInfoAttributeID id, uint8 value)
|
2011-02-04 20:43:07 +03:00
|
|
|
{
|
2011-02-12 22:21:37 +03:00
|
|
|
attributeID = id;
|
2011-02-04 20:43:07 +03:00
|
|
|
unsignedInt = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
inline void
|
|
|
|
BPackageInfoAttributeValue::SetTo(BPackageInfoAttributeID id,
|
2011-02-04 20:43:07 +03:00
|
|
|
const char* value)
|
|
|
|
{
|
2011-02-12 22:21:37 +03:00
|
|
|
attributeID = id;
|
2011-02-04 20:43:07 +03:00
|
|
|
string = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-12 22:21:37 +03:00
|
|
|
inline void
|
|
|
|
BPackageInfoAttributeValue::Clear()
|
|
|
|
{
|
2019-02-25 15:12:11 +03:00
|
|
|
unsignedInt = 0;
|
|
|
|
string = NULL;
|
|
|
|
version = {};
|
|
|
|
resolvable = {};
|
|
|
|
resolvableExpression = {};
|
|
|
|
globalWritableFileInfo = {};
|
|
|
|
userSettingsFileInfo = {};
|
|
|
|
user = {};
|
2011-02-12 22:21:37 +03:00
|
|
|
attributeID = B_PACKAGE_INFO_ENUM_COUNT;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-02-04 20:43:07 +03:00
|
|
|
} // namespace BHPKG
|
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _PACKAGE__HPKG__PACKAGE_ATTRIBUTE_VALUE_H_
|