1/*
2 * Copyright 2009,2011, Haiku, Inc.
3 * Distributed under the terms of the MIT License.
4 */
5#ifndef _PACKAGE__HPKG__PACKAGE_DATA_H_
6#define _PACKAGE__HPKG__PACKAGE_DATA_H_
7
8
9#include <package/hpkg/HPKGDefs.h>
10
11
12namespace BPackageKit {
13
14namespace BHPKG {
15
16
17class BPackageData {
18public:
19								BPackageData();
20
21			uint64				Size() const
22									{ return fSize; }
23			uint64				Offset() const
24									{ return fEncodedInline ? 0 : fOffset; }
25
26			bool				IsEncodedInline() const
27									{ return fEncodedInline; }
28			const uint8*		InlineData() const		{ return fInlineData; }
29
30			void				SetData(uint64 size, uint64 offset);
31			void				SetData(uint8 size, const void* data);
32
33private:
34			uint64				fSize : 63;
35			bool				fEncodedInline : 1;
36			union {
37				uint64			fOffset;
38				uint8			fInlineData[B_HPKG_MAX_INLINE_DATA_SIZE];
39			};
40};
41
42
43}	// namespace BHPKG
44
45}	// namespace BPackageKit
46
47
48#endif	// _PACKAGE__HPKG__PACKAGE_DATA_H_
49