Add conversion from GetFunction to tag type
This commit is contained in:
10
src/format.h
10
src/format.h
@@ -60,9 +60,13 @@ private:
|
||||
unsigned m_delimiter;
|
||||
};
|
||||
|
||||
template <typename CharT> using SongTagMap = std::vector<
|
||||
std::pair<SongTag, std::basic_string<CharT> >
|
||||
>;
|
||||
template <typename CharT>
|
||||
using SongTagMap = std::vector<
|
||||
std::pair<
|
||||
SongTag,
|
||||
std::basic_string<CharT>
|
||||
>
|
||||
>;
|
||||
|
||||
enum class Result { Empty, Missing, Ok };
|
||||
|
||||
|
||||
@@ -199,6 +199,36 @@ MPD::Song::GetFunction charToGetFunction(char c)
|
||||
}
|
||||
}
|
||||
|
||||
boost::optional<mpd_tag_type> getFunctionToTagType(MPD::Song::GetFunction f)
|
||||
{
|
||||
if (f == &MPD::Song::getArtist)
|
||||
return MPD_TAG_ARTIST;
|
||||
else if (f == &MPD::Song::getTitle)
|
||||
return MPD_TAG_TITLE;
|
||||
else if (f == &MPD::Song::getAlbum)
|
||||
return MPD_TAG_ALBUM;
|
||||
else if (f == &MPD::Song::getAlbumArtist)
|
||||
return MPD_TAG_ALBUM_ARTIST;
|
||||
else if (f == &MPD::Song::getTrack)
|
||||
return MPD_TAG_TRACK;
|
||||
else if (f == &MPD::Song::getDate)
|
||||
return MPD_TAG_DATE;
|
||||
else if (f == &MPD::Song::getGenre)
|
||||
return MPD_TAG_GENRE;
|
||||
else if (f == &MPD::Song::getComposer)
|
||||
return MPD_TAG_COMPOSER;
|
||||
else if (f == &MPD::Song::getPerformer)
|
||||
return MPD_TAG_PERFORMER;
|
||||
else if (f == &MPD::Song::getComment)
|
||||
return MPD_TAG_COMMENT;
|
||||
else if (f == &MPD::Song::getDisc)
|
||||
return MPD_TAG_DISC;
|
||||
else if (f == &MPD::Song::getComment)
|
||||
return MPD_TAG_COMMENT;
|
||||
else
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
std::string itemTypeToString(MPD::Item::Type type)
|
||||
{
|
||||
std::string result;
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef NCMPCPP_UTILITY_TYPE_CONVERSIONS_H
|
||||
#define NCMPCPP_UTILITY_TYPE_CONVERSIONS_H
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include "curses/window.h"
|
||||
#include "mpdpp.h"
|
||||
#include "mutable_song.h"
|
||||
@@ -36,6 +38,8 @@ MPD::MutableSong::SetFunction tagTypeToSetFunction(mpd_tag_type tag);
|
||||
mpd_tag_type charToTagType(char c);
|
||||
MPD::Song::GetFunction charToGetFunction(char c);
|
||||
|
||||
boost::optional<mpd_tag_type> getFunctionToTagType(MPD::Song::GetFunction f);
|
||||
|
||||
std::string itemTypeToString(MPD::Item::Type type);
|
||||
|
||||
#endif // NCMPCPP_UTILITY_TYPE_CONVERSIONS_H
|
||||
|
||||
Reference in New Issue
Block a user