xref: /haiku/src/apps/haikudepot/model/IconTarPtr.cpp (revision 6011ce6c7495e4e707bd33b12a7e22d66c710aad)
1 /*
2  * Copyright 2020, Andrew Lindesay <apl@lindesay.co.nz>.
3  * All rights reserved. Distributed under the terms of the MIT License.
4  */
5 
6 #include "IconTarPtr.h"
7 
8 
9 IconTarPtr::IconTarPtr(const BString& name)
10 	:
11 	fName(name),
12 	fOffsetsMask(0)
13 {
14 }
15 
16 
17 IconTarPtr::~IconTarPtr()
18 {
19 }
20 
21 
22 const BString&
23 IconTarPtr::Name() const
24 {
25 	return fName;
26 }
27 
28 
29 off_t
30 IconTarPtr::Offset(BitmapSize size) const
31 {
32 	return fOffsets[size];
33 }
34 
35 
36 bool
37 IconTarPtr::HasOffset(BitmapSize size) const
38 {
39 	return 0 != (fOffsetsMask & (1 << size));
40 }
41 
42 
43 void
44 IconTarPtr::SetOffset(BitmapSize size, off_t value)
45 {
46 	fOffsets[size] = value;
47 	fOffsetsMask |= (1 << size);
48 }
49