flatten 20260225

This commit is contained in:
Timothy Prepscius
2026-02-25 12:39:24 -05:00
commit fa54be052a
315 changed files with 49791 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
// TJP COPYRIGHT HEADER
#pragma once
#include <sstream>
#include <iomanip>
namespace tjp::core {
template<typename T>
String to_cstring(const T &v)
{
std::ostringstream out_;
for (auto &c_ : v)
{
auto c = static_cast<unsigned char>(c_);
out_ << "\\x" << std::hex << std::setw(2) << std::setfill('0') << (static_cast<unsigned int>(c) & 0xff);
}
return out_.str();
}
template<typename T>
String to_printable_with_dots(const T &v)
{
std::ostringstream out_;
for (auto &c_ : v)
{
if (isprint(static_cast<unsigned char>(c_) && c_ != '\n'))
{
out_ << c_;
}
else
{
out_ << ".";
}
}
return out_.str();
}
} // namespace