Tag Parser 12.5.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vorbiscomment.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_VORBISCOMMENT_H
2#define TAG_PARSER_VORBISCOMMENT_H
3
5
7#include "../fieldbasedtag.h"
8#include "../mediaformat.h"
9
10class OverallTests;
11
12namespace TagParser {
13
14class OggIterator;
15class VorbisComment;
16class Diagnostics;
17
26
27class TAG_PARSER_EXPORT VorbisComment : public FieldMapBasedTag<VorbisComment> {
28 friend class FieldMapBasedTag<VorbisComment>;
29 friend class ::OverallTests;
30
31public:
33
35 static constexpr std::string_view tagName = "Vorbis comment";
37 bool canEncodingBeUsed(TagTextEncoding encoding) const override;
38
40 const TagValue &value(KnownField field) const override;
42 bool setValue(KnownField field, const TagValue &value) override;
43
44 void parse(OggIterator &iterator, VorbisCommentFlags flags, Diagnostics &diag);
45 void parse(OggIterator &iterator, VorbisCommentFlags flags, std::uint64_t &padding, Diagnostics &diag);
46 void parse(std::istream &stream, std::uint64_t maxSize, VorbisCommentFlags flags, Diagnostics &diag);
47 void make(std::ostream &stream, VorbisCommentFlags flags, Diagnostics &diag);
48
49 const TagValue &vendor() const;
50 void setVendor(const TagValue &vendor);
51 bool supportsMultipleValues(KnownField) const override;
52
53protected:
56
57private:
58 template <class StreamType>
59 void internalParse(StreamType &stream, std::uint64_t maxSize, VorbisCommentFlags flags, std::uint64_t &padding, Diagnostics &diag);
60 void extendPositionInSetField(std::string_view field, std::string_view totalField, const std::string &diagContext, Diagnostics &diag);
61 void convertTotalFields(const std::string &diagContext, Diagnostics &diag);
62
63private:
64 TagValue m_vendor;
65};
66
73
75{
76 return encoding == TagTextEncoding::Utf8;
77}
78
83inline const TagValue &VorbisComment::vendor() const
84{
85 return m_vendor;
86}
87
93{
94 m_vendor = vendor;
95}
96
102{
103 return true;
104}
105
106} // namespace TagParser
107
108#endif // TAG_PARSER_VORBISCOMMENT_H
The OverallTests class tests reading and writing tags and parsing technical information for all suppo...
Definition overall.h:40
The Diagnostics class is a container for DiagMessage.
Defines traits for the specified ImplementationType.
typename FieldMapBasedTagTraits< VorbisComment >::FieldType::IdentifierType IdentifierType
The OggIterator class helps iterating through all segments of an Ogg bitstream.
Definition oggiterator.h:11
The TagValue class wraps values of different types.
Definition tagvalue.h:147
The VorbisCommentField class is used by VorbisComment to store the fields.
Implementation of TagParser::Tag for Vorbis comments.
static constexpr TagTextEncoding defaultTextEncoding
bool canEncodingBeUsed(TagTextEncoding encoding) const override
Returns an indication whether the specified encoding can be used to provide string values for the tag...
void make(std::ostream &stream, VorbisCommentFlags flags, Diagnostics &diag)
Writes tag information to the specified stream.
const TagValue & vendor() const
Returns the vendor.
static constexpr TagType tagType
void parse(OggIterator &iterator, VorbisCommentFlags flags, Diagnostics &diag)
Parses tag information using the specified Ogg iterator.
VorbisComment()
Constructs a new Vorbis comment.
bool supportsMultipleValues(KnownField) const override
Allows multiple values for all fields.
IdentifierType internallyGetFieldId(KnownField field) const
void setVendor(const TagValue &vendor)
Sets the vendor.
const TagValue & value(KnownField field) const override
Returns the value of the specified field.
bool setValue(KnownField field, const TagValue &value) override
Assigns the given value to the specified field.
static constexpr std::string_view tagName
KnownField internallyGetKnownField(const IdentifierType &id) const
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
KnownField
Specifies the field.
Definition tag.h:37
TagTextEncoding
Specifies the text encoding.
Definition tagvalue.h:29
TagType
Specifies the tag type.
Definition tagtype.h:11
VorbisCommentFlags
The VorbisCommentFlags enum specifies flags which controls parsing and making of Vorbis comments.
The CaseInsensitiveStringComparer struct defines a method for case-insensivive string comparison (les...