libsaria: Rename path list accessor functions

I added these functions into the library namespace so I can remove the
"_library_" part of the function names.
This commit is contained in:
Bryan Schumaker 2011-11-06 11:36:12 -05:00
parent d678a5c170
commit 297c0637ea
4 changed files with 28 additions and 23 deletions

View File

@ -5,7 +5,7 @@
#include <libsaria/library.h>
#include "library.h"
void LibraryPath::(InFile &in, string dir)
LibraryPath::LibraryPath(InFile &in, string dir)
{
unsigned int size;
@ -35,7 +35,7 @@ namespace libsaria
{
unsigned int size;
string dir;
list<LibraryPath> *path_list = get_library_paths();
list<LibraryPath> *path_list = get_path_list();
InFile in("library.lib");
if (!in.good())
@ -51,7 +51,7 @@ namespace libsaria
void library::save()
{
OutFile out("library.lib");
list<LibraryPath> *path_list = get_library_paths();
list<LibraryPath> *path_list = get_path_list();
list<LibraryPath>::iterator it;
out.write_lui(path_list->size(), true);

View File

@ -11,21 +11,6 @@ using namespace std;
static list<LibraryPath> path_list;
list<LibraryPath> *get_library_paths()
{
return &path_list;
}
LibraryPath *get_library_path(string dir)
{
list<LibraryPath>::iterator it;
for (it = path_list.begin(); it != path_list.end(); it++) {
if (it->get_path() == dir)
return &(*it);
}
return NULL;
}
void LibraryPath::for_each(libsaria::SourceModel *model)
{
list<TrackTag>::iterator it;
@ -83,6 +68,20 @@ bool LibraryPath::play_id(ino_t &id)
namespace libsaria
{
list<LibraryPath> *library::get_path_list()
{
return &path_list;
}
LibraryPath *library::get_path(string dir)
{
list<LibraryPath>::iterator it;
for (it = path_list.begin(); it != path_list.end(); it++) {
if (it->get_path() == dir)
return &(*it);
}
return NULL;
}
void library::for_each(SourceModel *model)
{

View File

@ -47,7 +47,13 @@ class ScanTask : public IdleTask
void run_task();
};
list<LibraryPath> *get_library_paths();
LibraryPath *get_library_path(string);
namespace libsaria
{
namespace library
{
list<LibraryPath> *get_path_list();
LibraryPath *get_path(string);
}
}
#endif /* LIBSARIA_LIBRARY_SOURCE_H */

View File

@ -97,13 +97,13 @@ namespace libsaria
{
void library::add_path(string dir)
{
get_library_paths()->push_back(LibraryPath(dir));
get_path_list()->push_back(LibraryPath(dir));
update_path(dir);
}
void library::remove_path(string dir)
{
list<LibraryPath> *path_list = get_library_paths();
list<LibraryPath> *path_list = get_path_list();
list<LibraryPath>::iterator it;
for (it = path_list->begin(); it != path_list->end(); it++) {
@ -118,6 +118,6 @@ namespace libsaria
void library::update_path(string dir)
{
get_library_path(dir)->update();
get_path(dir)->update();
}
}; /* Namespace: libsaria */