draconisplusplus/include/rfl/parsing/supports_attributes.hpp

34 lines
821 B
C++
Raw Normal View History

2024-05-31 22:59:00 -04:00
#ifndef RFL_PARSING_SUPPORTSATTRIBUTES_HPP_
#define RFL_PARSING_SUPPORTSATTRIBUTES_HPP_
#include <concepts>
#include <string>
#include <string_view>
#include "../Result.hpp"
namespace rfl {
2024-06-08 14:10:59 -04:00
namespace parsing {
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
/// Determines whether a writer supports attributes.
template <class W>
2024-06-08 15:53:06 -04:00
concept supports_attributes = requires(
W w,
std::string_view name,
typename W::OutputObjectType obj,
bool is_attribute
) {
2024-06-08 14:10:59 -04:00
{
w.add_value_to_object(name, name, &obj, is_attribute)
} -> std::same_as<typename W::OutputVarType>;
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
{
w.add_null_to_object(name, &obj, is_attribute)
} -> std::same_as<typename W::OutputVarType>;
};
2024-05-31 22:59:00 -04:00
2024-06-08 14:10:59 -04:00
} // namespace parsing
} // namespace rfl
2024-05-31 22:59:00 -04:00
#endif