Tag Parser 12.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
vorbiscomment.h
Go to the documentation of this file.
1#ifndef TAG_PARSER_VORBISCOMMENT_H
2#define TAG_PARSER_VORBISCOMMENT_H
3
5
6#include "../caseinsensitivecomparer.h"
7#include "../fieldbasedtag.h"
8#include "../mediaformat.h"
9
10namespace TagParser {
11
12class OggIterator;
13class VorbisComment;
14class Diagnostics;
15
24
25class TAG_PARSER_EXPORT VorbisComment : public FieldMapBasedTag<VorbisComment> {
26 friend class FieldMapBasedTag<VorbisComment>;
27
28public:
30
31 static constexpr TagType tagType = TagType::VorbisComment;
32 static constexpr std::string_view tagName = "Vorbis comment";
33 static constexpr TagTextEncoding defaultTextEncoding = TagTextEncoding::Utf8;
34 bool canEncodingBeUsed(TagTextEncoding encoding) const override;
35
36 using FieldMapBasedTag<VorbisComment>::value;
37 const TagValue &value(KnownField field) const override;
38 using FieldMapBasedTag<VorbisComment>::setValue;
39 bool setValue(KnownField field, const TagValue &value) override;
40
41 void parse(OggIterator &iterator, VorbisCommentFlags flags, Diagnostics &diag);
42 void parse(std::istream &stream, std::uint64_t maxSize, VorbisCommentFlags flags, Diagnostics &diag);
43 void make(std::ostream &stream, VorbisCommentFlags flags, Diagnostics &diag);
44
45 const TagValue &vendor() const;
46 void setVendor(const TagValue &vendor);
47 bool supportsMultipleValues(KnownField) const override;
48
49protected:
50 IdentifierType internallyGetFieldId(KnownField field) const;
51 KnownField internallyGetKnownField(const IdentifierType &id) const;
52
53private:
54 template <class StreamType> void internalParse(StreamType &stream, std::uint64_t maxSize, VorbisCommentFlags flags, Diagnostics &diag);
55
56private:
57 TagValue m_vendor;
58};
59
66
68{
69 return encoding == TagTextEncoding::Utf8;
70}
71
76inline const TagValue &VorbisComment::vendor() const
77{
78 return m_vendor;
79}
80
85inline void VorbisComment::setVendor(const TagValue &vendor)
86{
87 m_vendor = vendor;
88}
89
95{
96 return true;
97}
98
99} // namespace TagParser
100
101#endif // TAG_PARSER_VORBISCOMMENT_H
The Diagnostics class is a container for DiagMessage.
Defines traits for the specified ImplementationType.
The FieldMapBasedTag provides a generic implementation of Tag which stores the tag fields using std::...
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.
bool canEncodingBeUsed(TagTextEncoding encoding) const override
Returns an indication whether the specified encoding can be used to provide string values for the tag...
const TagValue & vendor() const
Returns the vendor.
VorbisComment()
Constructs a new Vorbis comment.
bool supportsMultipleValues(KnownField) const override
Allows multiple values for all fields.
void setVendor(const TagValue &vendor)
Sets the vendor.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:13
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
KnownField
Specifies the field.
Definition tag.h:29
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...