83 lines
1.6 KiB
C++
83 lines
1.6 KiB
C++
// Copyright (c) 2012 Bryan Schumaker.
|
|
#ifndef LIBSARIA_PLAYLIST_H
|
|
#define LIBSARIA_PLAYLIST_H
|
|
|
|
#include <notify.h>
|
|
#include <fs.h>
|
|
|
|
#include <list>
|
|
#include <string>
|
|
#include <vector>
|
|
using namespace std;
|
|
|
|
enum PlaylistFlags {
|
|
PL_NONE = (0),
|
|
PL_NO_DRAIN = (1 << 0),
|
|
PL_STATIC = (1 << 1),
|
|
PL_DISABLED = (1 << 2),
|
|
PL_RANDOM = (1 << 3),
|
|
PL_SORTED = (1 << 4),
|
|
};
|
|
|
|
namespace libsaria
|
|
{
|
|
|
|
/* Forward declaration of Track class */
|
|
class Track;
|
|
|
|
class Playlist {
|
|
private:
|
|
int number;
|
|
unsigned int flags;
|
|
DataState data_state;
|
|
unsigned int cur;
|
|
vector<Track *> plist;
|
|
|
|
void schedule_save();
|
|
void rm_file();
|
|
void notify_ui(notify_t, Track *, unsigned int);
|
|
void notify_update_all();
|
|
|
|
unsigned int find_index(Track *);
|
|
void add_track(Track *, unsigned int);
|
|
void insert_sorted(Track *);
|
|
void remove_index(unsigned int);
|
|
void do_sort();
|
|
|
|
public:
|
|
Playlist(unsigned int);
|
|
virtual ~Playlist();
|
|
|
|
void push_front(Track *);
|
|
void push_back(Track *);
|
|
void push_back(list<Track *> &);
|
|
Track *next();
|
|
|
|
void set_flag(PlaylistFlags, bool);
|
|
bool check_flag(PlaylistFlags);
|
|
|
|
void save(ofstream &);
|
|
void prepare_for_removal();
|
|
void reset_iterator();
|
|
|
|
void renumber(int);
|
|
unsigned int get_number();
|
|
unsigned int get_size();
|
|
unsigned int get_length();
|
|
|
|
void remove_indices(list<unsigned int> &);
|
|
void remove_track(Track *);
|
|
void track_updated(Track *);
|
|
};
|
|
|
|
|
|
struct PlaylistNotification {
|
|
Playlist *plist;
|
|
Track *track;
|
|
unsigned int index;
|
|
};
|
|
|
|
}; /* Namespace: libsaria */
|
|
|
|
#endif /* LIBSARIA_PLAYLIST_H */
|