/** * Copyright 2013 (c) Anna Schumaker. */ #ifndef OCARINA_CORE_DECK_H #define OCARINA_CORE_DECK_H #include #include /** * A TempQueue is a wrapper around the Queue class that * allows us to save the list of queues when necessary. */ class TempQueue : public Queue { public: TempQueue(); TempQueue(bool random); void set_flag(queue_flags); void unset_flag(queue_flags); unsigned int add(Track *); void del(Track *); void del(unsigned int); void sort(sort_t, bool); }; /** * The deck is used to hold temporary queues created by the user. This * code is also in charge of maintaining a "recently played" queue of * songs that have just played. * * When saving to disk: * ... << deck.size() << endl; * ... << deck[0] << endl; * ... * ... << deck[N] <<< endl; */ namespace deck { /** * Read the deck file from disk and restore the queues. */ void init(); /** * Save the current queues to a file on disk. */ void write(); /** * Create a new queue at the end of the deck. * * @param random Set to true if the new queue should return a random * track when queue->next() is called. * @return The newly created queue. */ Queue *create(bool); /** * Removes the queue from the deck. * * @param queue The queue to be removed. */ void destroy(Queue *); /** * Move the queue to a new location in the deck. * * @param queue The queue to be moved. * @param index The new index of the queue. */ void move(Queue *, unsigned int); /** * Find the index of the requested queue. * * @param queue The queue in question. * @return The index of the requested queue. */ unsigned int index(Queue *); /** * Access the queue at the specified index. * * @param index The index of the queue that should be accessed. * @return The queue at the requested index. */ Queue *get(unsigned int); /** * @return A track from the first enabled queue. If no queues are * enabled, return a track from the Library. */ Track *next(); /** * @return A track from the recent tracks queue. */ Track *prev(); /** * @return The deck of queues. */ std::list &get_queues(); /** * @return The queue of recent tracks. */ Queue *get_queue(); }; #endif /* OCARINA_CORE_DECK_H */