2018-03-06 23:09:15 +01:00
|
|
|
#ifndef TAG_PARSER_ID3V1TAG_H
|
|
|
|
#define TAG_PARSER_ID3V1TAG_H
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2015-09-06 19:57:33 +02:00
|
|
|
#include "../tag.h"
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
namespace TagParser {
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-05 17:49:29 +01:00
|
|
|
class Diagnostics;
|
|
|
|
|
2020-12-18 21:13:52 +01:00
|
|
|
class TAG_PARSER_EXPORT Id3v1Tag final : public Tag {
|
2015-04-22 19:22:01 +02:00
|
|
|
public:
|
|
|
|
Id3v1Tag();
|
|
|
|
|
2017-01-23 00:25:53 +01:00
|
|
|
static constexpr TagType tagType = TagType::Id3v1Tag;
|
2021-01-30 21:53:06 +01:00
|
|
|
static constexpr std::string_view tagName = "ID3v1 tag";
|
2018-03-07 01:11:42 +01:00
|
|
|
TagType type() const override;
|
2021-01-30 21:53:06 +01:00
|
|
|
std::string_view typeName() const override;
|
2018-03-07 01:11:42 +01:00
|
|
|
bool canEncodingBeUsed(TagTextEncoding encoding) const override;
|
|
|
|
const TagValue &value(KnownField value) const override;
|
|
|
|
bool setValue(KnownField field, const TagValue &value) override;
|
2016-08-05 01:46:31 +02:00
|
|
|
bool setValueConsideringTypeInfo(KnownField field, const TagValue &value, const std::string &typeInfo);
|
2018-03-07 01:11:42 +01:00
|
|
|
bool hasField(KnownField field) const override;
|
|
|
|
void removeAllFields() override;
|
2021-03-20 21:26:25 +01:00
|
|
|
std::size_t fieldCount() const override;
|
2018-03-07 01:11:42 +01:00
|
|
|
bool supportsField(KnownField field) const override;
|
|
|
|
void ensureTextValuesAreProperlyEncoded() override;
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-05 17:49:29 +01:00
|
|
|
void parse(std::istream &sourceStream, Diagnostics &diag);
|
|
|
|
void make(std::ostream &targetStream, Diagnostics &diag);
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
private:
|
2020-11-25 17:54:30 +01:00
|
|
|
void readValue(TagValue &value, std::size_t maxLength, const char *buffer);
|
|
|
|
void writeValue(const TagValue &value, std::size_t length, char *buffer, std::ostream &targetStream, Diagnostics &diag);
|
2015-04-22 19:22:01 +02:00
|
|
|
|
|
|
|
TagValue m_title;
|
|
|
|
TagValue m_artist;
|
|
|
|
TagValue m_album;
|
|
|
|
TagValue m_year;
|
|
|
|
TagValue m_comment;
|
|
|
|
TagValue m_trackPos;
|
|
|
|
TagValue m_genre;
|
|
|
|
};
|
|
|
|
|
2018-03-07 01:17:50 +01:00
|
|
|
} // namespace TagParser
|
2015-04-22 19:22:01 +02:00
|
|
|
|
2018-03-06 23:09:15 +01:00
|
|
|
#endif // TAG_PARSER_ID3V1TAG_H
|