IceShard 1
A personal game engine project, with development focused on 2D/2.5D games.
Loading...
Searching...
No Matches
config.hxx
Go to the documentation of this file.
1
3
4#pragma once
5#include <ice/array.hxx>
7
8namespace ice::config
9{
10
12
13 auto from_json(ice::Allocator& alloc, ice::String json, ice::Memory& out_memory) noexcept -> ice::Config;
14
15 template<typename T, typename Key>
17 auto get(
18 ice::Config const& config,
19 Key key,
20 T& out_value,
22 ) noexcept -> ice::ErrorCode;
23
24 template<typename T, typename Key>
26 auto get(
27 ice::Config const& config,
28 Key key,
30 ) noexcept -> ice::Expected<T>;
31
32 template<typename T, typename Key>
34 auto get_array(
35 ice::Config const& config,
36 Key key,
37 ice::Array<T>& out_values,
39 ) noexcept -> ice::ErrorCode;
40
42
43 template<typename T, typename Key>
45 auto get(
46 ice::Config const& config,
47 Key key,
48 T& out_value,
50 ) noexcept -> ice::ErrorCode
51 {
52 return ice::config::detail::get(config, key, out_value, flags);
53 }
54
55 template<typename T, typename Key>
57 auto get(
58 ice::Config const& config,
59 Key key,
61 ) noexcept -> ice::Expected<T>
62 {
63 T result{};
64 if (ErrorCode const err = ice::config::get(config, key, result, flags); err != S_Ok)
65 {
66 return err;
67 }
68 return result;
69 }
70
71 template<typename T, typename Key>
74 ice::Config const& config,
75 Key key,
76 ice::Array<T>& out_values,
78 ) noexcept -> ice::ErrorCode
79 {
80 return ice::config::detail::get_array(config, key, out_values, flags);
81 }
82
83} // namespace ice
Definition config_types.hxx:34
Definition expected.hxx:16
Definition config_details.hxx:23
Definition config_details.hxx:26
auto get(ice::Config const &config, ice::config::detail::ConfigKey const *key, ice::config::detail::ConfigValue const *value, T &out_value, ice::ConfigValueFlags flags) noexcept -> ice::ErrorCode
auto get_array(ice::Config const &config, Key key, ice::Array< T > &out_values, ice::ConfigValueFlags flags) noexcept -> ice::ErrorCode
Definition config_impl.hxx:102
Definition config.hxx:9
auto get(ice::Config const &config, Key key, T &out_value, ice::ConfigValueFlags flags=ConfigValueFlags::None) noexcept -> ice::ErrorCode
Definition config.hxx:45
auto get_array(ice::Config const &config, Key key, ice::Array< T > &out_values, ice::ConfigValueFlags flags=ConfigValueFlags::None) noexcept -> ice::ErrorCode
Definition config.hxx:73
auto from_json(ice::Allocator &alloc, ice::String json, ice::Memory &out_memory) noexcept -> ice::Config
auto from_data(ice::Data data) noexcept -> ice::Config
Definition span.hxx:129
ice::BasicString< char > String
Definition string.hxx:82
auto alloc(ice::usize size) noexcept -> ice::AllocResult
ConfigValueFlags
Definition config_types.hxx:11
@ None
Definition config_types.hxx:12
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition mem_types.hxx:25
static constexpr ice::ErrorCodeSuccess S_Ok
Definition error_codes.hxx:10
A simple container storing items in continuous memory.
Definition array.hxx:24
Definition mem_data.hxx:17
Definition error.hxx:19
Definition mem_memory.hxx:13