ocarina/libsaria/library/path.cpp

50 lines
756 B
C++

#include <string>
using namespace std;
#include <libsaria/library.h>
#include "library.h"
/*
* Definitions for the LibraryPath class
*/
LibraryPath::LibraryPath(string dir)
{
path = dir;
}
LibraryPath::~LibraryPath()
{
}
unsigned int LibraryPath::size()
{
return file_list.size();
}
namespace libsaria
{
void library::add_path(string dir)
{
get_path_list()->push_back(LibraryPath(dir));
update_path(dir);
}
void library::remove_path(string dir)
{
list<LibraryPath> *path_list = get_path_list();
list<LibraryPath>::iterator it;
for (it = path_list->begin(); it != path_list->end(); it++) {
if (it->get_path() == dir) {
path_list->erase(it);
save();
refresh();
return;
}
}
}
}; /* Namespace: libsaria */