2018-05-10 15:29:28 +02:00
|
|
|
/***************************************************************************
|
|
|
|
copyright : (C) 2002 - 2008 by Scott Wheeler
|
|
|
|
email : wheeler@kde.org
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
/***************************************************************************
|
|
|
|
* This library is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License version *
|
|
|
|
* 2.1 as published by the Free Software Foundation. *
|
|
|
|
* *
|
|
|
|
* This library is distributed in the hope that it will be useful, but *
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
|
|
|
* Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this library; if not, write to the Free Software *
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
|
|
|
|
* 02110-1301 USA *
|
|
|
|
* *
|
|
|
|
* Alternatively, this file is available under the Mozilla Public *
|
|
|
|
* License Version 1.1. You may obtain a copy of the License at *
|
|
|
|
* http://www.mozilla.org/MPL/ *
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef TAGLIB_TAGUNION_H
|
|
|
|
#define TAGLIB_TAGUNION_H
|
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
// This file is not a part of TagLib public interface. This is not installed.
|
|
|
|
|
2018-05-10 15:29:28 +02:00
|
|
|
#include "tag.h"
|
|
|
|
|
|
|
|
#ifndef DO_NOT_DOCUMENT
|
|
|
|
|
2019-04-26 01:12:42 +02:00
|
|
|
namespace Strawberry_TagLib {
|
|
|
|
namespace TagLib {
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-26 23:30:30 +02:00
|
|
|
* \internal
|
|
|
|
*/
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
template<size_t COUNT>
|
2020-06-13 19:02:42 +02:00
|
|
|
class TagUnion : public Tag {
|
|
|
|
public:
|
2020-06-22 02:32:37 +02:00
|
|
|
enum AccessType {
|
|
|
|
Read,
|
|
|
|
Write
|
|
|
|
};
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
/*!
|
2020-06-26 23:30:30 +02:00
|
|
|
* Creates a TagLib::Tag that is the union of \a count tags.
|
2020-06-14 17:01:05 +02:00
|
|
|
*/
|
2020-06-26 23:30:30 +02:00
|
|
|
TagUnion();
|
|
|
|
|
|
|
|
~TagUnion() override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
Tag *operator[](size_t index) const;
|
|
|
|
Tag *tag(size_t index) const;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
void set(size_t index, Tag *tag);
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
PropertyMap properties() const override;
|
|
|
|
void removeUnsupportedProperties(const StringList &unsupported) override;
|
|
|
|
PropertyMap setProperties(const PropertyMap &properties) override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
String title() const override;
|
|
|
|
String artist() const override;
|
|
|
|
String album() const override;
|
|
|
|
String comment() const override;
|
|
|
|
String genre() const override;
|
|
|
|
unsigned int year() const override;
|
|
|
|
unsigned int track() const override;
|
|
|
|
PictureMap pictures() const override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
void setTitle(const String &s) override;
|
|
|
|
void setArtist(const String &s) override;
|
|
|
|
void setAlbum(const String &s) override;
|
|
|
|
void setComment(const String &s) override;
|
|
|
|
void setGenre(const String &s) override;
|
|
|
|
void setYear(unsigned int i) override;
|
|
|
|
void setTrack(unsigned int i) override;
|
|
|
|
void setPictures(const PictureMap &l) override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
bool isEmpty() const override;
|
2018-05-10 15:29:28 +02:00
|
|
|
|
2020-06-26 23:30:30 +02:00
|
|
|
template<class T> T *access(size_t index, bool create) {
|
2020-06-14 17:01:05 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
if (!create || tag(index))
|
2018-05-10 15:29:28 +02:00
|
|
|
return static_cast<T *>(tag(index));
|
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
set(index, new T);
|
|
|
|
return static_cast<T *>(tag(index));
|
2020-06-14 17:01:05 +02:00
|
|
|
|
2020-06-13 19:02:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
class TagUnionPrivate;
|
|
|
|
TagUnionPrivate *d;
|
|
|
|
};
|
2020-06-26 23:30:30 +02:00
|
|
|
|
|
|
|
// If you add a new typedef here, add a corresponding explicit instantiation at the end of tagunion.cpp as well.
|
|
|
|
|
|
|
|
typedef TagUnion<2> DoubleTagUnion;
|
|
|
|
typedef TagUnion<3> TripleTagUnion;
|
2020-06-13 19:02:42 +02:00
|
|
|
} // namespace TagLib
|
|
|
|
} // namespace Strawberry_TagLib
|
2018-05-10 15:29:28 +02:00
|
|
|
|
|
|
|
#endif
|
|
|
|
#endif
|