Browse Source
settings: Move some simple data to BasicSetting
settings: Move some simple data to BasicSetting
Reduces the need for the compiler to duplicate this code, by about 100KB executable size.nce_cpp
5 changed files with 129 additions and 108 deletions
-
2src/common/CMakeLists.txt
-
8src/common/settings.cpp
-
45src/common/settings_common.cpp
-
96src/common/settings_common.h
-
78src/common/settings_setting.h
@ -0,0 +1,45 @@ |
|||||
|
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
|
||||
|
#include <string>
|
||||
|
#include "common/settings_common.h"
|
||||
|
|
||||
|
namespace Settings { |
||||
|
|
||||
|
BasicSetting::BasicSetting(Linkage& linkage, const std::string& name, enum Category category_, |
||||
|
bool save_, bool runtime_modifiable_) |
||||
|
: label{name}, category{category_}, id{linkage.count}, save{save_}, runtime_modifiable{ |
||||
|
runtime_modifiable_} { |
||||
|
linkage.by_category[category].push_front(this); |
||||
|
linkage.count++; |
||||
|
} |
||||
|
|
||||
|
BasicSetting::~BasicSetting() = default; |
||||
|
|
||||
|
std::string BasicSetting::ToStringGlobal() const { |
||||
|
return this->ToString(); |
||||
|
} |
||||
|
|
||||
|
bool BasicSetting::UsingGlobal() const { |
||||
|
return true; |
||||
|
} |
||||
|
|
||||
|
void BasicSetting::SetGlobal(bool global) {} |
||||
|
|
||||
|
bool BasicSetting::Save() const { |
||||
|
return save; |
||||
|
} |
||||
|
|
||||
|
bool BasicSetting::RuntimeModfiable() const { |
||||
|
return runtime_modifiable; |
||||
|
} |
||||
|
|
||||
|
Category BasicSetting::Category() const { |
||||
|
return category; |
||||
|
} |
||||
|
|
||||
|
const std::string& BasicSetting::GetLabel() const { |
||||
|
return label; |
||||
|
} |
||||
|
|
||||
|
} // namespace Settings
|
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue