Visitor: Generating Playlists
Visitor Generating Playlists
- Command line arguments (Section 1.8.1)
- Visitor pattern (Section 8.1)
In the http://oop.mcs.suffolk.edu/dist folder, you will find filetagger.tar.gz, which contains interfaces PlayListModel and Mp3Song, as well as other classes you might reuse for future assignments. The assignment is to write a Playlist class and a program that generates instances of them by scanning directories for MP3 files. The program should be called playgen. Figure 25.4 shows how the interfaces are related to PlayList.
Figure 25.4. PlayList and PlayListModel
playgen (the application) should have a class called PlayGen, containing a PlayList* scan(QString dirname) that returns a new PlayList containing references to each song.
Usage:
playgen dirname
The program should print out the name of each file that it finds (on a line by itself). But it should do this by first loading the PlayList and then displaying the string produced by PlayList::toString().
| Classes you can reuse: QFile and QFileInfo, or FileVisitor. |
Категории