libsaria: Fill out a struct PathInfo
This struct is used by the gui to show how large a library path is and eventually to remove it from the library.
This commit is contained in:
parent
e8341288b3
commit
2a6d05ebee
|
@ -11,6 +11,11 @@ namespace libsaria
|
||||||
{
|
{
|
||||||
namespace library
|
namespace library
|
||||||
{
|
{
|
||||||
|
struct PathInfo {
|
||||||
|
string path;
|
||||||
|
unsigned int size;
|
||||||
|
};
|
||||||
|
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
void refresh();
|
void refresh();
|
||||||
|
@ -18,6 +23,7 @@ namespace libsaria
|
||||||
void add_path(string);
|
void add_path(string);
|
||||||
void play_id(ino_t);
|
void play_id(ino_t);
|
||||||
void for_each(void (*)(Track &));
|
void for_each(void (*)(Track &));
|
||||||
|
void for_each_path(void (*)(struct PathInfo &));
|
||||||
|
|
||||||
unsigned int size();
|
unsigned int size();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,14 @@ void LibraryPath::for_each(void (*ins_func)(Track &))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LibraryPath::get_info(void (*info_func)(struct libsaria::library::PathInfo &))
|
||||||
|
{
|
||||||
|
struct libsaria::library::PathInfo info;
|
||||||
|
info.path = path;
|
||||||
|
info.size = size();
|
||||||
|
info_func(info);
|
||||||
|
}
|
||||||
|
|
||||||
bool LibraryPath::play_id(ino_t id)
|
bool LibraryPath::play_id(ino_t id)
|
||||||
{
|
{
|
||||||
map<ino_t, TrackTag>::iterator it;
|
map<ino_t, TrackTag>::iterator it;
|
||||||
|
@ -54,6 +62,13 @@ namespace libsaria
|
||||||
it->second.for_each(ins_func);
|
it->second.for_each(ins_func);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void library::for_each_path(void (*info_func)(struct library::PathInfo &))
|
||||||
|
{
|
||||||
|
map<string, LibraryPath>::iterator it;
|
||||||
|
for (it = path_map.begin(); it != path_map.end(); it++)
|
||||||
|
it->second.get_info(info_func);
|
||||||
|
}
|
||||||
|
|
||||||
void library::play_id(ino_t id)
|
void library::play_id(ino_t id)
|
||||||
{
|
{
|
||||||
map<string, LibraryPath>::iterator it;
|
map<string, LibraryPath>::iterator it;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
#include <libsaria/library.h>
|
||||||
#include <libsaria/path.h>
|
#include <libsaria/path.h>
|
||||||
|
|
||||||
class LibraryPath
|
class LibraryPath
|
||||||
|
@ -19,6 +20,7 @@ class LibraryPath
|
||||||
~LibraryPath();
|
~LibraryPath();
|
||||||
|
|
||||||
void for_each(void (*)(Track &));
|
void for_each(void (*)(Track &));
|
||||||
|
void get_info(void (*)(struct libsaria::library::PathInfo &));
|
||||||
void insert_track(ino_t, TrackTag &);
|
void insert_track(ino_t, TrackTag &);
|
||||||
bool play_id(ino_t);
|
bool play_id(ino_t);
|
||||||
void save(OutFile &);
|
void save(OutFile &);
|
||||||
|
|
Loading…
Reference in New Issue