Tag Parser  7.0.0
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 "../diagnostics.h"
5 #include "../size.h"
6 #include "../tagvalue.h"
7 
8 #include <ostream>
9 
10 namespace TestUtilities {
11 
12 std::ostream &operator<<(std::ostream &os, const TagParser::TagTextEncoding &encoding);
13 
17 inline std::ostream &operator<<(std::ostream &os, const TagParser::TagValue &tagValue)
18 {
20  if (!tagValue.description().empty()) {
21  os << ", description: " << tagValue.description();
22  }
23  return os << " (encoding: " << tagValue.dataEncoding() << ", description encoding: " << tagValue.descriptionEncoding() << ')';
24 }
25 
29 inline std::ostream &operator<<(std::ostream &os, const TagParser::PositionInSet &pos)
30 {
31  return os << pos.toString();
32 }
33 
37 inline std::ostream &operator<<(std::ostream &os, const TagParser::Size &size)
38 {
39  return os << size.toString();
40 }
41 
45 inline std::ostream &operator<<(std::ostream &os, const TagParser::DiagMessage &diagMessage)
46 {
47  return os << diagMessage.levelName() << ':' << ' ' << diagMessage.message() << ' ' << '(' << diagMessage.context() << ')';
48 }
49 
50 } // namespace TestUtilities
51 
52 #endif // TAGPARSER_TEST_HELPER
TagTextEncoding dataEncoding() const
Returns the data encoding.
Definition: tagvalue.h:518
StringType toString() const
Returns the string representation of the current PositionInSet.
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 descriptionEncoding() const
Returns the description encoding.
Definition: tagvalue.h:528
const std::string & description() const
Returns the description.
Definition: tagvalue.h:426
const char * levelName() const
Definition: diagnostics.h:98
The Size class defines the size of a two-dimensional object using integer point precision.
Definition: size.h:16
const std::string & context() const
Definition: diagnostics.h:108
const std::string & message() const
Definition: diagnostics.h:103
std::string toString() const
Returns the string representation of the current size.
Definition: size.h:124
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:343
TagTextEncoding
Specifies the text encoding.
Definition: tagvalue.h:22