Files
libbsarch/cpp/libbsarch.hpp
Deorder 6dbe006156 Reorganized directories
Readded .editorconfig
C wrapper can be built again
Delphi library can be built again
Initial cleanup of cmake files
2020-08-22 02:48:32 +02:00

33 lines
808 B
C++

#pragma once
#include "base_types.hpp"
#include "utils/convertible_ostream.hpp"
#include "utils/convertible_string.hpp"
namespace libbsarch {
constexpr bool enable_debug_log = true;
[[maybe_unused]] constexpr int max_string_buffer_size = 1024;
inline convertible_ostream &debug_log()
{
static convertible_ostream ostr;
if constexpr (enable_debug_log)
return ostr << "[libbsarch] " << __FUNCTION__ << ' ';
}
inline void checkResult(const bsa_result_message_s &result)
{
if (result.code == BSA_RESULT_EXCEPTION)
{
const std::string &error = to_string(result.text);
debug_log() << error;
throw std::runtime_error(error);
}
}
inline void checkResult(const bsa_result_message_buffer_s &result)
{
checkResult(result.message);
}
} // namespace libbsarch