/* * Copyright 2013 (c) Anna Schumaker. */ #ifndef OCARINA_QUEUE_H #define OCARINA_QUEUE_H #include #include #include #include enum queue_flags { Q_ENABLED = (1 << 0), Q_RANDOM = (1 << 1), Q_REPEAT = (1 << 2), Q_NEVER_SORT = (1 << 3), Q_DISABLE_CHANGED_SIZE = (1 << 31), }; struct sort_info { sort_t field; bool ascending; }; class Queue { private: std :: vector tracks; std :: list sort_order; unsigned int flags; unsigned int cur; unsigned int length; unsigned int find_sorted_id(Track *); void _add_sort(sort_t, bool); public: Queue(); Queue(queue_flags); ~Queue(); void write(File &); void read(File &); void set_flag(queue_flags); void unset_flag(queue_flags); const unsigned int get_flags(); unsigned int get_length(); std::string get_length_str(); unsigned int add(unsigned int); unsigned int add_front(unsigned int); void del(unsigned int); void del_track(unsigned int); void track_updated(unsigned int); unsigned int size(); void add_sort(sort_t, bool ascending = true); void reset_sort(sort_t, bool ascending = true); void force_clear_sort(); std::list &get_sort_order(); unsigned int operator[](unsigned int); unsigned int next(); void set_cur(unsigned int); void path_selected(unsigned int); #ifdef CONFIG_TEST void reset(); #endif /* CONFIG_TEST */ }; #endif /* OCARINA_QUEUE_H */