Added XML support; #21

This commit is contained in:
Patrick Urbanke
2023-12-20 21:07:36 +01:00
parent 2281849dde
commit c5347eee28
124 changed files with 4652 additions and 1437 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef RFL_XML_IS_REQUIRED_FOR_XML_HPP_
#define RFL_XML_IS_REQUIRED_FOR_XML_HPP_
#include <type_traits>
#include "rfl/internal/has_reflection_type_v.hpp"
#include "rfl/parsing/is_required.hpp"
#include "rfl/parsing/is_vector_like.hpp"
namespace rfl {
namespace xml {
// Empty vectors are simply not represented in XML. Therefore, XML requires more
// lax rules when things are required.
template <class T>
consteval bool is_required_for_xml() {
using Type = std::decay_t<std::remove_pointer_t<T>>;
if constexpr (internal::has_reflection_type_v<T>) {
return is_required_for_xml<typename T::ReflectionType>();
} else {
return parsing::is_required<Type>() && !parsing::is_vector_like_v<Type>;
}
}
} // namespace xml
} // namespace rfl
#endif