CYD-UI
A C++ library for building native graphic user interfaces
Loading...
Searching...
No Matches
component_attributes.cppm
Go to the documentation of this file.
1
// Copyright (c) 2024, Víctor Castillo Agüero.
2
// SPDX-License-Identifier: GPL-3.0-or-later
3
4
export
module
cydui.components.base:attributes
;
5
6
import
std;
7
8
export
import
reflect;
9
10
export
import
cydui.dimensions
;
11
import
cydui.graphics
;
12
13
export
import
:holder;
14
15
export
16
{
17
struct
attribute_i
{
18
virtual
~attribute_i
() =
default
;
19
};
20
21
using
content
= std::vector<cydui::components::component_builder_t>;
22
23
template
<
typename
E>
24
struct
attr_content
:
public
attribute_i
{
25
template
<
typename
S = E,
typename
= std::enable_if_t<!std::is_
void
_v<S>>>
26
inline
S &
operator()
(
content
&&_content_) {
27
this->
_content
= _content_;
28
return
*(E*)
this
;
29
}
30
31
template
<
typename
S = E,
typename
= std::enable_if_t<!std::is_
void
_v<S>>>
32
inline
S &
operator()
(
content
&_content_) {
33
this->
_content
= _content_;
34
return
*(E*)
this
;
35
}
36
37
template
<
typename
S = E,
typename
= std::enable_if_t<std::is_
void
_v<S>>>
38
inline
void
operator()
(
content
&&_content_) {
39
this->
_content
= _content_;
40
}
41
42
template
<
typename
S = E,
typename
= std::enable_if_t<std::is_
void
_v<S>>>
43
inline
void
operator()
(
content
&_content_) {
44
this->
_content
= _content_;
45
}
46
47
content
_content
{ };
48
49
bool
operator==
(
const
attr_content
&rhl)
const
{
50
if
(this->
_content
.size() != rhl.
_content
.size()) {
51
return
false
;
52
}
53
54
// TODO - Should I deep compare every child?
55
56
return
true
;
57
}
58
};
59
60
template
<
typename
T =
void
>
61
struct
attrs_component
:
attr_content
<T> {
62
bool
operator==
(
const
attrs_component
&rhl)
const
{
63
return
attr_content<T>::operator==
(rhl);
64
}
65
66
attrs_component
&
update_with
(
const
attrs_component
&rhl) {
67
attr_content<T>::operator=
(rhl);
68
69
return
*
this
;
70
}
71
};
72
73
#undef COMPONENT_ATTRIBUTE
74
#undef COMPONENT_ATTRIBUTE_W_MONITOR
75
}
content
std::vector< cydui::components::component_builder_t > content
Definition
component_attributes.cppm:20
cydui.components.base
cydui.dimensions
cydui.graphics
attr_content
Definition
component_attributes.cppm:23
attr_content::operator()
S & operator()(content &&_content_)
Definition
component_attributes.cppm:25
attr_content::_content
content _content
Definition
component_attributes.cppm:46
attr_content::operator==
bool operator==(const attr_content &rhl) const
Definition
component_attributes.cppm:48
attribute_i
Definition
component_attributes.cppm:16
attribute_i::~attribute_i
virtual ~attribute_i()=default
attrs_component
Definition
component_attributes.cppm:60
attrs_component::update_with
attrs_component & update_with(const attrs_component &rhl)
Definition
component_attributes.cppm:65
attrs_component::operator==
bool operator==(const attrs_component &rhl) const
Definition
component_attributes.cppm:61
include
cyd_ui
components
base
component_attributes.cppm
Generated by
1.13.2