1*7575abbcSIngo Weinhold /* 2*7575abbcSIngo Weinhold * Copyright 2009,2011, Haiku, Inc. 3*7575abbcSIngo Weinhold * Distributed under the terms of the MIT License. 4*7575abbcSIngo Weinhold */ 5*7575abbcSIngo Weinhold #ifndef _PACKAGE__HPKG__V1__PACKAGE_DATA_H_ 6*7575abbcSIngo Weinhold #define _PACKAGE__HPKG__V1__PACKAGE_DATA_H_ 7*7575abbcSIngo Weinhold 8*7575abbcSIngo Weinhold 9*7575abbcSIngo Weinhold #include <package/hpkg/v1/HPKGDefs.h> 10*7575abbcSIngo Weinhold 11*7575abbcSIngo Weinhold 12*7575abbcSIngo Weinhold namespace BPackageKit { 13*7575abbcSIngo Weinhold 14*7575abbcSIngo Weinhold namespace BHPKG { 15*7575abbcSIngo Weinhold 16*7575abbcSIngo Weinhold namespace V1 { 17*7575abbcSIngo Weinhold 18*7575abbcSIngo Weinhold 19*7575abbcSIngo Weinhold class BPackageData { 20*7575abbcSIngo Weinhold public: 21*7575abbcSIngo Weinhold BPackageData(); 22*7575abbcSIngo Weinhold CompressedSize()23*7575abbcSIngo Weinhold uint64 CompressedSize() const 24*7575abbcSIngo Weinhold { return fCompressedSize; } UncompressedSize()25*7575abbcSIngo Weinhold uint64 UncompressedSize() const 26*7575abbcSIngo Weinhold { return fUncompressedSize; } Offset()27*7575abbcSIngo Weinhold uint64 Offset() const 28*7575abbcSIngo Weinhold { return fEncodedInline ? 0 : fOffset; } Compression()29*7575abbcSIngo Weinhold uint32 Compression() const { return fCompression; } ChunkSize()30*7575abbcSIngo Weinhold uint32 ChunkSize() const { return fChunkSize; } 31*7575abbcSIngo Weinhold IsEncodedInline()32*7575abbcSIngo Weinhold bool IsEncodedInline() const 33*7575abbcSIngo Weinhold { return fEncodedInline; } InlineData()34*7575abbcSIngo Weinhold const uint8* InlineData() const { return fInlineData; } 35*7575abbcSIngo Weinhold 36*7575abbcSIngo Weinhold void SetData(uint64 size, uint64 offset); 37*7575abbcSIngo Weinhold void SetData(uint8 size, const void* data); 38*7575abbcSIngo Weinhold SetCompression(uint32 compression)39*7575abbcSIngo Weinhold void SetCompression(uint32 compression) 40*7575abbcSIngo Weinhold { fCompression = compression; } SetUncompressedSize(uint64 size)41*7575abbcSIngo Weinhold void SetUncompressedSize(uint64 size) 42*7575abbcSIngo Weinhold { fUncompressedSize = size; } SetChunkSize(uint32 size)43*7575abbcSIngo Weinhold void SetChunkSize(uint32 size) 44*7575abbcSIngo Weinhold { fChunkSize = size; } 45*7575abbcSIngo Weinhold 46*7575abbcSIngo Weinhold private: 47*7575abbcSIngo Weinhold uint64 fCompressedSize; 48*7575abbcSIngo Weinhold uint64 fUncompressedSize; 49*7575abbcSIngo Weinhold union { 50*7575abbcSIngo Weinhold uint64 fOffset; 51*7575abbcSIngo Weinhold uint8 fInlineData[B_HPKG_MAX_INLINE_DATA_SIZE]; 52*7575abbcSIngo Weinhold }; 53*7575abbcSIngo Weinhold uint32 fChunkSize; 54*7575abbcSIngo Weinhold uint32 fCompression; 55*7575abbcSIngo Weinhold bool fEncodedInline; 56*7575abbcSIngo Weinhold }; 57*7575abbcSIngo Weinhold 58*7575abbcSIngo Weinhold 59*7575abbcSIngo Weinhold } // namespace V1 60*7575abbcSIngo Weinhold 61*7575abbcSIngo Weinhold } // namespace BHPKG 62*7575abbcSIngo Weinhold 63*7575abbcSIngo Weinhold } // namespace BPackageKit 64*7575abbcSIngo Weinhold 65*7575abbcSIngo Weinhold 66*7575abbcSIngo Weinhold #endif // _PACKAGE__HPKG__V1__PACKAGE_DATA_H_ 67