From f4efce50056de254e35a4ba60c9b6e701609c69c Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 19 Jan 2013 20:48:02 +0100 Subject: Explicitly mention return type, and don't partially specialize functions. --- AudioFile.cpp | 34 +++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/AudioFile.cpp b/AudioFile.cpp index afb72b5..dce8291 100644 --- a/AudioFile.cpp +++ b/AudioFile.cpp @@ -40,30 +40,38 @@ inline std::pair extractTag(const M &map, const char *key) values.second = 0; return values; } -/* Turn a string into a bool, based on "1" and "true", for any map class. */ -template -inline bool extractTag(const M &map, const char *key) -{ - std::string str(extractTag(map, key)); - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - return (str == "1" || str == "true"); -} /* Extract a string out of an MP3 map. */ template <> -inline std::string extractTag(const TagLib::ID3v2::FrameListMap &map, const char *key) +inline std::string extractTag(const TagLib::ID3v2::FrameListMap &map, const char *key) { if (map[key].isEmpty()) return std::string(); return map[key].front()->toString().to8Bit(true); } +/* Turn a string into a bool, based on "1" and "true", for MP3. */ +template <> +inline bool extractTag(const TagLib::ID3v2::FrameListMap &map, const char *key) +{ + std::string str(extractTag(map, key)); + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + return (str == "1" || str == "true"); +} /* Extract a string out of an OGG map. */ template <> -inline std::string extractTag(const TagLib::Ogg::FieldListMap &map, const char *key) +inline std::string extractTag(const TagLib::Ogg::FieldListMap &map, const char *key) { if (map[key].isEmpty()) return std::string(); return map[key].front().to8Bit(true); } +/* Turn a string into a bool, based on "1" and "true", for OGG. */ +template <> +inline bool extractTag(const TagLib::Ogg::FieldListMap &map, const char *key) +{ + std::string str(extractTag(map, key)); + std::transform(str.begin(), str.end(), str.begin(), ::tolower); + return (str == "1" || str == "true"); +} /* Extract an integer pair out of an MP4 map. */ template inline std::pair extractTag(const TagLib::MP4::ItemListMap &map, const char *key) @@ -75,7 +83,7 @@ inline std::pair extractTag(const TagLib::MP4::ItemListMap &map, const c } /* Extract an integer out of an MP4 map. */ template <> -inline unsigned int extractTag(const TagLib::MP4::ItemListMap &map, const char *key) +inline unsigned int extractTag(const TagLib::MP4::ItemListMap &map, const char *key) { if (!map[key].isValid()) return 0; @@ -83,7 +91,7 @@ inline unsigned int extractTag(const TagLib::MP4::ItemListMap &map, const char * } /* Extract a string out of an MP4 map. */ template <> -inline std::string extractTag(const TagLib::MP4::ItemListMap &map, const char *key) +inline std::string extractTag(const TagLib::MP4::ItemListMap &map, const char *key) { if (!map[key].isValid()) return std::string(); @@ -91,7 +99,7 @@ inline std::string extractTag(const TagLib::MP4::ItemListMap &map, const char *k } /* Extract a bool out of an MP4 map. */ template <> -inline bool extractTag(const TagLib::MP4::ItemListMap &map, const char *key) +inline bool extractTag(const TagLib::MP4::ItemListMap &map, const char *key) { if (!map[key].isValid()) return false; -- cgit v1.2.3-59-g8ed1b