xref: /haiku/src/apps/haikudepot/model/IconTarPtr.cpp (revision f0e491d390a4514633f1af4da4c46a7dad67ebec)
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 
IconTarPtr(const BString & name)9 IconTarPtr::IconTarPtr(const BString& name)
10 	:
11 	fName(name),
12 	fOffsetsMask(0)
13 {
14 }
15 
16 
~IconTarPtr()17 IconTarPtr::~IconTarPtr()
18 {
19 }
20 
21 
22 const BString&
Name() const23 IconTarPtr::Name() const
24 {
25 	return fName;
26 }
27 
28 
29 off_t
Offset(BitmapSize size) const30 IconTarPtr::Offset(BitmapSize size) const
31 {
32 	return fOffsets[size];
33 }
34 
35 
36 bool
HasOffset(BitmapSize size) const37 IconTarPtr::HasOffset(BitmapSize size) const
38 {
39 	return 0 != (fOffsetsMask & (1 << size));
40 }
41 
42 
43 void
SetOffset(BitmapSize size,off_t value)44 IconTarPtr::SetOffset(BitmapSize size, off_t value)
45 {
46 	fOffsets[size] = value;
47 	fOffsetsMask |= (1 << size);
48 }
49