Initial public OpenBMH 0.1 source (by Codex)

This commit is contained in:
Codex committed 2026-10-16 19:36:32 +02:00
commit 558fbf166b
613 files changed
+168029

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: GPL-3.0-only
#include "formats/binary.hpp"
#include <fstream>
#include <iterator>
namespace bmh {
Bytes read_file(const std::filesystem::path& path) {
std::ifstream in(path, std::ios::binary);
if (!in) throw FormatError("cannot open " + path.string());
return Bytes(std::istreambuf_iterator<char>(in), {});
}
std::string iso646de_to_utf8(const char* s, size_t max_len) {
std::string out;
for (size_t i = 0; i < max_len && s[i] != '\0'; i++) {
switch (s[i]) {
case '[': out += "Ä"; break;
case '\\': out += "Ö"; break;
case ']': out += "Ü"; break;
case '{': out += "ä"; break;
case '|': out += "ö"; break;
case '}': out += "ü"; break;
case '~': out += "ß"; break;
default: out += s[i];
}
}
return out;
}
} // namespace bmh