Tag Parser  8.0.0
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 TAG_PARSER_ID3GENRES_H
2 #define TAG_PARSER_ID3GENRES_H
3 
4 #include "../global.h"
5 
6 #include <c++utilities/conversion/types.h>
7 
8 #include <string>
9 
10 namespace TagParser {
11 
13 public:
14  static inline const char *stringFromIndex(int index);
15  static int indexFromString(const std::string &genre);
16  static constexpr int genreCount();
17  static constexpr bool isIndexSupported(int index);
18 
19 private:
20  static const char **genreNames();
21 };
22 
26 inline const char *Id3Genres::stringFromIndex(int index)
27 {
28  return isIndexSupported(index) ? genreNames()[index] : nullptr;
29 }
30 
34 constexpr int Id3Genres::genreCount()
35 {
36  return 192;
37 }
38 
43 constexpr bool Id3Genres::isIndexSupported(int index)
44 {
45  return index >= 0 && index < genreCount();
46 }
47 
48 } // namespace TagParser
49 
50 #endif // TAG_PARSER_ID3GENRES_H
static const char * stringFromIndex(int index)
Returns the genre name for the specified numerical denotation as C-style string.
Definition: id3genres.h:26
static constexpr int genreCount()
Returns the number of supported genres.
Definition: id3genres.h:34
constexpr TAG_PARSER_EXPORT const char * genre()
The Id3Genres class converts pre-defined ID3 genres to strings and vise versa.
Definition: id3genres.h:12
static constexpr bool isIndexSupported(int index)
Returns an indication whether the specified numerical denotation is supported by this class...
Definition: id3genres.h:43
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.