Mercurial > hg > svcore
changeset 1853:f36fef97ac81
Add isSupported
author | Chris Cannam |
---|---|
date | Wed, 06 May 2020 09:08:06 +0100 |
parents | a454c7477b4f |
children | bde22957545e |
files | data/fileio/PlaylistFileReader.cpp data/fileio/PlaylistFileReader.h |
diffstat | 2 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/data/fileio/PlaylistFileReader.cpp Thu Apr 30 14:46:07 2020 +0100 +++ b/data/fileio/PlaylistFileReader.cpp Wed May 06 09:08:06 2020 +0100 @@ -154,3 +154,12 @@ { extensions.insert("m3u"); } + +bool +PlaylistFileReader::isSupported(FileSource source) +{ + std::set<QString> supported; + getSupportedExtensions(supported); + QString ext = source.getExtension(); + return (supported.find(ext) != supported.end()); +}
--- a/data/fileio/PlaylistFileReader.h Thu Apr 30 14:46:07 2020 +0100 +++ b/data/fileio/PlaylistFileReader.h Wed May 06 09:08:06 2020 +0100 @@ -38,8 +38,15 @@ virtual QString getError() const; virtual Playlist load() const; + // Return the set of file extensions that are expected to + // represent parseable playlists. static void getSupportedExtensions(std::set<QString> &extensions); + // Return true if the given source has a file extension that is + // one of the supported extensions. Does not look at the content + // of the file. + static bool isSupported(FileSource source); + protected: void init();