haiku/headers/os/package/hpkg/v1/PackageData.h
Ingo Weinhold 7575abbca2 Clone read support functionality for HPKG format version 1
It uses sub-namespace BPackage::BHPKG::V1. Unlike the one for the
current format version, the V1 version of BPackageInfoContentHandler
lives in BHPKG(::V1) sub-namespace and is private.
2013-05-25 01:12:22 +02:00

67 lines
1.5 KiB
C++

/*
* Copyright 2009,2011, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__HPKG__V1__PACKAGE_DATA_H_
#define _PACKAGE__HPKG__V1__PACKAGE_DATA_H_
#include <package/hpkg/v1/HPKGDefs.h>
namespace BPackageKit {
namespace BHPKG {
namespace V1 {
class BPackageData {
public:
BPackageData();
uint64 CompressedSize() const
{ return fCompressedSize; }
uint64 UncompressedSize() const
{ return fUncompressedSize; }
uint64 Offset() const
{ return fEncodedInline ? 0 : fOffset; }
uint32 Compression() const { return fCompression; }
uint32 ChunkSize() const { return fChunkSize; }
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; }
void SetChunkSize(uint32 size)
{ fChunkSize = size; }
private:
uint64 fCompressedSize;
uint64 fUncompressedSize;
union {
uint64 fOffset;
uint8 fInlineData[B_HPKG_MAX_INLINE_DATA_SIZE];
};
uint32 fChunkSize;
uint32 fCompression;
bool fEncodedInline;
};
} // namespace V1
} // namespace BHPKG
} // namespace BPackageKit
#endif // _PACKAGE__HPKG__V1__PACKAGE_DATA_H_