Tag Parser 12.3.1
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
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
34 static constexpr TagType tagType = TagType::VorbisComment;
35 static constexpr std::string_view tagName = "Vorbis comment";
36 static constexpr TagTextEncoding defaultTextEncoding = TagTextEncoding::Utf8;
37 bool canEncodingBeUsed(TagTextEncoding encoding) const override;
38
39 using FieldMapBasedTag<VorbisComment>::value;
40 const TagValue &value(KnownField field) const override;
41 using FieldMapBasedTag<VorbisComment>::setValue;
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:
54 IdentifierType internallyGetFieldId(KnownField field) const;
55 KnownField internallyGetKnownField(const IdentifierType &id) const;
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
92inline void VorbisComment::setVendor(const TagValue &vendor)
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.
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.
The TagValue class wraps values of different types.
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:14
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...