CBouquetManager::ChannelIterator CBouquetManager::ChannelIterator::FindChannelNr(const unsigned int channel) { c = channel; for (b = 0; b < Owner->Bouquets.size(); b++) if (getBouquet()->size() > (unsigned int)c) goto end; else c -= getBouquet()->size(); c = -2; end: return (*this); }
CBouquetManager::ChannelIterator CBouquetManager::ChannelIterator::operator ++(int) { if (c != -2) // we can add if it's not the end marker { c++; if ((unsigned int) c >= getBouquet()->size()) { for (b++; b < Owner->Bouquets.size(); b++) if ( !getBouquet()->empty() ) { c = 0; goto end; } c = -2; } } end: return(*this); }
int CBouquetManager::ChannelIterator::getLowestChannelNumberWithChannelID(const t_channel_id channel_id) { int i = 0; for (b = 0; b < Owner->Bouquets.size(); b++) for (c = 0; (unsigned int) c < getBouquet()->size(); c++, i++) if ((**this)->getChannelID() == channel_id) return i; return -1; // not found }
int CBouquetManager::ChannelIterator::getNrofFirstChannelofBouquet(const unsigned int bouquet_nr) { if (bouquet_nr >= Owner->Bouquets.size()) return -1; // not found int i = 0; for (b = 0; b < bouquet_nr; b++) i += getBouquet()->size(); return i; }
CZapitChannel* CBouquetManager::ChannelIterator::operator *() { return (*getBouquet())[c]; // returns junk if we are an end marker !! }