Tag Parser  10.0.1
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 TAG_PARSER_VORBISCOMMENTFIELD_H
2 #define TAG_PARSER_VORBISCOMMENTFIELD_H
3 
4 #include "../generictagfield.h"
5 
6 #include <c++utilities/misc/flagenumclass.h>
7 
8 namespace CppUtilities {
9 class BinaryReader;
10 class BinaryWriter;
11 } // namespace CppUtilities
12 
13 namespace TagParser {
14 
18 enum class VorbisCommentFlags : std::uint8_t {
19  None = 0x0,
20  NoSignature = 0x1,
21  NoFramingByte = 0x2,
22  NoCovers = 0x4
23 };
24 
25 } // namespace TagParser
26 
28 
29 namespace TagParser {
30 
31 class VorbisCommentField;
32 class Diagnostics;
33 
38 public:
39  using IdentifierType = std::string;
40  using TypeInfoType = std::uint32_t;
41 };
42 
43 class OggIterator;
44 
45 class TAG_PARSER_EXPORT VorbisCommentField : public TagField<VorbisCommentField> {
46  friend class TagField<VorbisCommentField>;
47 
48 public:
50  VorbisCommentField(const IdentifierType &id, const TagValue &value);
51 
52  void parse(OggIterator &iterator, Diagnostics &diag);
53  void parse(OggIterator &iterator, std::uint64_t &maxSize, Diagnostics &diag);
54  void parse(std::istream &stream, std::uint64_t &maxSize, Diagnostics &diag);
55  bool make(CppUtilities::BinaryWriter &writer, VorbisCommentFlags flags, Diagnostics &diag);
56  bool isAdditionalTypeInfoUsed() const;
57  bool supportsNestedFields() const;
58 
59  static typename std::string fieldIdFromString(std::string_view idString);
60  static std::string fieldIdToString(const std::string &id);
61 
62 private:
63  template <class StreamType> void internalParse(StreamType &stream, std::uint64_t &maxSize, Diagnostics &diag);
64 };
65 
70 {
71  return false;
72 }
73 
78 {
79  return false;
80 }
81 
86 inline std::string VorbisCommentField::fieldIdFromString(std::string_view idString)
87 {
88  return std::string(idString);
89 }
90 
95 inline std::string VorbisCommentField::fieldIdToString(const std::string &id)
96 {
97  return id;
98 }
99 
100 } // namespace TagParser
101 
102 #endif // TAG_PARSER_VORBISCOMMENTFIELD_H
The Diagnostics class is a container for DiagMessage.
Definition: diagnostics.h:156
The OggIterator class helps iterating through all segments of an OGG bitstream.
Definition: oggiterator.h:11
Defines traits for the specified ImplementationType.
The TagField class is used by FieldMapBasedTag to store the fields.
const IdentifierType & id() const
Returns the id of the current TagField.
The TagValue class wraps values of different types.
Definition: tagvalue.h:95
The VorbisCommentField class is used by VorbisComment to store the fields.
bool supportsNestedFields() const
Returns whether nested fields are supported.
static std::string fieldIdFromString(std::string_view idString)
Converts the specified ID string representation to an actual ID.
static std::string fieldIdToString(const std::string &id)
Returns the string representation for the specified id.
bool isAdditionalTypeInfoUsed() const
Returns whether the additional type info is used.
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Contains all classes and functions of the TagInfo library.
Definition: aaccodebook.h:10
VorbisCommentFlags
The VorbisCommentFlags enum specifies flags which controls parsing and making of Vorbis comments.
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::TagCreationFlags)