Tag Parser: vorbis/vorbiscommentfield.h Source File

Tag Parser 12.5.3 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
18 enum class VorbisCommentFlags : std::uint8_t {
19 None = 0x0,
20 NoSignature = 0x1,
21 NoFramingByte = 0x2,
22 NoCovers = 0x4,
23 ConvertTotalFields = 0x8,
24};
25
26} // namespace TagParser
27
28 CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::VorbisCommentFlags)
29
30namespace TagParser {
31
32class VorbisCommentField;
33class Diagnostics;
34
38 template <> class TAG_PARSER_EXPORT TagFieldTraits<VorbisCommentField> {
39public:
40 using IdentifierType = std::string;
41 using TypeInfoType = std::uint32_t;
42};
43
44class OggIterator;
45
46 class TAG_PARSER_EXPORT VorbisCommentField : public TagField<VorbisCommentField> {
47 friend class TagField<VorbisCommentField>;
48
49public:
50 VorbisCommentField();
51 VorbisCommentField(const IdentifierType &id, const TagValue &value);
52
53 void parse(OggIterator &iterator, Diagnostics &diag);
54 void parse(OggIterator &iterator, std::uint64_t &maxSize, Diagnostics &diag);
55 void parse(std::istream &stream, std::uint64_t &maxSize, Diagnostics &diag);
56 bool make(CppUtilities::BinaryWriter &writer, VorbisCommentFlags flags, Diagnostics &diag);
57 bool isAdditionalTypeInfoUsed() const;
58 bool supportsNestedFields() const;
59
60 static typename std::string fieldIdFromString(std::string_view idString);
61 static std::string fieldIdToString(const std::string &id);
62
63private:
64 template <class StreamType> void internalParse(StreamType &stream, std::uint64_t &maxSize, Diagnostics &diag);
65};
66
70 inline bool VorbisCommentField::isAdditionalTypeInfoUsed() const
71{
72 return false;
73}
74
78 inline bool VorbisCommentField::supportsNestedFields() const
79{
80 return false;
81}
82
87 inline std::string VorbisCommentField::fieldIdFromString(std::string_view idString)
88{
89 return std::string(idString);
90}
91
96 inline std::string VorbisCommentField::fieldIdToString(const std::string &id)
97{
98 return id;
99}
100
101} // namespace TagParser
102
103#endif // TAG_PARSER_VORBISCOMMENTFIELD_H
TagParser::Diagnostics
The Diagnostics class is a container for DiagMessage.
Definition diagnostics.h:156
TagParser::OggIterator
The OggIterator class helps iterating through all segments of an Ogg bitstream.
Definition oggiterator.h:11
TagParser::TagFieldTraits< VorbisCommentField >::TypeInfoType
std::uint32_t TypeInfoType
Definition vorbiscommentfield.h:41
TagParser::TagFieldTraits< VorbisCommentField >::IdentifierType
std::string IdentifierType
Definition vorbiscommentfield.h:40
TagParser::TagFieldTraits
Defines traits for the specified ImplementationType.
Definition generictagfield.h:16
TagParser::TagField< VorbisCommentField >::TagField
TagField()
Definition generictagfield.h:84
TagParser::TagField< VorbisCommentField >::IdentifierType
typename TagFieldTraits< VorbisCommentField >::IdentifierType IdentifierType
Definition generictagfield.h:33
TagParser::TagField< VorbisCommentField >::id
IdentifierType & id()
Definition generictagfield.h:116
TagParser::TagField< VorbisCommentField >::value
TagValue & value()
Definition generictagfield.h:156
TagParser::TagValue
The TagValue class wraps values of different types.
Definition tagvalue.h:147
TagParser::VorbisCommentField
The VorbisCommentField class is used by VorbisComment to store the fields.
Definition vorbiscommentfield.h:46
TagParser::VorbisCommentField::supportsNestedFields
bool supportsNestedFields() const
Returns whether nested fields are supported.
Definition vorbiscommentfield.h:78
TagParser::VorbisCommentField::parse
void parse(OggIterator &iterator, Diagnostics &diag)
Parses a field using the specified iterator.
Definition vorbiscommentfield.cpp:133
TagParser::VorbisCommentField::VorbisCommentField
VorbisCommentField()
Constructs a new Vorbis comment field.
Definition vorbiscommentfield.cpp:33
TagParser::VorbisCommentField::fieldIdFromString
static std::string fieldIdFromString(std::string_view idString)
Converts the specified ID string representation to an actual ID.
Definition vorbiscommentfield.h:87
TagParser::VorbisCommentField::fieldIdToString
static std::string fieldIdToString(const std::string &id)
Returns the string representation for the specified id.
Definition vorbiscommentfield.h:96
TagParser::VorbisCommentField::isAdditionalTypeInfoUsed
bool isAdditionalTypeInfoUsed() const
Returns whether the additional type info is used.
Definition vorbiscommentfield.h:70
TagParser::VorbisCommentField::make
bool make(CppUtilities::BinaryWriter &writer, VorbisCommentFlags flags, Diagnostics &diag)
Writes the field to a stream using the specified writer.
Definition vorbiscommentfield.cpp:178
generictagfield.h
TAG_PARSER_EXPORT
#define TAG_PARSER_EXPORT
Marks the symbol to be exported by the tagparser library.
Definition global.h:14
CppUtilities
Definition abstractcontainer.h:16
TagParser::SubFormats::None
@ None
Definition mediaformat.h:112
TagParser
Contains all classes and functions of the TagInfo library.
Definition aaccodebook.h:10
TagParser::MediaFileHandlingFlags::ConvertTotalFields
@ ConvertTotalFields
Definition mediafileinfo.h:69
TagParser::VorbisCommentFlags
VorbisCommentFlags
The VorbisCommentFlags enum specifies flags which controls parsing and making of Vorbis comments.
Definition vorbiscommentfield.h:18
TagParser::VorbisCommentFlags::NoCovers
@ NoCovers
Definition vorbiscommentfield.h:22
TagParser::VorbisCommentFlags::NoSignature
@ NoSignature
Definition vorbiscommentfield.h:20
TagParser::VorbisCommentFlags::NoFramingByte
@ NoFramingByte
Definition vorbiscommentfield.h:21
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS
CPP_UTILITIES_MARK_FLAG_ENUM_CLASS(TagParser, TagParser::TagCreationFlags)