Support custom file parsing

This commit is contained in:
2024-08-04 13:15:58 -05:00
parent 40c7dea1f0
commit 3db5a19595
12 changed files with 91 additions and 37 deletions

View File

@@ -0,0 +1,23 @@
#pragma once
#include "Processor/file_processor.hpp"
#include "cd_file_types.hpp"
namespace JabyEngine {
namespace FileProcessor {
namespace Helper {
template<typename T>
static void simple_read(T& dst, State::Configuration& config) {
static constexpr size_t T_SIZE = sizeof(T);
dst = *reinterpret_cast<const T*>(config.data_adr);
config.processed(T_SIZE);
}
template<typename T>
static Progress exchange_and_execute_process_function(State::GenericProcessRoutine<T> process_routine, State::Configuration& config, T& state) {
config.process_routine = reinterpret_cast<State::ProcessRoutine>(process_routine);
return process_routine(config, state);
}
}
}
}