58 lines
1.1 KiB
C++
58 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <filesystem>
|
|
|
|
#include "assets/data_stores.hpp"
|
|
#include "assets/path_id_lookups.hpp"
|
|
#include "assets/data/pose_data.hpp"
|
|
#include "util/result.hpp"
|
|
|
|
namespace assets
|
|
{
|
|
|
|
struct threedtk_pose_loader
|
|
{
|
|
static constexpr auto name = std::string_view("3dtk_pose");
|
|
using data_type = pose_list_data;
|
|
using store_type = pose_list_store;
|
|
using lookup_type = pose_list_id_lookup;
|
|
|
|
[[nodiscard]] std::error_code prefetch(
|
|
path_id_lookups& lookups
|
|
);
|
|
|
|
[[nodiscard]] std::error_code load(
|
|
path_id_lookups& lookups,
|
|
data_stores& stores,
|
|
bool pedantic = false
|
|
);
|
|
|
|
protected:
|
|
class parser_context
|
|
{
|
|
public:
|
|
parser_context(
|
|
path_id_lookups& pose_list_lookup,
|
|
data_stores& stores
|
|
);
|
|
|
|
void operator()(lookup_type::const_pointer entry) noexcept;
|
|
|
|
private:
|
|
path_id_lookups* m_id_lookups;
|
|
data_stores* m_stores;
|
|
data_type m_pose{};
|
|
std::string m_line_buffer{};
|
|
};
|
|
|
|
static ztu::result<pose_data> parse_file(
|
|
const std::filesystem::path& filename,
|
|
std::string& line_buffer
|
|
);
|
|
|
|
private:
|
|
std::vector<lookup_type::const_pointer> m_path_buffer;
|
|
};
|
|
|
|
}
|