Sayonara Player
AbstractFrame.h
1 /* AbstractFrame.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
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 
21 
22 
23 #ifndef TAGGINGABSTRACTFRAME_H
24 #define TAGGINGABSTRACTFRAME_H
25 
26 #include "Utils/Pimpl.h"
27 
28 #include <QString>
29 
30 namespace TagLib
31 {
32  class Tag;
33  class String;
34 }
35 
36 namespace Tagging
37 {
39  {
40  public:
41  explicit AbstractFrameHelper(const QString& key=QString());
42  virtual ~AbstractFrameHelper();
43 
44  protected:
45  QString convert_string(const TagLib::String& str) const;
46  TagLib::String convert_string(const QString& str) const;
47  QString key() const;
48  TagLib::String tag_key() const;
49 
50  private:
51  PIMPL(AbstractFrameHelper)
52  };
53 
54  template<typename TagImpl>
55  class AbstractFrame :
56  public AbstractFrameHelper
57  {
58  private:
59  TagImpl* mTag=nullptr;
60 
61  protected:
62  AbstractFrame(TagImpl* tag, const QString& key=QString()) :
64  {
65  mTag = tag;
66  }
67 
68  virtual ~AbstractFrame() = default;
69 
70  TagImpl* tag() const
71  {
72  return mTag;
73  }
74 
75  void set_tag(TagImpl* tag)
76  {
77  mTag = tag;
78  }
79  };
80 }
81 #endif // TAGGINGABSTRACTFRAME_H
Tagging::AbstractFrame
Definition: AbstractFrame.h:57
Tagging
The GUI_TagEdit class.
Definition: GenreFetcher.h:34
Tagging::AbstractFrameHelper
Definition: AbstractFrame.h:39