IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
module_concepts.hxx
Go to the documentation of this file.
1
3
4#pragma once
6#include <concepts>
7
8namespace ice::concepts
9{
10
11 template<typename T>
12 concept APIType = requires(T t)
13 {
14 { T::Constant_APIName } -> std::convertible_to<ice::StringID_Arg>;
15 { T::Constant_APIVersion } -> std::convertible_to<ice::u32>;
16 };
17
18 template<typename T>
19 concept APIExplicitPriority = requires(T t)
20 {
21 { T::Constant_APIPriority } -> std::convertible_to<ice::u32>;
22 };
23
26 {
27 static constexpr ice::StringID Constant_APIName = "api.concept.concept-api"_sid;
29 };
30
31 template<typename T>
32 concept ModuleNegotiator = requires(T const& t, ice::StringID_Arg id, ice::FnModuleSelectAPI* api) {
33 { t.query_apis(id, ice::u32{}, (ice::ModuleAPI*) nullptr, (ice::u32*)nullptr) } -> std::convertible_to<bool>;
34 { t.register_api(id, api) } -> std::convertible_to<bool>;
35 { t.from_app() } -> std::convertible_to<bool>;
36 } && requires(T const& t, ice::ProcAPIQuickRegisterFunc<APIConceptStruct> func) {
37 { t.register_api(func) } -> std::convertible_to<bool>;
38 };
39
40 template<typename T>
41 concept ModuleLoadable = requires(T t, ice::Allocator& alloc, ice::ModuleNegotiatorTagged<T> const& negotiator)
42 {
43 { T::on_load(alloc, negotiator) } -> std::convertible_to<bool>;
44 };
45
46 template<typename T>
47 concept ModuleUnloadable = requires(T t, ice::Allocator& alloc)
48 {
49 { T::on_unload(alloc) } -> std::convertible_to<void>;
50 };
51
52 // Currently this can be seen as an alias.
53 template<typename T>
55
56} // namespace ice::concepts
Definition module_negotiator.hxx:82
Definition module_concepts.hxx:19
Definition module_concepts.hxx:12
Definition module_concepts.hxx:41
Definition module_concepts.hxx:32
Definition module_concepts.hxx:54
Definition module_concepts.hxx:47
Definition devui_module.hxx:16
Definition container_concepts.hxx:12
void(*)(T &out_api) noexcept ProcAPIQuickRegisterFunc
Definition module_types.hxx:28
std::conditional_t< ice::build::Constant_StringID_DebugInfoEnabled, StringID const &, StringID > StringID_Arg
Argument type used to pass ice::StringID values to functions.
Definition stringid.hxx:23
auto alloc(ice::usize size) noexcept -> ice::AllocResult
constexpr ice::u32 const u32_max
Definition constants.hxx:37
BaseStringID< ice::build::Constant_StringID_DebugInfoEnabled > StringID
\copy ice::BaseStringID.
Definition stringid.hxx:15
std::uint32_t u32
Definition types.hxx:26
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition mem_types.hxx:25
bool(ice::StringID_Hash, ice::u32, ice::ModuleAPI *) FnModuleSelectAPI
Definition module_types.hxx:25
Stores information about a single API entry.
Definition module_info.hxx:33
Definition module_concepts.hxx:26
static constexpr ice::StringID Constant_APIName
Definition module_concepts.hxx:27
static constexpr ice::u32 Constant_APIVersion
Definition module_concepts.hxx:28