/* $Id: itemset.cpp,v 1.4 2005/06/28 13:55:20 chfreund Exp $ */ #include "itemset.hpp" /**********************************************************/ template ItemSet::ItemSet() { } /**********************************************************/ template ItemSet::~ItemSet() { reset(); } /**********************************************************/ template void ItemSet::reset() { PointerVector::reset(); } /**********************************************************/ template bool ItemSet::load( const char* const filename, const char* const section ) { const char fn[] = "ItemSet::load:"; SettingDataBase settings; // read the settings settings.restrictToSection( section ); if( !CHECK( settings.readSettings(T::getSettingDef(), filename), "%s could not load set from section \"%s\" in " "file \"%s\"\n", fn, section, filename ) || !CHECK( settings.finalCheck(T::getSettingDef()), "%s final check of settings failed\n" ) || !CHECK( T::checkSettings(settings), "%s type specific check failed\n" ) ) { return false; } T *item = 0x0; Sint32 pos = 0; // build items from the settings while( 1 ) { if( !CHECK( 0x0 != (item = NEW T), "%s could not create item object [%d]\n", fn, PointerVector::getSize() ) ) { return false; } if( !CHECK( item->readFromSettings(settings, pos), "%s item [%d] could not read its content\n", fn, PointerVector::getSize() ) || !CHECK( PointerVector::append(item), "%s could not append new item [%d] in vector\n", fn, PointerVector::getSize() ) ) { delete item; return false; } if( pos < 0 ) break; } return true; } /**********************************************************/