2009-11-13 16:45:49 +03:00
|
|
|
/*
|
2011-01-30 18:15:33 +03:00
|
|
|
* Copyright 2009,2011, Haiku, Inc.
|
2009-11-13 16:45:49 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
2011-01-30 18:05:38 +03:00
|
|
|
#ifndef _PACKAGE__HPKG__PACKAGE_DATA_H_
|
|
|
|
#define _PACKAGE__HPKG__PACKAGE_DATA_H_
|
2009-11-13 16:45:49 +03:00
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
#include <package/hpkg/HPKGDefs.h>
|
2011-01-28 02:17:03 +03:00
|
|
|
|
|
|
|
|
|
|
|
namespace BPackageKit {
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
namespace BHPKG {
|
2011-01-28 02:17:03 +03:00
|
|
|
|
2009-11-13 16:45:49 +03:00
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
class BPackageData {
|
2009-11-13 16:45:49 +03:00
|
|
|
public:
|
2011-01-30 18:05:38 +03:00
|
|
|
BPackageData();
|
2009-11-13 16:45:49 +03:00
|
|
|
|
2013-05-18 06:11:01 +04:00
|
|
|
uint64 Size() const
|
|
|
|
{ return fSize; }
|
2009-11-15 11:37:22 +03:00
|
|
|
uint64 Offset() const
|
|
|
|
{ return fEncodedInline ? 0 : fOffset; }
|
2009-11-13 16:45:49 +03:00
|
|
|
|
|
|
|
bool IsEncodedInline() const
|
|
|
|
{ return fEncodedInline; }
|
|
|
|
const uint8* InlineData() const { return fInlineData; }
|
|
|
|
|
|
|
|
void SetData(uint64 size, uint64 offset);
|
|
|
|
void SetData(uint8 size, const void* data);
|
|
|
|
|
|
|
|
private:
|
2013-05-18 06:11:01 +04:00
|
|
|
uint64 fSize : 63;
|
|
|
|
bool fEncodedInline : 1;
|
2009-11-13 16:45:49 +03:00
|
|
|
union {
|
|
|
|
uint64 fOffset;
|
|
|
|
uint8 fInlineData[B_HPKG_MAX_INLINE_DATA_SIZE];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
} // namespace BHPKG
|
2011-01-28 02:17:03 +03:00
|
|
|
|
|
|
|
} // namespace BPackageKit
|
|
|
|
|
|
|
|
|
2011-01-30 18:05:38 +03:00
|
|
|
#endif // _PACKAGE__HPKG__PACKAGE_DATA_H_
|