Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/ruisPublic

Commit6b8b5d9

Browse files
committed
stuff
1 parent762ec23 commit6b8b5d9

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

‎src/ruis/style.hpp

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,50 @@
11
#pragma once
22

3+
#include<utki/shared_ref.hpp>
4+
#include<tml/tree.hpp>
5+
36
namespaceruis {
47

5-
classstyle_sheet
8+
classstyle_value_base
69
{
10+
utki::shared_ref<style_sheet> owner_sheet;
711
public:
12+
virtual~style_value_base() =default;
13+
14+
virtualvoidreload(const tml::forest& desc) = 0;
815
};
916

10-
template<typename value_type>
11-
classstyle_value
17+
classstyle_sheet
1218
{
13-
public:
14-
utki::shared_ref<style_sheet> ss;
19+
std::shared_ptr<style_value_base>get(std::string_view style_name);
1520

16-
value_type value;
21+
// TODO: weak_ptr cache and reload cached values
22+
23+
public:
24+
template<typename value_type>
25+
utki::shared_ref<value_type>get(
26+
std::string_view style_name,//
27+
const value_type& default_value
28+
)
29+
{
30+
// TODO:
31+
}
1732
};
1833

1934
template<typename value_type>
2035
classstyled
2136
{
22-
std::shared_ptr<style_value> value;
23-
value_type cur_value;
37+
std::variant<
38+
utki::shared_ref<style_value>,
39+
value_type> value;
2440

2541
public:
2642
styled(value_type value) :
27-
cur_value(std::move(value))
43+
value(std::move(value))
2844
{}
2945

30-
const value_type&get()
46+
const value_type&get()constnoexcept
3147
{
32-
this->cur_value;
33-
}
34-
35-
voidreload()
36-
{
37-
if(!this->value){
38-
return;
39-
}
40-
4148
// TODO:
4249
}
4350
};

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp