26#ifndef TAGLIB_TAGUNION_H
27#define TAGLIB_TAGUNION_H
31#ifndef DO_NOT_DOCUMENT
39 class TagUnion :
public Tag
43 enum AccessType { Read, Write };
50 TagUnion(Tag *first =
nullptr, Tag *second =
nullptr, Tag *third =
nullptr);
54 TagUnion(
const TagUnion &) =
delete;
55 TagUnion &operator=(
const TagUnion &) =
delete;
57 Tag *operator[](
int index)
const;
58 Tag *tag(
int index)
const;
60 void set(
int index, Tag *tag);
62 PropertyMap properties()
const override;
63 void removeUnsupportedProperties(
const StringList &unsupported)
override;
65 StringList complexPropertyKeys()
const override;
66 List<VariantMap> complexProperties(
const String &key)
const override;
67 bool setComplexProperties(
const String &key,
const List<VariantMap> &value)
override;
69 String title()
const override;
70 String artist()
const override;
71 String album()
const override;
72 String comment()
const override;
73 String
genre()
const override;
74 unsigned int year()
const override;
75 unsigned int track()
const override;
77 void setTitle(
const String &s)
override;
78 void setArtist(
const String &s)
override;
79 void setAlbum(
const String &s)
override;
80 void setComment(
const String &s)
override;
81 void setGenre(
const String &s)
override;
82 void setYear(
unsigned int i)
override;
83 void setTrack(
unsigned int i)
override;
84 bool isEmpty()
const override;
86 template <
class T> T *access(
int index,
bool create)
88 if(!create || tag(index))
89 return static_cast<T *
>(tag(index));
92 return static_cast<T *
>(tag(index));
95 template <
class T,
class F> T *access(
int index,
bool create,
const F *factory)
97 if(!create || tag(index))
98 return static_cast<T *
>(tag(index));
100 set(index,
new T(
nullptr, 0, factory));
101 return static_cast<T *
>(tag(index));
105 TagUnion(
const Tag &);
106 TagUnion &operator=(
const Tag &);
108 class TagUnionPrivate;
109 std::unique_ptr<TagUnionPrivate> d;
String TAGLIB_EXPORT genre(int index)
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41