libsaria: Create iterator functions for the queue
This commit is contained in:
parent
3749b56bfd
commit
fe8c1cd580
|
@ -9,6 +9,12 @@ namespace libsaria
|
|||
{
|
||||
namespace queue
|
||||
{
|
||||
namespace iter
|
||||
{
|
||||
void reset();
|
||||
libsaria::Track *next();
|
||||
bool end();
|
||||
}
|
||||
|
||||
void add_ids(list<sid_t> &);
|
||||
void for_each(SourceModel *);
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/queue.h>
|
||||
#include "queue.h"
|
||||
|
||||
static deque<sid_t>::iterator it;
|
||||
|
||||
namespace libsaria
|
||||
{
|
||||
namespace queue
|
||||
{
|
||||
|
||||
void iter::reset()
|
||||
{
|
||||
it = playqueue.begin();
|
||||
}
|
||||
|
||||
libsaria::Track *iter::next()
|
||||
{
|
||||
Track *track = library::get_info(*it);
|
||||
it++;
|
||||
return track;
|
||||
}
|
||||
|
||||
bool iter::end()
|
||||
{
|
||||
return it == playqueue.end();
|
||||
}
|
||||
|
||||
}; /* Namespace: queue */
|
||||
} /* Namespace: libsaria */
|
|
@ -6,8 +6,9 @@ using namespace std;
|
|||
#include <libsaria/queue.h>
|
||||
#include <libsaria/library.h>
|
||||
#include <libsaria/callback.h>
|
||||
#include "queue.h"
|
||||
|
||||
static deque<sid_t> playqueue;
|
||||
deque<sid_t> playqueue;
|
||||
|
||||
static void pop_queue(sid_t &inode)
|
||||
{
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
#ifndef LIBSARIA_QUEUE_INTERNAL_H
|
||||
#define LIBSARIA_QUEUE_INTERNAL_H
|
||||
|
||||
#include <libsaria/track.h>
|
||||
|
||||
#include <queue>
|
||||
using namespace std;
|
||||
|
||||
extern deque<sid_t> playqueue;
|
||||
|
||||
#endif /* LIBSARIA_QUEUE_INTERNAL_H */
|
Loading…
Reference in New Issue