Tag Parser 12.3.1
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
18inline std::ostream &operator<<(std::ostream &os, const TagParser::TagValue &tagValue)
19{
21 if (!tagValue.description().empty()) {
22 os << ", description: " << tagValue.description();
23 }
24 return os << " (encoding: " << tagValue.dataEncoding() << ", description encoding: " << tagValue.descriptionEncoding() << ')';
25}
26
30inline std::ostream &operator<<(std::ostream &os, const TagParser::PositionInSet &pos)
31{
32 return os << pos.toString();
33}
34
38inline std::ostream &operator<<(std::ostream &os, const TagParser::Size &size)
39{
40 return os << size.toString();
41}
42
46inline std::ostream &operator<<(std::ostream &os, const TagParser::DiagMessage &diagMessage)
47{
48 return os << diagMessage.levelName() << ':' << ' ' << diagMessage.message() << ' ' << '(' << diagMessage.context() << ')';
49}
50
54inline 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
The DiagMessage class holds an information, warning or error gathered during parsing or making.
Definition diagnostics.h:41
std::string_view levelName() const
Returns the string representation of the level().
const std::string & context() const
Returns the context.
const std::string & message() const
Returns the message.
The PositionInSet class describes the position of an element in a set which consists of a certain num...
StringType toString() const
Returns the string representation of the current PositionInSet.
The Size class defines the size of a two-dimensional object using integer point precision.
Definition size.h:17
std::string toString() const
Returns the string representation of the current size.
Definition size.h:125
The TagValue class wraps values of different types.
TagTextEncoding dataEncoding() const
Returns the data encoding.
Definition tagvalue.h:718
TagTextEncoding descriptionEncoding() const
Returns the description encoding.
Definition tagvalue.h:728
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
const std::string & description() const
Returns the description.
Definition tagvalue.h:561
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
TagTextEncoding
Specifies the text encoding.
Definition tagvalue.h:29
The Locale struct specifies a language and/or a country using one or more LocaleDetail objects.
std::string toString() const
Returns all details as comma-separated string.