diff options
Diffstat (limited to '')
-rw-r--r-- | src/OtherCommands.cxx | 2 | ||||
-rw-r--r-- | src/PlaylistCommands.cxx | 3 | ||||
-rw-r--r-- | src/PlaylistFile.cxx | 10 | ||||
-rw-r--r-- | src/PlaylistFile.hxx | 13 | ||||
-rw-r--r-- | src/PlaylistInfo.hxx | 2 | ||||
-rw-r--r-- | src/PlaylistVector.hxx | 1 |
6 files changed, 15 insertions, 16 deletions
diff --git a/src/OtherCommands.cxx b/src/OtherCommands.cxx index 32d51c42e..9de616759 100644 --- a/src/OtherCommands.cxx +++ b/src/OtherCommands.cxx @@ -57,7 +57,7 @@ extern "C" { #include <string.h> static void -print_spl_list(Client *client, const PlaylistFileList &list) +print_spl_list(Client *client, const PlaylistVector &list) { for (const auto &i : list) { client_printf(client, "playlist: %s\n", i.name.c_str()); diff --git a/src/PlaylistCommands.cxx b/src/PlaylistCommands.cxx index a684e4a3b..d2defff3f 100644 --- a/src/PlaylistCommands.cxx +++ b/src/PlaylistCommands.cxx @@ -24,6 +24,7 @@ #include "PlaylistPrint.hxx" #include "PlaylistSave.hxx" #include "PlaylistFile.hxx" +#include "PlaylistVector.hxx" #include "PlaylistQueue.hxx" #include "TimePrint.hxx" #include "ClientInternal.hxx" @@ -40,7 +41,7 @@ extern "C" { #include <stdlib.h> static void -print_spl_list(Client *client, const PlaylistFileList &list) +print_spl_list(Client *client, const PlaylistVector &list) { for (const auto &i : list) { client_printf(client, "playlist: %s\n", i.name.c_str()); diff --git a/src/PlaylistFile.cxx b/src/PlaylistFile.cxx index 03cd59d67..de12518d9 100644 --- a/src/PlaylistFile.cxx +++ b/src/PlaylistFile.cxx @@ -20,6 +20,8 @@ #include "config.h" #include "PlaylistFile.hxx" #include "PlaylistSave.hxx" +#include "PlaylistInfo.hxx" +#include "PlaylistVector.hxx" #include "DatabasePlugin.hxx" #include "DatabaseGlue.hxx" #include "song.h" @@ -140,7 +142,7 @@ playlist_errno(GError **error_r) } static bool -LoadPlaylistFileInfo(PlaylistFileInfo &info, +LoadPlaylistFileInfo(PlaylistInfo &info, const char *parent_path_fs, const char *name_fs) { size_t name_length = strlen(name_fs); @@ -172,10 +174,10 @@ LoadPlaylistFileInfo(PlaylistFileInfo &info, return true; } -PlaylistFileList +PlaylistVector ListPlaylistFiles(GError **error_r) { - PlaylistFileList list; + PlaylistVector list; const char *parent_path_fs = spl_map(error_r); if (parent_path_fs == NULL) @@ -187,7 +189,7 @@ ListPlaylistFiles(GError **error_r) return list; } - PlaylistFileInfo info; + PlaylistInfo info; struct dirent *ent; while ((ent = readdir(dir)) != NULL) { if (LoadPlaylistFileInfo(info, parent_path_fs, ent->d_name)) diff --git a/src/PlaylistFile.hxx b/src/PlaylistFile.hxx index 6df5a46d3..3f63253ad 100644 --- a/src/PlaylistFile.hxx +++ b/src/PlaylistFile.hxx @@ -20,7 +20,6 @@ #ifndef MPD_PLAYLIST_FILE_HXX #define MPD_PLAYLIST_FILE_HXX -#include <list> #include <vector> #include <string> @@ -28,14 +27,8 @@ #include <time.h> struct song; - -struct PlaylistFileInfo { - std::string name; - - time_t mtime; -}; - -typedef std::list<PlaylistFileInfo> PlaylistFileList; +struct PlaylistInfo; +class PlaylistVector; typedef std::vector<std::string> PlaylistFileContents; @@ -60,7 +53,7 @@ spl_valid_name(const char *name_utf8); * Returns a list of stored_playlist_info struct pointers. Returns * NULL if an error occurred. */ -PlaylistFileList +PlaylistVector ListPlaylistFiles(GError **error_r); PlaylistFileContents diff --git a/src/PlaylistInfo.hxx b/src/PlaylistInfo.hxx index a50cdd445..96e4f6db9 100644 --- a/src/PlaylistInfo.hxx +++ b/src/PlaylistInfo.hxx @@ -50,6 +50,8 @@ struct PlaylistInfo { } }; + PlaylistInfo() = default; + template<typename N> PlaylistInfo(N &&_name, time_t _mtime) :name(std::forward<N>(_name)), mtime(_mtime) {} diff --git a/src/PlaylistVector.hxx b/src/PlaylistVector.hxx index 0a4cd95b3..d10c90fda 100644 --- a/src/PlaylistVector.hxx +++ b/src/PlaylistVector.hxx @@ -37,6 +37,7 @@ public: using std::list<PlaylistInfo>::empty; using std::list<PlaylistInfo>::begin; using std::list<PlaylistInfo>::end; + using std::list<PlaylistInfo>::push_back; using std::list<PlaylistInfo>::erase; /** |