weh
This commit is contained in:
parent
693fa17d10
commit
500138ce67
331 changed files with 12348 additions and 60593 deletions
40
include/rfl/xml/Parser.hpp
Normal file
40
include/rfl/xml/Parser.hpp
Normal file
|
@ -0,0 +1,40 @@
|
|||
#ifndef RFL_XML_PARSER_HPP_
|
||||
#define RFL_XML_PARSER_HPP_
|
||||
|
||||
#include <type_traits>
|
||||
|
||||
#include "../internal/is_attribute.hpp"
|
||||
#include "../parsing/NamedTupleParser.hpp"
|
||||
#include "../parsing/Parser.hpp"
|
||||
#include "Reader.hpp"
|
||||
#include "Writer.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace parsing {
|
||||
|
||||
/// XML is very special. It doesn't have proper support for arrays, which means
|
||||
/// that we just need to ignore empty containers. Therefore, we need to a
|
||||
/// template specialization for the NamedTuple parser to accommodate for it.
|
||||
template <class ProcessorsType, class... FieldTypes>
|
||||
requires AreReaderAndWriter<xml::Reader, xml::Writer, NamedTuple<FieldTypes...>>
|
||||
struct Parser<xml::Reader, xml::Writer, NamedTuple<FieldTypes...>,
|
||||
ProcessorsType>
|
||||
: public NamedTupleParser<xml::Reader, xml::Writer,
|
||||
/*_ignore_empty_containers=*/true,
|
||||
/*_all_required=*/ProcessorsType::all_required_,
|
||||
ProcessorsType, FieldTypes...> {
|
||||
};
|
||||
|
||||
} // namespace parsing
|
||||
} // namespace rfl
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
template <class T, class ProcessorsType>
|
||||
using Parser = parsing::Parser<Reader, Writer, T, ProcessorsType>;
|
||||
|
||||
}
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
174
include/rfl/xml/Reader.hpp
Normal file
174
include/rfl/xml/Reader.hpp
Normal file
|
@ -0,0 +1,174 @@
|
|||
#ifndef RFL_XML_READER_HPP_
|
||||
#define RFL_XML_READER_HPP_
|
||||
|
||||
#include <array>
|
||||
#include <exception>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <pugixml.hpp>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <unordered_map>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "../Result.hpp"
|
||||
#include "../always_false.hpp"
|
||||
#include "../parsing/is_view_reader.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
struct Reader {
|
||||
struct XMLInputArray {
|
||||
XMLInputArray(pugi::xml_node _node) : node_(_node) {}
|
||||
pugi::xml_node node_;
|
||||
};
|
||||
|
||||
struct XMLInputObject {
|
||||
XMLInputObject(pugi::xml_node _node) : node_(_node) {}
|
||||
pugi::xml_node node_;
|
||||
};
|
||||
|
||||
struct XMLInputVar {
|
||||
XMLInputVar() : node_or_attribute_(pugi::xml_node()) {}
|
||||
XMLInputVar(pugi::xml_attribute _attr) : node_or_attribute_(_attr) {}
|
||||
XMLInputVar(pugi::xml_node _node) : node_or_attribute_(_node) {}
|
||||
std::variant<pugi::xml_node, pugi::xml_attribute> node_or_attribute_;
|
||||
};
|
||||
|
||||
using InputArrayType = XMLInputArray;
|
||||
using InputObjectType = XMLInputObject;
|
||||
using InputVarType = XMLInputVar;
|
||||
|
||||
// TODO
|
||||
template <class T>
|
||||
static constexpr bool has_custom_constructor = false;
|
||||
|
||||
/// XML-only helper function. This is needed because XML distinguishes between
|
||||
/// nodes and attributes.
|
||||
static rfl::Result<pugi::xml_node> cast_as_node(
|
||||
const std::variant<pugi::xml_node, pugi::xml_attribute>&
|
||||
_node_or_attribute) {
|
||||
const auto cast = [](const auto& _n) -> Result<pugi::xml_node> {
|
||||
using Type = std::remove_cvref_t<decltype(_n)>;
|
||||
if constexpr (std::is_same<Type, pugi::xml_node>()) {
|
||||
return _n;
|
||||
} else {
|
||||
return Error("Field '" + std::string(_n.name()) + "' is an attribute.");
|
||||
}
|
||||
};
|
||||
return std::visit(cast, _node_or_attribute);
|
||||
}
|
||||
|
||||
rfl::Result<InputVarType> get_field(
|
||||
const std::string& _name, const InputObjectType _obj) const noexcept {
|
||||
const auto node = _obj.node_.child(_name.c_str());
|
||||
if (!node) {
|
||||
return rfl::Error("Object contains no field named '" + _name + "'.");
|
||||
}
|
||||
return InputVarType(node);
|
||||
}
|
||||
|
||||
bool is_empty(const InputVarType _var) const noexcept {
|
||||
const auto wrap = [](const auto& _node) { return !_node; };
|
||||
return std::visit(cast_as_node, _var.node_or_attribute_)
|
||||
.transform(wrap)
|
||||
.value_or(false);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
rfl::Result<T> to_basic_type(const InputVarType _var) const noexcept {
|
||||
const auto get_value = [](const auto& _n) -> std::string {
|
||||
using Type = std::remove_cvref_t<decltype(_n)>;
|
||||
if constexpr (std::is_same<Type, pugi::xml_node>()) {
|
||||
return std::string(_n.child_value());
|
||||
} else {
|
||||
return std::string(_n.value());
|
||||
}
|
||||
};
|
||||
|
||||
if constexpr (std::is_same<std::remove_cvref_t<T>, std::string>()) {
|
||||
return std::visit(get_value, _var.node_or_attribute_);
|
||||
} else if constexpr (std::is_same<std::remove_cvref_t<T>, bool>()) {
|
||||
return std::visit(get_value, _var.node_or_attribute_) == "true";
|
||||
} else if constexpr (std::is_floating_point<std::remove_cvref_t<T>>()) {
|
||||
const auto str = std::visit(get_value, _var.node_or_attribute_);
|
||||
try {
|
||||
return static_cast<T>(std::stod(str));
|
||||
} catch (std::exception& e) {
|
||||
return Error("Could not cast '" + std::string(str) +
|
||||
"' to floating point value.");
|
||||
}
|
||||
} else if constexpr (std::is_integral<std::remove_cvref_t<T>>()) {
|
||||
const auto str = std::visit(get_value, _var.node_or_attribute_);
|
||||
try {
|
||||
return static_cast<T>(std::stoi(str));
|
||||
} catch (std::exception& e) {
|
||||
return Error("Could not cast '" + std::string(str) + "' to integer.");
|
||||
}
|
||||
} else {
|
||||
static_assert(rfl::always_false_v<T>, "Unsupported type.");
|
||||
}
|
||||
}
|
||||
|
||||
rfl::Result<InputArrayType> to_array(const InputVarType _var) const noexcept {
|
||||
const auto wrap = [](const auto& _node) { return InputArrayType(_node); };
|
||||
return std::visit(cast_as_node, _var.node_or_attribute_).transform(wrap);
|
||||
}
|
||||
|
||||
template <class ArrayReader>
|
||||
std::optional<Error> read_array(const ArrayReader& _array_reader,
|
||||
const InputArrayType& _arr) const noexcept {
|
||||
const auto name = _arr.node_.name();
|
||||
for (auto node = _arr.node_; node; node = node.next_sibling(name)) {
|
||||
const auto err = _array_reader.read(InputVarType(node));
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
}
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
template <class ObjectReader>
|
||||
std::optional<Error> read_object(const ObjectReader& _object_reader,
|
||||
const InputObjectType& _obj) const noexcept {
|
||||
for (auto child = _obj.node_.first_child(); child;
|
||||
child = child.next_sibling()) {
|
||||
_object_reader.read(std::string_view(child.name()), InputVarType(child));
|
||||
}
|
||||
|
||||
for (auto attr = _obj.node_.first_attribute(); attr;
|
||||
attr = attr.next_attribute()) {
|
||||
_object_reader.read(std::string_view(attr.name()), InputVarType(attr));
|
||||
}
|
||||
|
||||
if constexpr (parsing::is_view_reader_v<ObjectReader>) {
|
||||
_object_reader.read(std::string_view("xml_content"),
|
||||
InputVarType(_obj.node_));
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
rfl::Result<InputObjectType> to_object(
|
||||
const InputVarType _var) const noexcept {
|
||||
const auto wrap = [](const auto& _node) { return InputObjectType(_node); };
|
||||
return std::visit(cast_as_node, _var.node_or_attribute_).transform(wrap);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
rfl::Result<T> use_custom_constructor(
|
||||
const InputVarType _var) const noexcept {
|
||||
return rfl::Error("TODO");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace xml
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
181
include/rfl/xml/Writer.hpp
Normal file
181
include/rfl/xml/Writer.hpp
Normal file
|
@ -0,0 +1,181 @@
|
|||
#ifndef RFL_XML_WRITER_HPP_
|
||||
#define RFL_XML_WRITER_HPP_
|
||||
|
||||
#include <exception>
|
||||
#include <map>
|
||||
#include <pugixml.hpp>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <type_traits>
|
||||
#include <vector>
|
||||
|
||||
#include "../Ref.hpp"
|
||||
#include "../Result.hpp"
|
||||
#include "../always_false.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
struct Writer {
|
||||
static constexpr const char* XML_CONTENT = "xml_content";
|
||||
|
||||
struct XMLOutputArray {
|
||||
XMLOutputArray(const std::string_view& _name,
|
||||
const Ref<pugi::xml_node>& _node)
|
||||
: name_(_name), node_(_node) {}
|
||||
std::string_view name_;
|
||||
Ref<pugi::xml_node> node_;
|
||||
};
|
||||
|
||||
struct XMLOutputObject {
|
||||
XMLOutputObject(const Ref<pugi::xml_node>& _node) : node_(_node) {}
|
||||
Ref<pugi::xml_node> node_;
|
||||
};
|
||||
|
||||
struct XMLOutputVar {
|
||||
XMLOutputVar(const Ref<pugi::xml_node>& _node) : node_(_node) {}
|
||||
Ref<pugi::xml_node> node_;
|
||||
};
|
||||
|
||||
using OutputArrayType = XMLOutputArray;
|
||||
using OutputObjectType = XMLOutputObject;
|
||||
using OutputVarType = XMLOutputVar;
|
||||
|
||||
Writer(const Ref<pugi::xml_node>& _root, const std::string& _root_name)
|
||||
: root_(_root), root_name_(_root_name) {}
|
||||
|
||||
~Writer() = default;
|
||||
|
||||
OutputArrayType array_as_root(const size_t _size) const noexcept {
|
||||
auto node_child =
|
||||
Ref<pugi::xml_node>::make(root_->append_child(root_name_.c_str()));
|
||||
return OutputArrayType(root_name_, node_child);
|
||||
}
|
||||
|
||||
OutputObjectType object_as_root(const size_t _size) const noexcept {
|
||||
auto node_child =
|
||||
Ref<pugi::xml_node>::make(root_->append_child(root_name_.c_str()));
|
||||
return OutputObjectType(node_child);
|
||||
}
|
||||
|
||||
OutputVarType null_as_root() const noexcept {
|
||||
auto node_child =
|
||||
Ref<pugi::xml_node>::make(root_->append_child(root_name_.c_str()));
|
||||
return OutputVarType(node_child);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
OutputVarType value_as_root(const T& _var) const noexcept {
|
||||
const auto str = to_string(_var);
|
||||
auto node_child =
|
||||
Ref<pugi::xml_node>::make(root_->append_child(root_name_.c_str()));
|
||||
node_child->append_child(pugi::node_pcdata).set_value(str.c_str());
|
||||
return OutputVarType(node_child);
|
||||
}
|
||||
|
||||
OutputArrayType add_array_to_array(const size_t _size,
|
||||
OutputArrayType* _parent) const noexcept {
|
||||
return *_parent;
|
||||
}
|
||||
|
||||
OutputArrayType add_array_to_object(
|
||||
const std::string_view& _name, const size_t _size,
|
||||
OutputObjectType* _parent) const noexcept {
|
||||
return OutputArrayType(_name, _parent->node_);
|
||||
}
|
||||
|
||||
OutputObjectType add_object_to_array(
|
||||
const size_t _size, OutputArrayType* _parent) const noexcept {
|
||||
auto node_child = Ref<pugi::xml_node>::make(
|
||||
_parent->node_->append_child(_parent->name_.data()));
|
||||
return OutputObjectType(node_child);
|
||||
}
|
||||
|
||||
OutputObjectType add_object_to_object(
|
||||
const std::string_view& _name, const size_t _size,
|
||||
OutputObjectType* _parent) const noexcept {
|
||||
auto node_child =
|
||||
Ref<pugi::xml_node>::make(_parent->node_->append_child(_name.data()));
|
||||
return OutputObjectType(node_child);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
OutputVarType add_value_to_array(const T& _var,
|
||||
OutputArrayType* _parent) const noexcept {
|
||||
const auto str = to_string(_var);
|
||||
auto node_child = Ref<pugi::xml_node>::make(
|
||||
_parent->node_->append_child(_parent->name_.data()));
|
||||
node_child->append_child(pugi::node_pcdata).set_value(str.c_str());
|
||||
return OutputVarType(node_child);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
OutputVarType add_value_to_object(
|
||||
const std::string_view& _name, const T& _var, OutputObjectType* _parent,
|
||||
const bool _is_attribute = false) const noexcept {
|
||||
const auto str = to_string(_var);
|
||||
if (_is_attribute) {
|
||||
_parent->node_->append_attribute(_name.data()) = str.c_str();
|
||||
return OutputVarType(_parent->node_);
|
||||
} else if (_name == XML_CONTENT) {
|
||||
_parent->node_->append_child(pugi::node_pcdata).set_value(str.c_str());
|
||||
return OutputVarType(_parent->node_);
|
||||
} else {
|
||||
auto node_child =
|
||||
Ref<pugi::xml_node>::make(_parent->node_->append_child(_name.data()));
|
||||
node_child->append_child(pugi::node_pcdata).set_value(str.c_str());
|
||||
return OutputVarType(node_child);
|
||||
}
|
||||
}
|
||||
|
||||
OutputVarType add_null_to_array(OutputArrayType* _parent) const noexcept {
|
||||
auto node_child = Ref<pugi::xml_node>::make(
|
||||
_parent->node_->append_child(_parent->name_.data()));
|
||||
return OutputVarType(node_child);
|
||||
}
|
||||
|
||||
OutputVarType add_null_to_object(
|
||||
const std::string_view& _name, OutputObjectType* _parent,
|
||||
const bool _is_attribute = false) const noexcept {
|
||||
if (_is_attribute) {
|
||||
return OutputVarType(_parent->node_);
|
||||
} else if (_name == XML_CONTENT) {
|
||||
return OutputVarType(_parent->node_);
|
||||
} else {
|
||||
auto node_child =
|
||||
Ref<pugi::xml_node>::make(_parent->node_->append_child(_name.data()));
|
||||
return OutputVarType(node_child);
|
||||
}
|
||||
}
|
||||
|
||||
void end_array(OutputArrayType* _arr) const noexcept {}
|
||||
|
||||
void end_object(OutputObjectType* _obj) const noexcept {}
|
||||
|
||||
private:
|
||||
template <class T>
|
||||
std::string to_string(const T& _val) const noexcept {
|
||||
if constexpr (std::is_same<std::remove_cvref_t<T>, std::string>()) {
|
||||
return _val;
|
||||
} else if constexpr (std::is_same<std::remove_cvref_t<T>, bool>()) {
|
||||
return _val ? "true" : "false";
|
||||
} else if constexpr (std::is_floating_point<std::remove_cvref_t<T>>() ||
|
||||
std::is_integral<std::remove_cvref_t<T>>()) {
|
||||
return std::to_string(_val);
|
||||
} else {
|
||||
static_assert(always_false_v<T>, "Unsupported type");
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
Ref<pugi::xml_node> root_;
|
||||
|
||||
std::string root_name_;
|
||||
};
|
||||
|
||||
} // namespace xml
|
||||
} // namespace rfl
|
||||
|
||||
#endif // XML_PARSER_HPP_
|
22
include/rfl/xml/load.hpp
Normal file
22
include/rfl/xml/load.hpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#ifndef RFL_XML_LOAD_HPP_
|
||||
#define RFL_XML_LOAD_HPP_
|
||||
|
||||
#include "../Result.hpp"
|
||||
#include "../io/load_string.hpp"
|
||||
#include "read.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
template <class T, class... Ps>
|
||||
Result<T> load(const std::string& _fname) {
|
||||
const auto read_string = [](const auto& _str) {
|
||||
return read<T, Ps...>(_str);
|
||||
};
|
||||
return rfl::io::load_string(_fname).and_then(read_string);
|
||||
}
|
||||
|
||||
} // namespace xml
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
50
include/rfl/xml/read.hpp
Normal file
50
include/rfl/xml/read.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
#ifndef RFL_XML_READ_HPP_
|
||||
#define RFL_XML_READ_HPP_
|
||||
|
||||
#include <istream>
|
||||
#include <pugixml.hpp>
|
||||
#include <string>
|
||||
|
||||
#include "../Processors.hpp"
|
||||
#include "../internal/get_type_name.hpp"
|
||||
#include "../internal/remove_namespaces.hpp"
|
||||
#include "Parser.hpp"
|
||||
#include "Reader.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
using InputVarType = typename Reader::InputVarType;
|
||||
|
||||
/// Parses an object from a XML var.
|
||||
template <class T, class... Ps>
|
||||
auto read(const InputVarType& _var) {
|
||||
const auto r = Reader();
|
||||
return Parser<T, Processors<Ps...>>::read(r, _var);
|
||||
}
|
||||
|
||||
/// Parses an object from XML using reflection.
|
||||
template <class T, class... Ps>
|
||||
Result<T> read(const std::string& _xml_str) {
|
||||
pugi::xml_document doc;
|
||||
const auto result = doc.load_string(_xml_str.c_str());
|
||||
if (!result) {
|
||||
return Error("XML string could not be parsed: " +
|
||||
std::string(result.description()));
|
||||
}
|
||||
const auto var = InputVarType(doc.first_child());
|
||||
return read<T, Ps...>(var);
|
||||
}
|
||||
|
||||
/// Parses an object from a stringstream.
|
||||
template <class T, class... Ps>
|
||||
auto read(std::istream& _stream) {
|
||||
const auto xml_str = std::string(std::istreambuf_iterator<char>(_stream),
|
||||
std::istreambuf_iterator<char>());
|
||||
return read<T, Ps...>(xml_str);
|
||||
}
|
||||
|
||||
} // namespace xml
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
28
include/rfl/xml/save.hpp
Normal file
28
include/rfl/xml/save.hpp
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef RFL_XML_SAVE_HPP_
|
||||
#define RFL_XML_SAVE_HPP_
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "../Result.hpp"
|
||||
#include "../internal/StringLiteral.hpp"
|
||||
#include "../io/save_string.hpp"
|
||||
#include "write.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
template <internal::StringLiteral _root = internal::StringLiteral(""),
|
||||
class... Ps>
|
||||
Result<Nothing> save(const std::string& _fname, const auto& _obj) {
|
||||
const auto write_func = [](const auto& _obj, auto& _stream) -> auto& {
|
||||
return write<_root, Ps...>(_obj, _stream);
|
||||
};
|
||||
return rfl::io::save_string(_fname, _obj, write_func);
|
||||
}
|
||||
|
||||
} // namespace xml
|
||||
} // namespace rfl
|
||||
|
||||
#endif
|
74
include/rfl/xml/write.hpp
Normal file
74
include/rfl/xml/write.hpp
Normal file
|
@ -0,0 +1,74 @@
|
|||
#ifndef RFL_XML_WRITE_HPP_
|
||||
#define RFL_XML_WRITE_HPP_
|
||||
|
||||
#include <ostream>
|
||||
#include <pugixml.hpp>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
|
||||
#include "../Processors.hpp"
|
||||
#include "../internal/StringLiteral.hpp"
|
||||
#include "../internal/get_type_name.hpp"
|
||||
#include "../internal/remove_namespaces.hpp"
|
||||
#include "../parsing/Parent.hpp"
|
||||
#include "Parser.hpp"
|
||||
|
||||
namespace rfl {
|
||||
namespace xml {
|
||||
|
||||
template <internal::StringLiteral _root, class T>
|
||||
consteval auto get_root_name() {
|
||||
if constexpr (_root != internal::StringLiteral("")) {
|
||||
return _root;
|
||||
} else {
|
||||
return internal::remove_namespaces<
|
||||
internal::get_type_name<std::remove_cvref_t<T>>()>();
|
||||
}
|
||||
}
|
||||
|
||||
/// Writes a XML into an ostream.
|
||||
template <internal::StringLiteral _root = internal::StringLiteral(""),
|
||||
class... Ps>
|
||||
std::ostream& write(const auto& _obj, std::ostream& _stream,
|
||||
const std::string& _indent = " ") {
|
||||
using T = std::remove_cvref_t<decltype(_obj)>;
|
||||
using ParentType = parsing::Parent<Writer>;
|
||||
|
||||
constexpr auto root_name = get_root_name<_root, T>();
|
||||
|
||||
static_assert(root_name.string_view().find("<") == std::string_view::npos &&
|
||||
root_name.string_view().find(">") == std::string_view::npos,
|
||||
"The name of an XML root node cannot contain '<' or '>'. "
|
||||
"Please assign an "
|
||||
"explicit root name to rfl::xml::write(...) like this: "
|
||||
"rfl::xml::write<\"root_name\">(...).");
|
||||
|
||||
const auto doc = rfl::Ref<pugi::xml_document>::make();
|
||||
|
||||
auto declaration_node = doc->append_child(pugi::node_declaration);
|
||||
declaration_node.append_attribute("version") = "1.0";
|
||||
declaration_node.append_attribute("encoding") = "UTF-8";
|
||||
|
||||
auto w = Writer(doc, root_name.str());
|
||||
|
||||
Parser<T, Processors<Ps...>>::write(w, _obj, typename ParentType::Root{});
|
||||
|
||||
doc->save(_stream, _indent.c_str());
|
||||
|
||||
return _stream;
|
||||
}
|
||||
|
||||
/// Returns a XML string.
|
||||
template <internal::StringLiteral _root = internal::StringLiteral(""),
|
||||
class... Ps>
|
||||
std::string write(const auto& _obj, const std::string& _indent = " ") {
|
||||
std::stringstream stream;
|
||||
write<_root, Ps...>(_obj, stream);
|
||||
return stream.str();
|
||||
}
|
||||
|
||||
} // namespace xml
|
||||
} // namespace rfl
|
||||
|
||||
#endif // XML_PARSER_HPP_
|
Loading…
Add table
Add a link
Reference in a new issue