Tag Parser 12.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
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 <cstdint>
7#include <string_view>
8
9namespace TagParser {
10
12public:
13 static inline std::string_view stringFromIndex(int index);
14 static int indexFromString(std::string_view genre);
15 static constexpr int genreCount();
16 static constexpr int emptyGenreIndex();
17 static constexpr bool isEmptyGenre(int index);
18 static constexpr bool isIndexSupported(int index);
19
20private:
21 static const std::string_view *genreNames();
22};
23
27inline std::string_view Id3Genres::stringFromIndex(int index)
28{
29 return isIndexSupported(index) ? genreNames()[index] : std::string_view();
30}
31
35constexpr int Id3Genres::genreCount()
36{
37 return 192;
38}
39
46{
47 return 255;
48}
49
53constexpr bool Id3Genres::isEmptyGenre(int index)
54{
55 return index == emptyGenreIndex();
56}
57
62constexpr bool Id3Genres::isIndexSupported(int index)
63{
64 return index >= 0 && index < genreCount();
65}
66
67} // namespace TagParser
68
69#endif // TAG_PARSER_ID3GENRES_H
The Id3Genres class converts pre-defined ID3 genres to strings and vice versa.
Definition id3genres.h:11
static constexpr bool isEmptyGenre(int index)
Returns whether the genre index indicates the genre field is not set at all.
Definition id3genres.h:53
static constexpr bool isIndexSupported(int index)
Returns an indication whether the specified numerical denotation is supported by this class.
Definition id3genres.h:62
static constexpr int emptyGenreIndex()
Returns the preferred genre index to indicate that no genre is set at all.
Definition id3genres.h:45
static constexpr int genreCount()
Returns the number of supported genres.
Definition id3genres.h:35
static std::string_view stringFromIndex(int index)
Returns the genre name for the specified numerical denotation as C-style string.
Definition id3genres.h:27
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:13
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10