Tag Parser  6.2.2
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
vorbiscommentfield.h
Go to the documentation of this file.
1 #ifndef MEDIA_VORBISCOMMENTFIELD_H
2 #define MEDIA_VORBISCOMMENTFIELD_H
3 
4 #include "../generictagfield.h"
5 #include "../statusprovider.h"
6 
7 namespace IoUtilities {
8 class BinaryReader;
9 class BinaryWriter;
10 }
11 
12 namespace Media {
13 
17 enum class VorbisCommentFlags : byte
18 {
19  None = 0x0,
20  NoSignature = 0x1,
21  NoFramingByte = 0x2,
22  NoCovers = 0x4
23 };
24 
26 {
27  return static_cast<byte>(lhs) & static_cast<byte>(rhs);
28 }
29 
31 {
32  return static_cast<VorbisCommentFlags>(static_cast<byte>(lhs) | static_cast<byte>(rhs));
33 }
34 
35 class VorbisCommentField;
36 
40 template <>
42 {
43 public:
47  typedef std::string identifierType;
51  typedef uint32 typeInfoType;
56 };
57 
58 class OggIterator;
59 
60 class TAG_PARSER_EXPORT VorbisCommentField : public TagField<VorbisCommentField>, public StatusProvider
61 {
63 
64 public:
66  VorbisCommentField(const identifierType &id, const TagValue &value);
67 
68  void parse(OggIterator &iterator);
69  void parse(OggIterator &iterator, uint64 &maxSize);
70  void parse(std::istream &stream, uint64 &maxSize);
71  bool make(IoUtilities::BinaryWriter &writer, VorbisCommentFlags flags = VorbisCommentFlags::None);
72  bool isAdditionalTypeInfoUsed() const;
73  bool supportsNestedFields() const;
74 
75  static typename std::string fieldIdFromString(const char *idString, std::size_t idStringSize = std::string::npos);
76  static std::string fieldIdToString(const std::string &id);
77 
78 protected:
79  void cleared();
80 
81 private:
82  template<class StreamType>
83  void internalParse(StreamType &stream, uint64 &maxSize);
84 };
85 
89 inline bool VorbisCommentField::isAdditionalTypeInfoUsed() const
90 {
91  return false;
92 }
93 
97 inline bool VorbisCommentField::supportsNestedFields() const
98 {
99  return false;
100 }
101 
106 inline std::string VorbisCommentField::fieldIdFromString(const char *idString, std::size_t idStringSize)
107 {
108  return idStringSize != std::string::npos ? std::string(idString, idStringSize) : std::string(idString);
109 }
110 
115 inline std::string VorbisCommentField::fieldIdToString(const std::string &id)
116 {
117  return id;
118 }
119 
123 inline void VorbisCommentField::cleared()
124 {}
125 
126 }
127 
128 #endif // MEDIA_VORBISCOMMENTFIELD_H
The TagValue class wraps values of different types.
Definition: tagvalue.h:63
VorbisCommentField implementationType
The implementation type is VorbisCommentField.
Defines traits for the specified ImplementationType.
bool operator&(VorbisCommentFlags lhs, VorbisCommentFlags rhs)
uint32 typeInfoType
The type info is stored using 32-bit unsigned integers.
Contains utility classes helping to read and write streams.
The TagField class is used by FieldMapBasedTag to store the fields.
VorbisCommentFlags operator|(VorbisCommentFlags lhs, VorbisCommentFlags rhs)
The OggIterator class helps iterating through all segments of an OGG bitstream.
Definition: oggiterator.h:11
std::string identifierType
Fields in a Vorbis comment are identified by 32-bit unsigned integers.
Contains all classes and functions of the TagInfo library.
Definition: exceptions.h:9
The StatusProvider class acts as a base class for objects providing status information.
The VorbisCommentField class is used by VorbisComment to store the fields.
#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...