Tag Parser  6.5.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
id3genres.h
Go to the documentation of this file.
1 #ifndef ID3GENRES_H
2 #define ID3GENRES_H
3 
4 #include "../global.h"
5 
6 #include <c++utilities/conversion/types.h>
7 
8 #include <string>
9 
10 namespace Media
11 {
12 
14 {
15 public:
16  static const char *stringFromIndex(int index);
17  static int indexFromString(const std::string &genre);
18  static constexpr int genreCount();
19  static constexpr bool isIndexSupported(int index);
20 
21 private:
22  static const char **genreNames();
23 };
24 
28 inline const char *Id3Genres::stringFromIndex(int index)
29 {
30  return isIndexSupported(index) ? genreNames()[index] : nullptr;
31 }
32 
36 constexpr int Id3Genres::genreCount()
37 {
38  return 192;
39 }
40 
45 constexpr bool Id3Genres::isIndexSupported(int index)
46 {
47  return index >= 0 && index < genreCount();
48 }
49 
50 }
51 
52 #endif // ID3GENRES_H
The Id3Genres class converts pre-defined ID3 genres to strings and vise versa.
Definition: id3genres.h:13
static constexpr bool isIndexSupported(int index)
Returns an indication whether the specified numerical denotation is supported by this class...
Definition: id3genres.h:45
static const char * stringFromIndex(int index)
Returns the genre name for the specified numerical denotation as C-style string.
Definition: id3genres.h:28
static constexpr int genreCount()
Returns the number of supported genres.
Definition: id3genres.h:36
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
TAG_PARSER_EXPORT const char * genre()