blob: 0ba91cc7e5e89ac820c25d01702b46368c9353ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#pragma once
#include <concepts>
#include <cstdint>
#include <functional>
#include <utility>
namespace ovdl {
struct NodeLocation;
struct File;
namespace detail {
enum class buffer_error : std::uint8_t;
}
}
namespace ovdl::detail {
template<typename T, typename... Ts>
concept any_of = (std::same_as<T, Ts> || ...);
template<typename T>
concept HasCstr =
requires(T t) {
{ t.c_str() } -> std::same_as<const char*>;
};
template<typename T>
concept HasPath = requires(T& t) {
{ t.path() } -> std::same_as<const char*>;
};
template<typename T, typename Self, typename... Args>
concept LoadCallback =
requires(T&& t, Self&& self, Args&&... args) {
{ std::invoke(std::forward<T>(t), std::forward<Self>(self), std::forward<Args>(args)...) } -> std::same_as<ovdl::detail::buffer_error>;
};
template<typename T>
concept IsEncoding = requires(T t) {
typename T::char_type;
typename T::int_type;
{ T::template is_secondary_char_type<typename T::char_type>() } -> std::same_as<bool>;
{ T::eof() } -> std::same_as<typename T::int_type>;
{ T::to_int_type(typename T::char_type {}) } -> std::same_as<typename T::int_type>;
};
}
|