Tag Parser  7.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
vorbiscomment.h
Go to the documentation of this file.
1 #ifndef TAG_PARSER_VORBISCOMMENT_H
2 #define TAG_PARSER_VORBISCOMMENT_H
3 
4 #include "./vorbiscommentfield.h"
5 
6 #include "../caseinsensitivecomparer.h"
7 #include "../fieldbasedtag.h"
8 #include "../mediaformat.h"
9 
10 namespace TagParser {
11 
12 class OggIterator;
13 class VorbisComment;
14 class Diagnostics;
15 
20 public:
23 };
24 
25 class TAG_PARSER_EXPORT VorbisComment : public FieldMapBasedTag<VorbisComment> {
27 
28 public:
29  VorbisComment();
30 
31  static constexpr TagType tagType = TagType::VorbisComment;
32  static constexpr const char *tagName = "Vorbis comment";
33  static constexpr TagTextEncoding defaultTextEncoding = TagTextEncoding::Utf8;
34  bool canEncodingBeUsed(TagTextEncoding encoding) const override;
35 
37  const TagValue &value(KnownField field) const override;
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, uint64 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 
48 protected:
49  IdentifierType internallyGetFieldId(KnownField field) const;
50  KnownField internallyGetKnownField(const IdentifierType &id) const;
51 
52 private:
53  template <class StreamType> void internalParse(StreamType &stream, uint64 maxSize, VorbisCommentFlags flags, Diagnostics &diag);
54 
55 private:
56  TagValue m_vendor;
57 };
58 
63 {
64 }
65 
67 {
68  return encoding == TagTextEncoding::Utf8;
69 }
70 
75 inline const TagValue &VorbisComment::vendor() const
76 {
77  return m_vendor;
78 }
79 
84 inline void VorbisComment::setVendor(const TagValue &vendor)
85 {
86  m_vendor = vendor;
87 }
88 
89 } // namespace TagParser
90 
91 #endif // TAG_PARSER_VORBISCOMMENT_H
The FieldMapBasedTag provides a generic implementation of Tag which stores the tag fields using std::...
Definition: fieldbasedtag.h:31
void setVendor(const TagValue &vendor)
Sets the vendor.
Definition: vorbiscomment.h:84
const TagValue & vendor() const
Returns the vendor.
Definition: vorbiscomment.h:75
VorbisCommentFlags
The VorbisCommentFlags enum specifies flags which controls parsing and making of Vorbis comments...
The OggIterator class helps iterating through all segments of an OGG bitstream.
Definition: oggiterator.h:11
KnownField
Specifies the field.
Definition: tag.h:40
Defines traits for the specified ImplementationType.
Definition: fieldbasedtag.h:17
Implementation of TagParser::Tag for Vorbis comments.
Definition: vorbiscomment.h:25
bool canEncodingBeUsed(TagTextEncoding encoding) const override
Returns an indication whether the specified encoding can be used to provide string values for the tag...
Definition: vorbiscomment.h:66
The CaseInsensitiveStringComparer struct defines a method for case-insensivive string comparsion (les...
VorbisComment()
Constructs a new Vorbis comment.
Definition: vorbiscomment.h:62
The VorbisCommentField class is used by VorbisComment to store the fields.
The TagValue class wraps values of different types.
Definition: tagvalue.h:64
TagType
Specifies the tag type.
Definition: tag.h:20
TagTextEncoding
Specifies the text encoding.
Definition: tagvalue.h:23
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:9
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:154