Sygaldry
Loading...
Searching...
No Matches
sygac-metadata.hpp
1
#pragma once
2
/*
3
Copyright 2023 Travis J. West, https://traviswest.ca, Input Devices and Music
4
Interaction Laboratory (IDMIL), Centre for Interdisciplinary Research in Music
5
Media and Technology (CIRMMT), McGill University, Montréal, Canada, and Univ.
6
Lille, Inria, CNRS, Centrale Lille, UMR 9189 CRIStAL, F-59000 Lille, France
7
8
SPDX-License-Identifier: MIT
9
*/
10
11
#include <concepts>
12
#include "sygah-consteval.hpp"
13
14
namespace
sygaldry {
15
19
23
24
#define text_concept(CONCEPT_NAME) template<typename T> \
25
concept has_##CONCEPT_NAME = requires \
26
{ \
27
{std::decay_t<T>::CONCEPT_NAME()} -> std::convertible_to<std::string>; \
28
{std::decay_t<T>::CONCEPT_NAME()} -> std::convertible_to<std::string_view>; \
29
{std::decay_t<T>::CONCEPT_NAME()} -> std::convertible_to<const char *>; \
30
}; \
31
template<has_##CONCEPT_NAME T> \
32
constexpr auto CONCEPT_NAME##_of(const T&) { return T::CONCEPT_NAME(); } \
33
\
34
template<has_##CONCEPT_NAME T> \
35
_consteval auto CONCEPT_NAME##_of() { return std::decay_t<T>::CONCEPT_NAME(); }
36
37
text_concept(name);
38
text_concept(author);
39
text_concept(email);
40
text_concept(license);
41
text_concept(description);
42
text_concept(uuid);
43
text_concept(unit);
44
text_concept(version);
45
text_concept(date);
46
47
#undef text_concept
48
51
}
52
sygaldry
sygac-metadata
sygac-metadata.hpp
Generated by
1.9.8