void MusicCollection::displayArtists() {
	std::cout << "\nArtists\n-----------------------------\n";
	MusicArtistIterator ia = getArtists();
	while( ia.hasNext() ) {
		MusicArtist *artist = ia.next().value();
		std::cout << artist->getName() << std::endl;

		MusicAlbumIterator il = artist->getAlbums();
		while( il.hasNext() ) {
			MusicAlbum *album = il.next().value();
			std::cout << "\t#" << album->getName() << std::endl;

			MusicTrackIterator it = album->getTracks();
			while( it.hasNext() ) {
				MusicTrack *track = it.next();
				std::cout << "\t\t-" << track->getTitle() << std::endl;
			}
		}

		MusicTrackIterator it = artist->getTracks();
		while( it.hasNext() ) {
			MusicTrack *track = it.next();
			std::cout << "\t$" << track->getTitle() << std::endl;
		}
	}
}
示例#2
0
MusicArtist::~MusicArtist() {
  MusicAlbumIterator album = getAlbums();
  while ( album.hasNext() ) {
    MusicAlbum *a = album.next().value();
    delete a;
  }
  _albums->clear();
  delete _albums;
}