1 /* 2 * Copyright 2006, Haiku. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 * 5 * Authors: 6 * Stephan Aßmus <superstippi@gmx.de> 7 */ 8 9 #include "Importer.h" 10 11 #include "Icon.h" 12 13 // constructor 14 Importer::Importer() 15 : fStyleIndexOffset(0), 16 fPathIndexOffset(0) 17 { 18 } 19 20 // destructor 21 Importer::~Importer() 22 { 23 } 24 25 // Export 26 status_t 27 Importer::Init(Icon* icon) 28 { 29 fStyleIndexOffset = 0; 30 fPathIndexOffset = 0; 31 32 if (!icon || icon->InitCheck() < B_OK) 33 return B_BAD_VALUE; 34 35 fStyleIndexOffset = icon->Styles()->CountItems(); 36 fPathIndexOffset = icon->Paths()->CountItems(); 37 38 return B_OK; 39 } 40 41 // StyleIndexFor 42 int32 43 Importer::StyleIndexFor(int32 savedIndex) const 44 { 45 return savedIndex + fStyleIndexOffset; 46 } 47 48 // PathIndexFor 49 int32 50 Importer::PathIndexFor(int32 savedIndex) const 51 { 52 return savedIndex + fPathIndexOffset; 53 } 54 55 56