diff options
| author | 2023-06-12 17:05:30 -0400 | |
|---|---|---|
| committer | 2023-07-21 10:56:54 -0400 | |
| commit | 11e7e1b8cec5a665bdc6c9e702f83ad6ea35dd6b (patch) | |
| tree | c308cfcddc0ffd20561114559329411242e31bb5 /src/common/settings_common.cpp | |
| parent | settings_setting: Fix errors (diff) | |
| download | yuzu-11e7e1b8cec5a665bdc6c9e702f83ad6ea35dd6b.tar.gz yuzu-11e7e1b8cec5a665bdc6c9e702f83ad6ea35dd6b.tar.xz yuzu-11e7e1b8cec5a665bdc6c9e702f83ad6ea35dd6b.zip | |
settings: Move some simple data to BasicSetting
Reduces the need for the compiler to duplicate this code, by about
100KB executable size.
Diffstat (limited to '')
| -rw-r--r-- | src/common/settings_common.cpp | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/common/settings_common.cpp b/src/common/settings_common.cpp new file mode 100644 index 000000000..a7ce99515 --- /dev/null +++ b/src/common/settings_common.cpp | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #include <string> | ||
| 5 | #include "common/settings_common.h" | ||
| 6 | |||
| 7 | namespace Settings { | ||
| 8 | |||
| 9 | BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, | ||
| 10 | bool save_, bool runtime_modifiable_) | ||
| 11 | : label{name}, category{category_}, id{linkage.count}, save{save_}, runtime_modifiable{ | ||
| 12 | runtime_modifiable_} { | ||
| 13 | linkage.by_category[category].push_front(this); | ||
| 14 | linkage.count++; | ||
| 15 | } | ||
| 16 | |||
| 17 | BasicSetting::~BasicSetting() = default; | ||
| 18 | |||
| 19 | std::string BasicSetting::ToStringGlobal() const { | ||
| 20 | return this->ToString(); | ||
| 21 | } | ||
| 22 | |||
| 23 | bool BasicSetting::UsingGlobal() const { | ||
| 24 | return true; | ||
| 25 | } | ||
| 26 | |||
| 27 | void BasicSetting::SetGlobal(bool global) {} | ||
| 28 | |||
| 29 | bool BasicSetting::Save() const { | ||
| 30 | return save; | ||
| 31 | } | ||
| 32 | |||
| 33 | bool BasicSetting::RuntimeModfiable() const { | ||
| 34 | return runtime_modifiable; | ||
| 35 | } | ||
| 36 | |||
| 37 | Category BasicSetting::Category() const { | ||
| 38 | return category; | ||
| 39 | } | ||
| 40 | |||
| 41 | const std::string& BasicSetting::GetLabel() const { | ||
| 42 | return label; | ||
| 43 | } | ||
| 44 | |||
| 45 | } // namespace Settings | ||