diff options
Diffstat (limited to '')
-rw-r--r-- | src/PlaylistVector.hxx | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/src/PlaylistVector.hxx b/src/PlaylistVector.hxx index 14445315c..0a4cd95b3 100644 --- a/src/PlaylistVector.hxx +++ b/src/PlaylistVector.hxx @@ -21,43 +21,35 @@ #define MPD_PLAYLIST_VECTOR_HXX #include "PlaylistInfo.hxx" -#include "util/list.h" - -#include <sys/time.h> - -#define playlist_vector_for_each(pos, head) \ - list_for_each_entry(pos, head, siblings) - -#define playlist_vector_for_each_safe(pos, n, head) \ - list_for_each_entry_safe(pos, n, head, siblings) - -void -playlist_vector_deinit(struct list_head *pv); - -/** - * Caller must lock the #db_mutex. - */ -PlaylistInfo * -playlist_vector_find(struct list_head *pv, const char *name); - -/** - * Caller must lock the #db_mutex. - */ -void -playlist_vector_add(struct list_head *pv, PlaylistInfo &&pi); - -/** - * Caller must lock the #db_mutex. - * - * @return true if the vector or one of its items was modified - */ -bool -playlist_vector_update_or_add(struct list_head *pv, PlaylistInfo &&pi); - -/** - * Caller must lock the #db_mutex. - */ -bool -playlist_vector_remove(struct list_head *pv, const char *name); +#include "gcc.h" + +#include <list> + +class PlaylistVector : protected std::list<PlaylistInfo> { +protected: + /** + * Caller must lock the #db_mutex. + */ + gcc_pure + iterator find(const char *name); + +public: + using std::list<PlaylistInfo>::empty; + using std::list<PlaylistInfo>::begin; + using std::list<PlaylistInfo>::end; + using std::list<PlaylistInfo>::erase; + + /** + * Caller must lock the #db_mutex. + * + * @return true if the vector or one of its items was modified + */ + bool UpdateOrInsert(PlaylistInfo &&pi); + + /** + * Caller must lock the #db_mutex. + */ + bool erase(const char *name); +}; #endif /* SONGVEC_H */ |