2011-02-04 20:43:07 +03:00
|
|
|
/*
|
2019-03-04 01:04:22 +03:00
|
|
|
* Copyright 2009-2011, Haiku, Inc. All rights reserved.
|
2011-02-04 20:43:07 +03:00
|
|
|
* 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 {
|
2019-03-04 01:04:22 +03:00
|
|
|
const char* major;
|
|
|
|
const char* minor;
|
|
|
|
const char* micro;
|
|
|
|
const char* preRelease;
|
|
|
|
uint32 revision;
|
2011-02-04 20:43:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct BPackageResolvableData {
|
2019-03-04 01:04:22 +03:00
|
|
|
const char* name;
|
|
|
|
bool haveVersion;
|
|
|
|
bool haveCompatibleVersion;
|
|
|
|
BPackageVersionData version;
|
|
|
|
BPackageVersionData compatibleVersion;
|
2011-02-04 20:43:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct BPackageResolvableExpressionData {
|
2019-03-04 01:04:22 +03:00
|
|
|
const char* name;
|
|
|
|
bool haveOpAndVersion;
|
|
|
|
BPackageResolvableOperator op;
|
|
|
|
BPackageVersionData version;
|
2011-02-04 20:43:07 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
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;
|
2019-03-04 01:04:22 +03:00
|
|
|
memset(&version, 0, sizeof(version));
|
|
|
|
memset(&resolvable, 0, sizeof(resolvable));
|
|
|
|
memset(&resolvableExpression, 0, sizeof(resolvableExpression));
|
|
|
|
memset(&globalWritableFileInfo, 0, sizeof(globalWritableFileInfo));
|
|
|
|
memset(&userSettingsFileInfo, 0, sizeof(userSettingsFileInfo));
|
|
|
|
memset(&user, 0, sizeof(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_
|