Tag Parser  6.1.1
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 MEDIA_VORBISCOMMENT_H
2 #define MEDIA_VORBISCOMMENT_H
3 
4 #include "./vorbiscommentfield.h"
5 
6 #include "../caseinsensitivecomparer.h"
7 #include "../fieldbasedtag.h"
8 #include "../mediaformat.h"
9 
10 namespace Media {
11 
12 class OggIterator;
13 class VorbisComment;
14 
15 class TAG_PARSER_EXPORT VorbisComment : public FieldMapBasedTag<VorbisCommentField, CaseInsensitiveStringComparer>
16 {
17 public:
18  VorbisComment();
19 
20  TagType type() const;
21  const char *typeName() const;
22  TagTextEncoding proposedTextEncoding() const;
23  bool canEncodingBeUsed(TagTextEncoding encoding) const;
24 
25  const TagValue &value(KnownField field) const;
26  bool setValue(KnownField field, const TagValue &value);
27  std::string fieldId(KnownField field) const;
28  KnownField knownField(const std::string &id) const;
29 
30  void parse(OggIterator &iterator, VorbisCommentFlags flags = VorbisCommentFlags::None);
31  void parse(std::istream &stream, uint64 maxSize, VorbisCommentFlags flags = VorbisCommentFlags::None);
32  void make(std::ostream &stream, VorbisCommentFlags flags = VorbisCommentFlags::None);
33 
34  const TagValue &vendor() const;
35  void setVendor(const TagValue &vendor);
36 
37 private:
38  template<class StreamType>
39  void internalParse(StreamType &stream, uint64 maxSize, VorbisCommentFlags flags);
40 
41 private:
42  TagValue m_vendor;
43 };
44 
49 {}
50 
52 {
54 }
55 
56 inline const char *VorbisComment::typeName() const
57 {
58  return "Vorbis comment";
59 }
60 
62 {
63  return TagTextEncoding::Utf8;
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 }
90 
91 #endif // MEDIA_VORBISCOMMENT_H
The TagValue class wraps values of different types.
Definition: tagvalue.h:64
bool canEncodingBeUsed(TagTextEncoding encoding) const
Returns an indication whether the specified encoding can be used to provide string values for the tag...
Definition: vorbiscomment.h:66
Implementation of Media::Tag for Vorbis comments.
Definition: vorbiscomment.h:15
KnownField
Specifies the field.
Definition: tag.h:42
TagTextEncoding
Specifies the text encoding.
Definition: tagvalue.h:22
void setVendor(const TagValue &vendor)
Sets the vendor.
Definition: vorbiscomment.h:84
TagTextEncoding proposedTextEncoding() const
Returns the proposed text encoding.
Definition: vorbiscomment.h:61
The FieldMapBasedTag provides a generic implementation of Tag which stores the tag fields using std::...
Definition: fieldbasedtag.h:25
TagType
Specifies the tag type.
Definition: tag.h:21
const TagValue & vendor() const
Returns the vendor.
Definition: vorbiscomment.h:75
TagType type() const
Returns the type of the tag as Media::TagType.
Definition: vorbiscomment.h:51
The OggIterator class helps iterating through all segments of an OGG bitstream.
Definition: oggiterator.h:11
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
const char * typeName() const
Returns the type name of the tag as C-style string.
Definition: vorbiscomment.h:56
VorbisComment()
Constructs a new Vorbis comment.
Definition: vorbiscomment.h:48
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
VorbisCommentFlags
The VorbisCommentFlags enum specifies flags which controls parsing and making of Vorbis comments...