Add the ability to print a nested item

This commit is contained in:
TennesseeTrash 2025-09-26 01:54:28 +02:00
parent f383ea9f66
commit 9bda00793d
2 changed files with 8 additions and 0 deletions

View file

@ -1,12 +1,15 @@
#ifndef LIBCBOR_PRINTER_HPP #ifndef LIBCBOR_PRINTER_HPP
#define LIBCBOR_PRINTER_HPP #define LIBCBOR_PRINTER_HPP
#include "Decoder.hpp"
#include <ostream> #include <ostream>
#include <span> #include <span>
namespace CBOR namespace CBOR
{ {
void Print(std::ostream &out, std::span<const std::uint8_t> buffer); void Print(std::ostream &out, std::span<const std::uint8_t> buffer);
void Print(std::ostream &out, CBOR::Item item);
} }
#endif // LIBCBOR_PRINTER_HPP #endif // LIBCBOR_PRINTER_HPP

View file

@ -143,4 +143,9 @@ namespace CBOR
Print(out, 0, dec.AsItem()); Print(out, 0, dec.AsItem());
out << '\n'; out << '\n';
} }
void Print(std::ostream &out, CBOR::Item item)
{
Print(out, 0, std::move(item));
}
} }