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:
parent
d678a5c170
commit
297c0637ea
|
@ -5,7 +5,7 @@
|
||||||
#include <libsaria/library.h>
|
#include <libsaria/library.h>
|
||||||
#include "library.h"
|
#include "library.h"
|
||||||
|
|
||||||
void LibraryPath::(InFile &in, string dir)
|
LibraryPath::LibraryPath(InFile &in, string dir)
|
||||||
{
|
{
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace libsaria
|
||||||
{
|
{
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
string dir;
|
string dir;
|
||||||
list<LibraryPath> *path_list = get_library_paths();
|
list<LibraryPath> *path_list = get_path_list();
|
||||||
InFile in("library.lib");
|
InFile in("library.lib");
|
||||||
|
|
||||||
if (!in.good())
|
if (!in.good())
|
||||||
|
@ -51,7 +51,7 @@ namespace libsaria
|
||||||
void library::save()
|
void library::save()
|
||||||
{
|
{
|
||||||
OutFile out("library.lib");
|
OutFile out("library.lib");
|
||||||
list<LibraryPath> *path_list = get_library_paths();
|
list<LibraryPath> *path_list = get_path_list();
|
||||||
list<LibraryPath>::iterator it;
|
list<LibraryPath>::iterator it;
|
||||||
|
|
||||||
out.write_lui(path_list->size(), true);
|
out.write_lui(path_list->size(), true);
|
||||||
|
|
|
@ -11,21 +11,6 @@ using namespace std;
|
||||||
|
|
||||||
static list<LibraryPath> path_list;
|
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)
|
void LibraryPath::for_each(libsaria::SourceModel *model)
|
||||||
{
|
{
|
||||||
list<TrackTag>::iterator it;
|
list<TrackTag>::iterator it;
|
||||||
|
@ -83,6 +68,20 @@ bool LibraryPath::play_id(ino_t &id)
|
||||||
|
|
||||||
namespace libsaria
|
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)
|
void library::for_each(SourceModel *model)
|
||||||
{
|
{
|
||||||
|
|
|
@ -47,7 +47,13 @@ class ScanTask : public IdleTask
|
||||||
void run_task();
|
void run_task();
|
||||||
};
|
};
|
||||||
|
|
||||||
list<LibraryPath> *get_library_paths();
|
namespace libsaria
|
||||||
LibraryPath *get_library_path(string);
|
{
|
||||||
|
namespace library
|
||||||
|
{
|
||||||
|
list<LibraryPath> *get_path_list();
|
||||||
|
LibraryPath *get_path(string);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* LIBSARIA_LIBRARY_SOURCE_H */
|
#endif /* LIBSARIA_LIBRARY_SOURCE_H */
|
||||||
|
|
|
@ -97,13 +97,13 @@ namespace libsaria
|
||||||
{
|
{
|
||||||
void library::add_path(string dir)
|
void library::add_path(string dir)
|
||||||
{
|
{
|
||||||
get_library_paths()->push_back(LibraryPath(dir));
|
get_path_list()->push_back(LibraryPath(dir));
|
||||||
update_path(dir);
|
update_path(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void library::remove_path(string 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;
|
list<LibraryPath>::iterator it;
|
||||||
|
|
||||||
for (it = path_list->begin(); it != path_list->end(); it++) {
|
for (it = path_list->begin(); it != path_list->end(); it++) {
|
||||||
|
@ -118,6 +118,6 @@ namespace libsaria
|
||||||
|
|
||||||
void library::update_path(string dir)
|
void library::update_path(string dir)
|
||||||
{
|
{
|
||||||
get_library_path(dir)->update();
|
get_path(dir)->update();
|
||||||
}
|
}
|
||||||
}; /* Namespace: libsaria */
|
}; /* Namespace: libsaria */
|
||||||
|
|
Loading…
Reference in New Issue