Tag Parser  7.0.0
C++ library for reading and writing MP4 (iTunes), ID3, Vorbis, Opus, FLAC and Matroska tags
diagnostics.cpp
Go to the documentation of this file.
1 #include "./diagnostics.h"
2 
3 using namespace std;
4 
5 namespace TagParser {
6 
7 const char *diagLevelName(DiagLevel diagLevel)
8 {
9  switch (diagLevel) {
10  case DiagLevel::Information:
11  return "information";
12  case DiagLevel::Warning:
13  return "warning";
14  case DiagLevel::Critical:
15  return "critical";
16  case DiagLevel::None:
17  default:
18  return "";
19  }
20 }
21 
22 bool Diagnostics::has(DiagLevel level) const
23 {
24  for (const auto &msg : *this) {
25  if (msg.level() >= level) {
26  return true;
27  }
28  }
29  return false;
30 }
31 
32 DiagLevel Diagnostics::level() const
33 {
34  auto level = DiagLevel::None;
35  for (const auto &msg : *this) {
36  if ((level |= msg.level()) >= worstDiagLevel) {
37  return level;
38  }
39  }
40  return level;
41 }
42 
43 } // namespace TagParser
constexpr auto worstDiagLevel
Definition: diagnostics.h:25
STL namespace.
TAG_PARSER_EXPORT const char * diagLevelName(DiagLevel diagLevel)
Definition: diagnostics.cpp:7
DiagLevel
Specifies the level of the diagnostic message.
Definition: diagnostics.h:16