Tag Parser 12.1.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
Loading...
Searching...
No Matches
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
8namespace CppUtilities {
9class BinaryReader;
10class BinaryWriter;
11} // namespace CppUtilities
12
13namespace TagParser {
14
18enum class VorbisCommentFlags : std::uint8_t {
19 None = 0x0,
20 NoSignature = 0x1,
21 NoFramingByte = 0x2,
22 NoCovers = 0x4
23};
24
25} // namespace TagParser
26
28
29namespace TagParser {
30
31class VorbisCommentField;
32class Diagnostics;
33
38public:
39 using IdentifierType = std::string;
40 using TypeInfoType = std::uint32_t;
41};
42
43class OggIterator;
44
45class TAG_PARSER_EXPORT VorbisCommentField : public TagField<VorbisCommentField> {
46 friend class TagField<VorbisCommentField>;
47
48public:
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
62private:
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
86inline std::string VorbisCommentField::fieldIdFromString(std::string_view idString)
87{
88 return std::string(idString);
89}
90
95inline 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.
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.
IdentifierType & id()
Returns the id of the current TagField.
The TagValue class wraps values of different types.
Definition tagvalue.h:147
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.
Definition global.h:13
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)