Tag Parser  6.5.1
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
helper.h
Go to the documentation of this file.
1 #ifndef TAGPARSER_TEST_HELPER
2 #define TAGPARSER_TEST_HELPER
3 
4 #include "../tagvalue.h"
5 #include "../notification.h"
6 
7 #include <ostream>
8 
9 namespace TestUtilities {
10 
11 std::ostream &operator <<(std::ostream &os, const Media::TagTextEncoding &encoding);
12 
16 inline std::ostream &operator <<(std::ostream &os, const Media::TagValue &tagValue)
17 {
18  return os << tagValue.toString(Media::TagTextEncoding::Utf8) << " (encoding: " << tagValue.dataEncoding() << ")";
19 }
20 
24 inline std::ostream &operator <<(std::ostream &os, const Media::PositionInSet &pos)
25 {
26  return os << pos.toString();
27 }
28 
32 inline std::ostream &operator <<(std::ostream &os, const Media::Notification &n)
33 {
34  return os << n.typeName() << ':' << ' ' << n.message() << ' ' << '(' << n.context() << ')';
35 }
36 
37 }
38 
39 #endif // TAGPARSER_TEST_HELPER
The TagValue class wraps values of different types.
Definition: tagvalue.h:64
TagTextEncoding dataEncoding() const
Returns the data encoding.
Definition: tagvalue.h:479
TagTextEncoding
Specifies the text encoding.
Definition: tagvalue.h:22
The PositionInSet class describes the position of an element in a set which consists of a certain num...
Definition: positioninset.h:20
const char * typeName() const
Returns the notification type as C-style string.
The Notification class holds a notification message of a certain notification type.
Definition: notification.h:43
const std::string & context() const
Returns the context, eg.
Definition: notification.h:83
const std::string & message() const
Returns the message.
Definition: notification.h:75
StringType toString() const
Returns the string representation of the current PositionInSet.
std::ostream & operator<<(std::ostream &os, const Media::TagTextEncoding &encoding)
Prints a TagTextEncoding to enable CPPUNIT_ASSERT_EQUAL for tag values.
Definition: helper.cpp:8
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:320