update sqlitecpp & merge property settings into properties

Signed-off-by: Folling <mail@folling.io>
This commit is contained in:
Folling 2023-11-27 11:24:55 +01:00 committed by Folling
parent 3dd30d74c5
commit 7a7f7462a4
No known key found for this signature in database
39 changed files with 412 additions and 253 deletions

View file

@ -0,0 +1,53 @@
#pragma once
#include <ranges>
#include <string_view>
#include <type_traits>
#include <fmt/format.h>
#include <cppbase/logger.hpp>
#include <ikarus/errors.h>
#include <persistence/project.hpp>
struct FunctionContext {
public:
explicit FunctionContext(struct IkarusProject * project);
FunctionContext(FunctionContext const&) noexcept = default;
FunctionContext(FunctionContext&&) noexcept = default;
auto operator=(FunctionContext const&) noexcept -> FunctionContext& = default;
auto operator=(FunctionContext&&) noexcept -> FunctionContext& = default;
~FunctionContext();
public:
template<typename... Infos>
requires(std::is_same_v<IkarusErrorInfo, Infos> && ...) && (sizeof...(Infos) <= MAXIMUM_ERROR_INFOS)
auto set_error(std::string_view error_message, bool log_error, Infos... infos) -> void {
if (error_message.size() > _project->error_message_buffer.size()) {
_project->error_message_buffer.resize(error_message.size() + 1);
}
for (int i = 0; i < error_message.size(); ++i) {
_project->error_message_buffer[i] = error_message[i];
}
_project->error_message_buffer[error_message.size()] = '\0';
_project->error_infos = {infos...};
if (log_error) {
LOG_ERROR(
"Error({}): {}",
fmt::join(_project->error_infos | std::views::transform(get_error_info_name), ", "),
error_message
);
}
}
private:
struct IkarusProject * _project;
};