Sayonara Player
TaggingExtraFields.h
1/* ${CLASS_NAME}.h */
2/*
3 * Copyright (C) 2011-2021 Michael Lugmair
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef SAYONARA_PLAYER_TAGGINGEXTRAFIELDS_H
21#define SAYONARA_PLAYER_TAGGINGEXTRAFIELDS_H
22
23class MetaData;
24class QString;
25
26namespace Models
27{
28 struct Discnumber;
29 struct Popularimeter;
30}
31
32namespace Tagging
33{
34 template<typename FrameType, typename Model, typename Tag, typename ConversionFunction>
35 void tryToRead(Tag* tag, MetaData& track, ConversionFunction fn)
36 {
37 if(tag)
38 {
39 Model model;
40 auto frame = FrameType(tag);
41 const auto success = frame.read(model);
42 if(success)
43 {
44 fn(track, model);
45 }
46 }
47 }
48
49 template<typename FrameType, typename Tag, typename Model>
50 void tryToWrite(Tag* tag, const Model& model)
51 {
52 if(tag)
53 {
54 FrameType frame(tag);
55 frame.write(model);
56 }
57 }
58
59 struct ParsedTag;
60
61 void readDiscnumber(MetaData& track, const Tagging::ParsedTag& parsedTag);
62 void writeDiscnumber(const Tagging::ParsedTag& parsedTag, const Models::Discnumber& discnumber);
63
64 void readPopularimeter(MetaData& track, const Tagging::ParsedTag& parsedTag);
65 void writePopularimeter(const Tagging::ParsedTag& parsedTag, const Models::Popularimeter& popularimeter);
66
67 void readAlbumArtist(MetaData& track, const Tagging::ParsedTag& parsedTag);
68 void writeAlbumArtist(const Tagging::ParsedTag& parsedTag, const QString& albumArtist);
69}
70
71#endif //SAYONARA_PLAYER_TAGGINGEXTRAFIELDS_H
The MetaData class.
Definition: MetaData.h:47
The GUI_TagEdit class.
Definition: GenreFetcher.h:34
Definition: Discnumber.h:31
Definition: Popularimeter.h:31
Definition: TaggingUtils.h:60