xref: /haiku/headers/os/package/hpkg/PackageData.h (revision 9f81ca838ce7b92b5689e57d3f86765db4705a7b)
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 
12 namespace BPackageKit {
13 
14 namespace BHPKG {
15 
16 
17 class BPackageData {
18 public:
19 								BPackageData();
20 
Size()21 			uint64				Size() const
22 									{ return fSize; }
Offset()23 			uint64				Offset() const
24 									{ return fEncodedInline ? 0 : fOffset; }
25 
IsEncodedInline()26 			bool				IsEncodedInline() const
27 									{ return fEncodedInline; }
InlineData()28 			const uint8*		InlineData() const		{ return fInlineData; }
29 
30 			void				SetData(uint64 size, uint64 offset);
31 			void				SetData(uint8 size, const void* data);
32 
33 private:
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