2009-11-13 13:45:49 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef PACKAGE_DATA_H
|
|
|
|
#define PACKAGE_DATA_H
|
|
|
|
|
|
|
|
|
|
|
|
#include <haiku_package.h>
|
|
|
|
|
|
|
|
|
|
|
|
class PackageData {
|
|
|
|
public:
|
|
|
|
PackageData();
|
|
|
|
|
|
|
|
uint64 CompressedSize() const
|
|
|
|
{ return fCompressedSize; }
|
|
|
|
uint64 UncompressedSize() const
|
|
|
|
{ return fUncompressedSize; }
|
2009-11-15 08:37:22 +00:00
|
|
|
uint64 Offset() const
|
|
|
|
{ return fEncodedInline ? 0 : fOffset; }
|
2009-11-13 13:45:49 +00:00
|
|
|
uint32 Compression() const { return fCompression; }
|
2009-11-14 21:08:33 +00:00
|
|
|
uint32 ChunkSize() const { return fChunkSize; }
|
2009-11-13 13:45:49 +00: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);
|
|
|
|
|
|
|
|
void SetCompression(uint32 compression)
|
|
|
|
{ fCompression = compression; }
|
|
|
|
void SetUncompressedSize(uint64 size)
|
|
|
|
{ fUncompressedSize = size; }
|
2009-11-14 21:08:33 +00:00
|
|
|
void SetChunkSize(uint32 size)
|
|
|
|
{ fChunkSize = size; }
|
2009-11-13 13:45:49 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
uint64 fCompressedSize;
|
|
|
|
uint64 fUncompressedSize;
|
|
|
|
union {
|
|
|
|
uint64 fOffset;
|
|
|
|
uint8 fInlineData[B_HPKG_MAX_INLINE_DATA_SIZE];
|
|
|
|
};
|
2009-11-14 21:08:33 +00:00
|
|
|
uint32 fChunkSize;
|
2009-11-13 13:45:49 +00:00
|
|
|
uint32 fCompression;
|
|
|
|
bool fEncodedInline;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // PACKAGE_DATA_H
|