IceShard
1
A personal game engine project, with development focused on 2D/2.5D games.
Toggle main menu visibility
Loading...
Searching...
No Matches
utils
public
ice
config
config_builder.hxx
Go to the documentation of this file.
1
3
4
#pragma once
5
#include <
ice/array.hxx
>
6
#include <
ice/config/config_types.hxx
>
7
#include <
ice/heap_varstring.hxx
>
8
9
namespace
ice
10
{
11
12
struct
ConfigBuilderValue
13
{
14
using
ConfigBuilderEntry
= ice::config::detail::ConfigBuilderEntry;
15
16
ConfigBuilderValue
(
ice::Allocator
*
alloc
,
ConfigBuilderEntry
* entry,
ice::u32
ref)
noexcept
;
17
~ConfigBuilderValue
() noexcept;
18
19
ConfigBuilderValue
(
ConfigBuilderValue
&&) noexcept;
20
ConfigBuilderValue
(
ConfigBuilderValue
const&) noexcept;
21
auto operator=(
ConfigBuilderValue
&&) noexcept ->
ConfigBuilderValue
&;
22
auto operator=(
ConfigBuilderValue
const&) noexcept ->
ConfigBuilderValue
&;
23
24
auto operator[](
ice
::
String
key) noexcept ->
ConfigBuilderValue
;
25
auto operator[](
ice
::
u32
idx) noexcept ->
ConfigBuilderValue
;
26
27
template<typename T> requires std::is_trivial_v<T>
28
auto
set
(T value) noexcept -> T&;
29
30
auto
set
(
ice
::
String
value) noexcept ->
ice
::
HeapVarString
<>&;
31
auto
set
(
char
const* value) noexcept ->
ice
::
HeapVarString
<>& {
return
set
(
ice::String
{value}); }
32
33
template
<
typename
T>
requires
std::is_trivial_v<T> || std::is_same_v<T, ice::String>
34
auto
operator=
(T value)
noexcept
->
decltype
(
set
(T{}));
35
36
void
reset
();
37
38
ice::Allocator
*
_alloc
;
39
ConfigBuilderEntry
*
_internal
;
40
ice::u32
_idx
;
41
};
42
43
template
<
typename
T>
requires
std::is_trivial_v<T> || std::is_same_v<T, ice::String>
44
auto
ConfigBuilderValue::operator=
(T value)
noexcept
->
decltype
(
set
(T{}))
45
{
46
return
this->set(value);
47
}
48
49
class
ConfigBuilder
:
public
ConfigBuilderValue
50
{
51
public
:
52
ConfigBuilder
(
ice::Allocator
&
alloc
)
noexcept
;
53
ConfigBuilder
(
ice::Allocator
&
alloc
,
ice::Config
const
&
config
)
noexcept
;
54
~ConfigBuilder
() noexcept;
55
56
auto
merge
(
ice
::
String
json) noexcept ->
ice
::
ErrorCode
;
57
auto
merge
(
ice
::
Config
const&
config
) noexcept ->
ice
::
ErrorCode
;
58
59
auto
finalize
(
ice
::
Allocator
&
alloc
) noexcept ->
ice
::
Memory
;
60
};
61
62
namespace
config
63
{
64
65
auto
from_json
(
ice::ConfigBuilder
& builder,
ice::String
json)
noexcept
->
ice::ErrorCode
;
66
67
}
// namespace config
68
69
}
// namespace ice
ice::ConfigBuilder
Definition
config_builder.hxx:50
ice::ConfigBuilder::merge
auto merge(ice::String json) noexcept -> ice::ErrorCode
ice::ConfigBuilder::ConfigBuilder
ConfigBuilder(ice::Allocator &alloc) noexcept
ice::ConfigBuilder::ConfigBuilder
ConfigBuilder(ice::Allocator &alloc, ice::Config const &config) noexcept
ice::ConfigBuilder::finalize
auto finalize(ice::Allocator &alloc) noexcept -> ice::Memory
ice::ConfigBuilder::~ConfigBuilder
~ConfigBuilder() noexcept
ice::Config
Definition
config_types.hxx:34
array.hxx
config_types.hxx
heap_varstring.hxx
ice::config
Definition
config.hxx:9
ice::config::from_json
auto from_json(ice::Allocator &alloc, ice::String json, ice::Memory &out_memory) noexcept -> ice::Config
ice
SPDX-License-Identifier: MIT.
Definition
array.hxx:12
ice::String
ice::BasicString< char > String
Definition
string.hxx:82
ice::alloc
auto alloc(ice::usize size) noexcept -> ice::AllocResult
ice::u32
std::uint32_t u32
Definition
types.hxx:26
ice::Allocator
ice::AllocatorBase< ice::build::is_debug||ice::build::is_develop > Allocator
Definition
mem_types.hxx:25
ice::ConfigBuilderValue::_idx
ice::u32 _idx
Definition
config_builder.hxx:40
ice::ConfigBuilderValue::~ConfigBuilderValue
~ConfigBuilderValue() noexcept
ice::ConfigBuilderValue::_alloc
ice::Allocator * _alloc
Definition
config_builder.hxx:38
ice::ConfigBuilderValue::set
auto set(T value) noexcept -> T &
ice::ConfigBuilderValue::reset
void reset()
ice::ConfigBuilderValue::operator=
auto operator=(ConfigBuilderValue &&) noexcept -> ConfigBuilderValue &
ice::ConfigBuilderValue::_internal
ConfigBuilderEntry * _internal
Definition
config_builder.hxx:39
ice::ConfigBuilderValue::ConfigBuilderValue
ConfigBuilderValue(ice::Allocator *alloc, ConfigBuilderEntry *entry, ice::u32 ref) noexcept
ice::ConfigBuilderValue::ConfigBuilderEntry
ice::config::detail::ConfigBuilderEntry ConfigBuilderEntry
Definition
config_builder.hxx:14
ice::ConfigBuilderValue::set
auto set(char const *value) noexcept -> ice::HeapVarString<> &
Definition
config_builder.hxx:31
ice::ErrorCode
Definition
error.hxx:19
ice::HeapVarString
Definition
heap_varstring.hxx:14
ice::Memory
Definition
mem_memory.hxx:13
Generated by
1.18.0