20#ifndef ORES_UTILITY_STREAMING_UUID_PARSER_HPP
21#define ORES_UTILITY_STREAMING_UUID_PARSER_HPP
25#include <boost/uuid/uuid.hpp>
26#include <boost/uuid/uuid_io.hpp>
27#include <boost/lexical_cast.hpp>
29namespace rfl::parsing {
31template <
class ReaderType,
class WriterType,
class ProcessorsType>
32struct Parser<ReaderType, WriterType, boost::uuids::uuid, ProcessorsType> {
33 using InputVarType =
typename ReaderType::InputVarType;
34 using OutputVarType =
typename WriterType::OutputVarType;
36 static Result<boost::uuids::uuid> read(
37 const ReaderType& _r,
const InputVarType& _var)
noexcept {
38 const auto str_result = Parser<ReaderType, WriterType,
39 std::string, ProcessorsType>::read(_r, _var);
41 return rfl::Unexpected(Error(str_result.error()->what()));
44 return boost::lexical_cast<boost::uuids::uuid>(str_result.value());
45 }
catch (
const std::exception& e) {
46 return rfl::Unexpected(Error(e.what()));
51 static void write(
const WriterType& _w,
52 const boost::uuids::uuid& _uuid,
53 const P& _parent)
noexcept {
54 const auto str = boost::lexical_cast<std::string>(_uuid);
55 Parser<ReaderType, WriterType, std::string, ProcessorsType>::write(