Tag Parser: tests/helper.h Source File

Tag Parser 12.5.2 C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags

Loading...
Searching...
No Matches
helper.h
Go to the documentation of this file.
1#ifndef TAGPARSER_TEST_HELPER
2#define TAGPARSER_TEST_HELPER
3
4#include "../diagnostics.h"
5#include "../localehelper.h"
6#include "../size.h"
7#include "../tagvalue.h"
8
9#include <ostream>
10
11namespace CppUtilities {
12
13std::ostream &operator<<(std::ostream &os, const TagParser::TagTextEncoding &encoding);
14
18 inline std::ostream &operator<<(std::ostream &os, const TagParser::TagValue &tagValue)
19{
20 os << tagValue.toString(TagParser::TagTextEncoding::Utf8);
21 if (!tagValue.description().empty()) {
22 os << ", description: " << tagValue.description();
23 }
24 return os << " (encoding: " << tagValue.dataEncoding() << ", description encoding: " << tagValue.descriptionEncoding() << ')';
25}
26
30 inline std::ostream &operator<<(std::ostream &os, const TagParser::PositionInSet &pos)
31{
32 return os << pos.toString();
33}
34
38 inline std::ostream &operator<<(std::ostream &os, const TagParser::Size &size)
39{
40 return os << size.toString();
41}
42
46 inline std::ostream &operator<<(std::ostream &os, const TagParser::DiagMessage &diagMessage)
47{
48 return os << diagMessage.levelName() << ':' << ' ' << diagMessage.message() << ' ' << '(' << diagMessage.context() << ')';
49}
50
54 inline std::ostream &operator<<(std::ostream &os, const TagParser::Locale &locale)
55{
56 return os << locale.toString();
57}
58
59} // namespace CppUtilities
60
61#endif // TAGPARSER_TEST_HELPER
TagParser::DiagMessage
The DiagMessage class holds an information, warning or error gathered during parsing or making.
Definition diagnostics.h:41
TagParser::DiagMessage::levelName
std::string_view levelName() const
Returns the string representation of the level().
Definition diagnostics.h:119
TagParser::DiagMessage::context
const std::string & context() const
Returns the context.
Definition diagnostics.h:135
TagParser::DiagMessage::message
const std::string & message() const
Returns the message.
Definition diagnostics.h:127
TagParser::PositionInSet
The PositionInSet class describes the position of an element in a set which consists of a certain num...
Definition positioninset.h:21
TagParser::PositionInSet::toString
StringType toString() const
Returns the string representation of the current PositionInSet.
Definition positioninset.h:129
TagParser::Size
The Size class defines the size of a two-dimensional object using integer point precision.
Definition size.h:17
TagParser::Size::toString
std::string toString() const
Returns the string representation of the current size.
Definition size.h:125
TagParser::TagValue
The TagValue class wraps values of different types.
Definition tagvalue.h:147
TagParser::TagValue::dataEncoding
TagTextEncoding dataEncoding() const
Returns the data encoding.
Definition tagvalue.h:718
TagParser::TagValue::descriptionEncoding
TagTextEncoding descriptionEncoding() const
Returns the description encoding.
Definition tagvalue.h:728
TagParser::TagValue::toString
std::string toString(TagTextEncoding encoding=TagTextEncoding::Unspecified) const
Converts the value of the current TagValue object to its equivalent std::string representation.
Definition tagvalue.h:450
TagParser::TagValue::description
const std::string & description() const
Returns the description.
Definition tagvalue.h:561
diagnostics.h
localehelper.h
CppUtilities
Definition abstractcontainer.h:16
CppUtilities::operator<<
std::ostream & operator<<(std::ostream &os, const TagParser::TagTextEncoding &encoding)
Prints a TagTextEncoding to enable CPPUNIT_ASSERT_EQUAL for tag values.
Definition helper.cpp:8
TagParser::TagTextEncoding
TagTextEncoding
Specifies the text encoding.
Definition tagvalue.h:29
TagParser::TagTextEncoding::Utf8
@ Utf8
Definition tagvalue.h:31
size.h
TagParser::Locale
The Locale struct specifies a language and/or a country using one or more LocaleDetail objects.
Definition localehelper.h:61
TagParser::Locale::toString
std::string toString() const
Returns all details as comma-separated string.
Definition localehelper.cpp:135
tagvalue.h