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 #include "PathContainer.h" 13 #include "StyleContainer.h" 14 15 // constructor 16 Importer::Importer() 17 : fStyleIndexOffset(0), 18 fPathIndexOffset(0) 19 { 20 } 21 22 // destructor 23 Importer::~Importer() 24 { 25 } 26 27 // Export 28 status_t 29 Importer::Init(Icon* icon) 30 { 31 fStyleIndexOffset = 0; 32 fPathIndexOffset = 0; 33 34 if (!icon || icon->InitCheck() < B_OK) 35 return B_BAD_VALUE; 36 37 fStyleIndexOffset = icon->Styles()->CountStyles(); 38 fPathIndexOffset = icon->Paths()->CountPaths(); 39 40 return B_OK; 41 } 42 43 // StyleIndexFor 44 int32 45 Importer::StyleIndexFor(int32 savedIndex) const 46 { 47 return savedIndex + fStyleIndexOffset; 48 } 49 50 // PathIndexFor 51 int32 52 Importer::PathIndexFor(int32 savedIndex) const 53 { 54 return savedIndex + fPathIndexOffset; 55 } 56 57 58