libsaria: Fill a SourceModel from the play_list

Looping over a single list is really easy and straightforward!
This commit is contained in:
Bryan Schumaker 2011-11-06 12:44:14 -05:00
parent cdcaaeb8c8
commit 5b2e0c7b82
4 changed files with 9 additions and 18 deletions

View File

@ -27,13 +27,6 @@ namespace libsaria
return NULL;
}
void library::for_each(SourceModel *model)
{
list<LibraryPath>::iterator it;
for (it = path_list.begin(); it != path_list.end(); it++)
it->for_each(model);
}
void library::for_each_path(void (*info_func)(struct library::PathInfo &))
{
list<LibraryPath>::iterator it;

View File

@ -23,7 +23,6 @@ class LibraryPath
~LibraryPath();
list<TrackTag> *get_list();
void for_each(libsaria::SourceModel *);
string get_path();
void get_info(void (*)(struct libsaria::library::PathInfo &));
bool get_info_id(ino_t &, void (*)(Track &));

View File

@ -24,6 +24,15 @@ namespace libsaria
println("Rebuilding play list");
}
void library::for_each(SourceModel *model)
{
list<TrackTag>::iterator it;
for (it = play_list.begin(); it != play_list.end(); it++) {
Track track = Track(&(*it));
model->insert(track);
}
}
unsigned int library::size()
{
return play_list.size();

View File

@ -6,16 +6,6 @@ using namespace std;
#include <libsaria/library.h>
#include "library.h"
void LibraryPath::for_each(libsaria::SourceModel *model)
{
list<TrackTag>::iterator it;
for (it = file_list.begin(); it != file_list.end(); it++) {
Track track = Track(&(*it));
model->insert(track);
}
}
string LibraryPath::get_path()
{
return path;