mpd: get rid of *List typedefs

master
Andrzej Rybczak 12 years ago
parent 24de827f8b
commit 7bfa120f37
  1. 18
      src/browser.cpp
  2. 2
      src/browser.h
  3. 2
      src/interfaces.h
  4. 6
      src/media_library.cpp
  5. 2
      src/media_library.h
  6. 2
      src/mpdpp.cpp
  7. 4
      src/mpdpp.h
  8. 4
      src/playlist.cpp
  9. 2
      src/playlist.h
  10. 6
      src/playlist_editor.cpp
  11. 2
      src/playlist_editor.h
  12. 6
      src/search_engine.cpp
  13. 2
      src/search_engine.h
  14. 2
      src/sel_items_adder.h
  15. 2
      src/song.h
  16. 4
      src/sort_playlist.cpp
  17. 4
      src/tag_editor.cpp
  18. 2
      src/tag_editor.h

@ -63,8 +63,8 @@ bool isRootDirectory(const std::string &directory);
bool isHidden(const fs::directory_iterator &entry);
bool hasSupportedExtension(const fs::directory_entry &entry);
MPD::Song getLocalSong(const fs::directory_entry &entry, bool read_tags);
void getLocalDirectory(MPD::ItemList &items, const std::string &directory);
void getLocalDirectoryRecursively(MPD::SongList &songs, const std::string &directory);
void getLocalDirectory(std::vector<MPD::Item> &items, const std::string &directory);
void getLocalDirectoryRecursively(std::vector<MPD::Song> &songs, const std::string &directory);
void clearDirectory(const std::string &directory);
std::string itemToString(const MPD::Item &item);
@ -144,7 +144,7 @@ void Browser::enterPressed()
}
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::SongIterator())
);
@ -183,7 +183,7 @@ void Browser::spacePressed()
bool success = true;
if (m_local_browser)
{
MPD::SongList songs;
std::vector<MPD::Song> songs;
getLocalDirectoryRecursively(songs, item.directory().path());
success = addSongsToPlaylist(songs.begin(), songs.end(), false, -1);
}
@ -338,9 +338,9 @@ void Browser::reverseSelection()
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) {
switch (item.type())
{
@ -437,7 +437,7 @@ void Browser::getDirectory(std::string directory)
if (directory.empty())
directory = "/";
MPD::ItemList items;
std::vector<MPD::Item> items;
if (m_local_browser)
getLocalDirectory(items, directory);
else
@ -620,7 +620,7 @@ MPD::Song getLocalSong(const fs::directory_entry &entry, bool read_tags)
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)
{
@ -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();
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 void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
// private members
bool inRootDirectory();

@ -48,7 +48,7 @@ struct HasSongs
virtual bool allowsSelection() = 0;
virtual void reverseSelection() = 0;
virtual MPD::SongList getSelectedSongs() = 0;
virtual std::vector<MPD::Song> getSelectedSongs() = 0;
};
struct HasColumns

@ -733,9 +733,9 @@ void MediaLibrary::reverseSelection()
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))
{
auto tag_handler = [&result](const std::string &tag) {
@ -1059,7 +1059,7 @@ void MediaLibrary::AddToPlaylist(bool add_n_play)
{
Mpd.StartSearch(true);
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::SongIterator())
);

@ -63,7 +63,7 @@ struct MediaLibrary: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, Sea
virtual bool allowsSelection() OVERRIDE;
virtual void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
// HasColumns implementation
virtual bool previousColumnAvailable() OVERRIDE;

@ -551,7 +551,7 @@ bool Connection::AddRandomTag(mpd_tag_type tag, size_t number)
bool Connection::AddRandomSongs(size_t number)
{
prechecksNoCommandsList();
StringList files;
std::vector<std::string> files;
mpd_send_list_all(m_connection.get(), "/");
while (mpd_pair *item = mpd_recv_pair_named(m_connection.get(), "file"))
{

@ -325,10 +325,6 @@ private:
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>
struct Iterator: std::iterator<std::input_iterator_tag, ObjectT>
{

@ -232,9 +232,9 @@ void Playlist::reverseSelection()
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)
if (it->isSelected())
result.push_back(it->value());

@ -63,7 +63,7 @@ struct Playlist: Screen<NC::Menu<MPD::Song>>, Filterable, HasSongs, Searchable,
virtual bool allowsSelection() OVERRIDE;
virtual void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
// private members
MPD::Song nowPlayingSong();

@ -241,7 +241,7 @@ ProxySongList PlaylistEditor::contentProxyList()
void PlaylistEditor::AddToPlaylist(bool add_n_play)
{
MPD::SongList list;
std::vector<MPD::Song> list;
if (isActiveWindow(Playlists) && !Playlists.empty())
{
@ -475,9 +475,9 @@ void PlaylistEditor::reverseSelection()
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))
{
bool any_selected = false;

@ -63,7 +63,7 @@ struct PlaylistEditor: Screen<NC::Window *>, Filterable, HasColumns, HasSongs, S
virtual bool allowsSelection() OVERRIDE;
virtual void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
// HasColumns implementation
virtual bool previousColumnAvailable() OVERRIDE;

@ -345,9 +345,9 @@ void SearchEngine::reverseSelection()
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)
{
if (it->isSelected())
@ -444,7 +444,7 @@ void SearchEngine::Search()
return;
}
MPD::SongList list;
std::vector<MPD::Song> list;
if (Config.search_in_db)
{
std::copy(

@ -62,7 +62,7 @@ struct SearchEngine: Screen<NC::Menu<struct SEItem>>, Filterable, HasSongs, Sear
virtual bool allowsSelection() OVERRIDE;
virtual void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
// private members
void reset();

@ -77,7 +77,7 @@ private:
Component m_playlist_selector;
Component m_position_selector;
MPD::SongList m_selected_items;
std::vector<MPD::Song> m_selected_items;
};
extern SelectedItemsAdder *mySelectedItemsAdder;

@ -114,8 +114,6 @@ private:
size_t m_hash;
};
typedef std::vector<Song> SongList;
}
#endif // NCMPCPP_SONG_H

@ -160,12 +160,12 @@ void SortPlaylistDialog::sort() const
std::tie(begin, end) = getSelectedRange(begin, end);
size_t start_pos = begin - pl.begin();
MPD::SongList playlist;
std::vector<MPD::Song> playlist;
playlist.reserve(end - begin);
for (; begin != end; ++begin)
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);
std::function<void(Iterator, Iterator)> iter_swap, quick_sort;
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());
}
MPD::SongList TagEditor::getSelectedSongs()
std::vector<MPD::Song> TagEditor::getSelectedSongs()
{
MPD::SongList result;
std::vector<MPD::Song> result;
if (w == Tags)
{
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 void reverseSelection() OVERRIDE;
virtual MPD::SongList getSelectedSongs() OVERRIDE;
virtual std::vector<MPD::Song> getSelectedSongs() OVERRIDE;
// HasColumns implementation
virtual bool previousColumnAvailable() OVERRIDE;

Loading…
Cancel
Save