xref: /haiku/src/apps/haikudepot/model/IconTarPtr.h (revision 899e0ef82b5624ace2ccfa5f5a58c8ebee54aaef)
1 /*
2  * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 #ifndef ICON_TAR_PTR_H
6 #define ICON_TAR_PTR_H
7 
8 #include <stdlib.h>
9 
10 #include <Referenceable.h>
11 #include <String.h>
12 
13 #include "HaikuDepotConstants.h"
14 
15 
16 /*!	The tar icon repository is able to find the icons for each package by
17 	scanning the tar file for suitable icon files and recording the offsets into
18 	the tar file when it does find a suitable icon file.  This class is used
19 	to return the offsets for a given package.
20 */
21 
22 class IconTarPtr : public BReferenceable {
23 public:
24 								IconTarPtr(const BString& name);
25 	virtual						~IconTarPtr();
26 
27 	const	BString&			Name() const;
28 			bool				HasOffset(BitmapSize size) const;
29 			off_t				Offset(BitmapSize size) const;
30 			void				SetOffset(BitmapSize size, off_t value);
31 
32 private:
33 			BString				fName;
34 			uint8				fOffsetsMask;
35 			off_t				fOffsets[5];
36 };
37 
38 #endif // ICON_TAR_PTR_H