Allow opcodes to print in test outputs

This commit is contained in:
Jean Pierre Cimalando 2020-07-24 23:22:56 +02:00
parent fe4e5ffd6a
commit f6b549d0db
2 changed files with 9 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#include "absl/strings/ascii.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include <iostream>
#include <cctype>
#include <cassert>
@ -154,3 +155,8 @@ absl::optional<uint8_t> sfz::readNoteValue(absl::string_view value)
return static_cast<uint8_t>(noteNumber);
}
std::ostream &operator<<(std::ostream &os, const sfz::Opcode &opcode)
{
return os << opcode.opcode << '=' << '"' << opcode.value << '"';
}

View file

@ -16,6 +16,7 @@
#include <string_view>
#include <vector>
#include <type_traits>
#include <iosfwd>
// charconv support is still sketchy with clang/gcc so we use abseil's numbers
#include "absl/strings/numbers.h"
@ -292,3 +293,5 @@ inline void setCCPairFromOpcode(const Opcode& opcode, absl::optional<CCData<Valu
}
}
std::ostream &operator<<(std::ostream &os, const sfz::Opcode &opcode);