mpd: get rid of *List typedefs
This commit is contained in:
@@ -63,8 +63,8 @@ bool isRootDirectory(const std::string &directory);
|
|||||||
bool isHidden(const fs::directory_iterator &entry);
|
bool isHidden(const fs::directory_iterator &entry);
|
||||||
bool hasSupportedExtension(const fs::directory_entry &entry);
|
bool hasSupportedExtension(const fs::directory_entry &entry);
|
||||||
MPD::Song getLocalSong(const fs::directory_entry &entry, bool read_tags);
|
MPD::Song getLocalSong(const fs::directory_entry &entry, bool read_tags);
|
||||||
void getLocalDirectory(MPD::ItemList &items, const std::string &directory);
|
void getLocalDirectory(std::vector<MPD::Item> &items, const std::string &directory);
|
||||||
void getLocalDirectoryRecursively(MPD::SongList &songs, const std::string &directory);
|
void getLocalDirectoryRecursively(std::vector<MPD::Song> &songs, const std::string &directory);
|
||||||
void clearDirectory(const std::string &directory);
|
void clearDirectory(const std::string &directory);
|
||||||
|
|
||||||
std::string itemToString(const MPD::Item &item);
|
std::string itemToString(const MPD::Item &item);
|
||||||
@@ -144,7 +144,7 @@ void Browser::enterPressed()
|
|||||||
}
|
}
|
||||||
case MPD::Item::Type::Playlist:
|
case MPD::Item::Type::Playlist:
|
||||||
{
|
{
|
||||||
MPD::SongList list(
|
std::vector<MPD::Song> list(
|
||||||
std::make_move_iterator(Mpd.GetPlaylistContentNoInfo(item.playlist().path())),
|
std::make_move_iterator(Mpd.GetPlaylistContentNoInfo(item.playlist().path())),
|
||||||
std::make_move_iterator(MPD::SongIterator())
|
std::make_move_iterator(MPD::SongIterator())
|
||||||
);
|
);
|
||||||
@@ -183,7 +183,7 @@ void Browser::spacePressed()
|
|||||||
bool success = true;
|
bool success = true;
|
||||||
if (m_local_browser)
|
if (m_local_browser)
|
||||||
{
|
{
|
||||||
MPD::SongList songs;
|
std::vector<MPD::Song> songs;
|
||||||
getLocalDirectoryRecursively(songs, item.directory().path());
|
getLocalDirectoryRecursively(songs, item.directory().path());
|
||||||
success = addSongsToPlaylist(songs.begin(), songs.end(), false, -1);
|
success = addSongsToPlaylist(songs.begin(), songs.end(), false, -1);
|
||||||
}
|
}
|
||||||
@@ -338,9 +338,9 @@ void Browser::reverseSelection()
|
|||||||
reverseSelectionHelper(w.begin()+offset, w.end());
|
reverseSelectionHelper(w.begin()+offset, w.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MPD::SongList Browser::getSelectedSongs()
|
std::vector<MPD::Song> Browser::getSelectedSongs()
|
||||||
{
|
{
|
||||||
MPD::SongList songs;
|
std::vector<MPD::Song> songs;
|
||||||
auto item_handler = [this, &songs](const MPD::Item &item) {
|
auto item_handler = [this, &songs](const MPD::Item &item) {
|
||||||
switch (item.type())
|
switch (item.type())
|
||||||
{
|
{
|
||||||
@@ -437,7 +437,7 @@ void Browser::getDirectory(std::string directory)
|
|||||||
if (directory.empty())
|
if (directory.empty())
|
||||||
directory = "/";
|
directory = "/";
|
||||||
|
|
||||||
MPD::ItemList items;
|
std::vector<MPD::Item> items;
|
||||||
if (m_local_browser)
|
if (m_local_browser)
|
||||||
getLocalDirectory(items, directory);
|
getLocalDirectory(items, directory);
|
||||||
else
|
else
|
||||||
@@ -620,7 +620,7 @@ MPD::Song getLocalSong(const fs::directory_entry &entry, bool read_tags)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
void getLocalDirectory(MPD::ItemList &items, const std::string &directory)
|
void getLocalDirectory(std::vector<MPD::Item> &items, const std::string &directory)
|
||||||
{
|
{
|
||||||
for (fs::directory_iterator entry(directory), end; entry != end; ++entry)
|
for (fs::directory_iterator entry(directory), end; entry != end; ++entry)
|
||||||
{
|
{
|
||||||
@@ -639,7 +639,7 @@ void getLocalDirectory(MPD::ItemList &items, const std::string &directory)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void getLocalDirectoryRecursively(MPD::SongList &songs, const std::string &directory)
|
void getLocalDirectoryRecursively(std::vector<MPD::Song> &songs, const std::string &directory)
|
||||||
{
|
{
|
||||||
size_t sort_offset = songs.size();
|
size_t sort_offset = songs.size();
|
||||||
for (fs::directory_iterator entry(directory), end; entry != end; ++entry)
|
for (fs::directory_iterator entry(directory), end; entry != end; ++entry)
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ struct Browser: Screen<NC::Menu<MPD::Item>>, Filterable, HasSongs, Searchable, T
|
|||||||
|
|
||||||
virtual bool allowsSelection() OVERRIDE;
|
virtual bool allowsSelection() OVERRIDE;
|
||||||
virtual void reverseSelection() OVERRIDE;
|
virtual void reverseSelection() OVERRIDE;
|
||||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
|
||||||
|
|
||||||
// private members
|
// private members
|
||||||
bool inRootDirectory();
|
bool inRootDirectory();
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ struct HasSongs
|
|||||||
|
|
||||||
virtual bool allowsSelection() = 0;
|
virtual bool allowsSelection() = 0;
|
||||||
virtual void reverseSelection() = 0;
|
virtual void reverseSelection() = 0;
|
||||||
virtual MPD::SongList getSelectedSongs() = 0;
|
virtual std::vector<MPD::Song> getSelectedSongs() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HasColumns
|
struct HasColumns
|
||||||
|
|||||||
@@ -733,9 +733,9 @@ void MediaLibrary::reverseSelection()
|
|||||||
reverseSelectionHelper(Songs.begin(), Songs.end());
|
reverseSelectionHelper(Songs.begin(), Songs.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MPD::SongList MediaLibrary::getSelectedSongs()
|
std::vector<MPD::Song> MediaLibrary::getSelectedSongs()
|
||||||
{
|
{
|
||||||
MPD::SongList result;
|
std::vector<MPD::Song> result;
|
||||||
if (isActiveWindow(Tags))
|
if (isActiveWindow(Tags))
|
||||||
{
|
{
|
||||||
auto tag_handler = [&result](const std::string &tag) {
|
auto tag_handler = [&result](const std::string &tag) {
|
||||||
@@ -1059,7 +1059,7 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
|
|||||||
{
|
{
|
||||||
Mpd.StartSearch(true);
|
Mpd.StartSearch(true);
|
||||||
Mpd.AddSearch(Config.media_lib_primary_tag, Tags.current().value().tag());
|
Mpd.AddSearch(Config.media_lib_primary_tag, Tags.current().value().tag());
|
||||||
MPD::SongList list(
|
std::vector<MPD::Song> list(
|
||||||
std::make_move_iterator(Mpd.CommitSearchSongs()),
|
std::make_move_iterator(Mpd.CommitSearchSongs()),
|
||||||
std::make_move_iterator(MPD::SongIterator())
|
std::make_move_iterator(MPD::SongIterator())
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ struct MediaLibrary: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Sea
|
|||||||
|
|
||||||
virtual bool allowsSelection() OVERRIDE;
|
virtual bool allowsSelection() OVERRIDE;
|
||||||
virtual void reverseSelection() OVERRIDE;
|
virtual void reverseSelection() OVERRIDE;
|
||||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
|
||||||
|
|
||||||
// HasColumns implementation
|
// HasColumns implementation
|
||||||
virtual bool previousColumnAvailable() OVERRIDE;
|
virtual bool previousColumnAvailable() OVERRIDE;
|
||||||
|
|||||||
@@ -551,7 +551,7 @@ bool Connection::AddRandomTag(mpd_tag_type tag, size_t number)
|
|||||||
bool Connection::AddRandomSongs(size_t number)
|
bool Connection::AddRandomSongs(size_t number)
|
||||||
{
|
{
|
||||||
prechecksNoCommandsList();
|
prechecksNoCommandsList();
|
||||||
StringList files;
|
std::vector<std::string> files;
|
||||||
mpd_send_list_all(m_connection.get(), "/");
|
mpd_send_list_all(m_connection.get(), "/");
|
||||||
while (mpd_pair *item = mpd_recv_pair_named(m_connection.get(), "file"))
|
while (mpd_pair *item = mpd_recv_pair_named(m_connection.get(), "file"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -325,10 +325,6 @@ private:
|
|||||||
std::shared_ptr<mpd_output> m_output;
|
std::shared_ptr<mpd_output> m_output;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Item> ItemList;
|
|
||||||
typedef std::vector<std::string> StringList;
|
|
||||||
typedef std::vector<Output> OutputList;
|
|
||||||
|
|
||||||
template <typename ObjectT>
|
template <typename ObjectT>
|
||||||
struct Iterator: std::iterator<std::input_iterator_tag, ObjectT>
|
struct Iterator: std::iterator<std::input_iterator_tag, ObjectT>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -232,9 +232,9 @@ void Playlist::reverseSelection()
|
|||||||
reverseSelectionHelper(w.begin(), w.end());
|
reverseSelectionHelper(w.begin(), w.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MPD::SongList Playlist::getSelectedSongs()
|
std::vector<MPD::Song> Playlist::getSelectedSongs()
|
||||||
{
|
{
|
||||||
MPD::SongList result;
|
std::vector<MPD::Song> result;
|
||||||
for (auto it = w.begin(); it != w.end(); ++it)
|
for (auto it = w.begin(); it != w.end(); ++it)
|
||||||
if (it->isSelected())
|
if (it->isSelected())
|
||||||
result.push_back(it->value());
|
result.push_back(it->value());
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ struct Playlist: Screen<NC::Menu<MPD::Song>>, Filterable, HasSongs, Searchable,
|
|||||||
|
|
||||||
virtual bool allowsSelection() OVERRIDE;
|
virtual bool allowsSelection() OVERRIDE;
|
||||||
virtual void reverseSelection() OVERRIDE;
|
virtual void reverseSelection() OVERRIDE;
|
||||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
|
||||||
|
|
||||||
// private members
|
// private members
|
||||||
MPD::Song nowPlayingSong();
|
MPD::Song nowPlayingSong();
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ ProxySongList PlaylistEditor::contentProxyList()
|
|||||||
|
|
||||||
void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
void PlaylistEditor::AddToPlaylist(bool add_n_play)
|
||||||
{
|
{
|
||||||
MPD::SongList list;
|
std::vector<MPD::Song> list;
|
||||||
|
|
||||||
if (isActiveWindow(Playlists) && !Playlists.empty())
|
if (isActiveWindow(Playlists) && !Playlists.empty())
|
||||||
{
|
{
|
||||||
@@ -475,9 +475,9 @@ void PlaylistEditor::reverseSelection()
|
|||||||
reverseSelectionHelper(Content.begin(), Content.end());
|
reverseSelectionHelper(Content.begin(), Content.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MPD::SongList PlaylistEditor::getSelectedSongs()
|
std::vector<MPD::Song> PlaylistEditor::getSelectedSongs()
|
||||||
{
|
{
|
||||||
MPD::SongList result;
|
std::vector<MPD::Song> result;
|
||||||
if (isActiveWindow(Playlists))
|
if (isActiveWindow(Playlists))
|
||||||
{
|
{
|
||||||
bool any_selected = false;
|
bool any_selected = false;
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ struct PlaylistEditor: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, S
|
|||||||
|
|
||||||
virtual bool allowsSelection() OVERRIDE;
|
virtual bool allowsSelection() OVERRIDE;
|
||||||
virtual void reverseSelection() OVERRIDE;
|
virtual void reverseSelection() OVERRIDE;
|
||||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
|
||||||
|
|
||||||
// HasColumns implementation
|
// HasColumns implementation
|
||||||
virtual bool previousColumnAvailable() OVERRIDE;
|
virtual bool previousColumnAvailable() OVERRIDE;
|
||||||
|
|||||||
@@ -345,9 +345,9 @@ void SearchEngine::reverseSelection()
|
|||||||
reverseSelectionHelper(w.begin()+std::min(StaticOptions, w.size()), w.end());
|
reverseSelectionHelper(w.begin()+std::min(StaticOptions, w.size()), w.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MPD::SongList SearchEngine::getSelectedSongs()
|
std::vector<MPD::Song> SearchEngine::getSelectedSongs()
|
||||||
{
|
{
|
||||||
MPD::SongList result;
|
std::vector<MPD::Song> result;
|
||||||
for (auto it = w.begin(); it != w.end(); ++it)
|
for (auto it = w.begin(); it != w.end(); ++it)
|
||||||
{
|
{
|
||||||
if (it->isSelected())
|
if (it->isSelected())
|
||||||
@@ -444,7 +444,7 @@ void SearchEngine::Search()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPD::SongList list;
|
std::vector<MPD::Song> list;
|
||||||
if (Config.search_in_db)
|
if (Config.search_in_db)
|
||||||
{
|
{
|
||||||
std::copy(
|
std::copy(
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ struct SearchEngine: Screen<NC::Menu<struct SEItem>>, Filterable, HasSongs, Sear
|
|||||||
|
|
||||||
virtual bool allowsSelection() OVERRIDE;
|
virtual bool allowsSelection() OVERRIDE;
|
||||||
virtual void reverseSelection() OVERRIDE;
|
virtual void reverseSelection() OVERRIDE;
|
||||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
|
||||||
|
|
||||||
// private members
|
// private members
|
||||||
void reset();
|
void reset();
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ private:
|
|||||||
Component m_playlist_selector;
|
Component m_playlist_selector;
|
||||||
Component m_position_selector;
|
Component m_position_selector;
|
||||||
|
|
||||||
MPD::SongList m_selected_items;
|
std::vector<MPD::Song> m_selected_items;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern SelectedItemsAdder *mySelectedItemsAdder;
|
extern SelectedItemsAdder *mySelectedItemsAdder;
|
||||||
|
|||||||
@@ -114,8 +114,6 @@ private:
|
|||||||
size_t m_hash;
|
size_t m_hash;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<Song> SongList;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // NCMPCPP_SONG_H
|
#endif // NCMPCPP_SONG_H
|
||||||
|
|||||||
@@ -160,12 +160,12 @@ void SortPlaylistDialog::sort() const
|
|||||||
std::tie(begin, end) = getSelectedRange(begin, end);
|
std::tie(begin, end) = getSelectedRange(begin, end);
|
||||||
|
|
||||||
size_t start_pos = begin - pl.begin();
|
size_t start_pos = begin - pl.begin();
|
||||||
MPD::SongList playlist;
|
std::vector<MPD::Song> playlist;
|
||||||
playlist.reserve(end - begin);
|
playlist.reserve(end - begin);
|
||||||
for (; begin != end; ++begin)
|
for (; begin != end; ++begin)
|
||||||
playlist.push_back(begin->value());
|
playlist.push_back(begin->value());
|
||||||
|
|
||||||
typedef MPD::SongList::iterator Iterator;
|
typedef std::vector<MPD::Song>::iterator Iterator;
|
||||||
LocaleStringComparison cmp(std::locale(), Config.ignore_leading_the);
|
LocaleStringComparison cmp(std::locale(), Config.ignore_leading_the);
|
||||||
std::function<void(Iterator, Iterator)> iter_swap, quick_sort;
|
std::function<void(Iterator, Iterator)> iter_swap, quick_sort;
|
||||||
auto song_cmp = [this, &cmp](const MPD::Song &a, const MPD::Song &b) -> bool {
|
auto song_cmp = [this, &cmp](const MPD::Song &a, const MPD::Song &b) -> bool {
|
||||||
|
|||||||
@@ -848,9 +848,9 @@ void TagEditor::reverseSelection()
|
|||||||
reverseSelectionHelper(Tags->begin(), Tags->end());
|
reverseSelectionHelper(Tags->begin(), Tags->end());
|
||||||
}
|
}
|
||||||
|
|
||||||
MPD::SongList TagEditor::getSelectedSongs()
|
std::vector<MPD::Song> TagEditor::getSelectedSongs()
|
||||||
{
|
{
|
||||||
MPD::SongList result;
|
std::vector<MPD::Song> result;
|
||||||
if (w == Tags)
|
if (w == Tags)
|
||||||
{
|
{
|
||||||
for (auto it = Tags->begin(); it != Tags->end(); ++it)
|
for (auto it = Tags->begin(); it != Tags->end(); ++it)
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ struct TagEditor: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Search
|
|||||||
|
|
||||||
virtual bool allowsSelection() OVERRIDE;
|
virtual bool allowsSelection() OVERRIDE;
|
||||||
virtual void reverseSelection() OVERRIDE;
|
virtual void reverseSelection() OVERRIDE;
|
||||||
virtual MPD::SongList getSelectedSongs() OVERRIDE;
|
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
|
||||||
|
|
||||||
// HasColumns implementation
|
// HasColumns implementation
|
||||||
virtual bool previousColumnAvailable() OVERRIDE;
|
virtual bool previousColumnAvailable() OVERRIDE;
|
||||||
|
|||||||
Reference in New Issue
Block a user